forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsemantic-release-prepare.ts
More file actions
54 lines (47 loc) · 1.49 KB
/
semantic-release-prepare.ts
File metadata and controls
54 lines (47 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const path = require('path');
const { fork } = require('child_process');
const colors = require('colors');
const { readFileSync, writeFileSync } = require('fs');
const pkg = JSON.parse(
readFileSync(path.resolve(__dirname, '..', 'package.json'))
);
pkg.scripts.prepush = 'npm run test:prod && npm run build';
pkg.scripts.commitmsg = 'validate-commit-msg';
writeFileSync(
path.resolve(__dirname, '..', 'package.json'),
JSON.stringify(pkg, null, 2)
);
// Call husky to set up the hooks
fork(path.resolve(__dirname, '..', 'node_modules', 'husky', 'bin', 'install'));
console.log();
console.log(colors.green('Done!!'));
console.log();
if (pkg.repository.url.trim()) {
console.log(colors.cyan('Now run:'));
console.log(colors.cyan(' npm install -g semantic-release-cli'));
console.log(colors.cyan(' semantic-release-cli setup'));
console.log();
console.log(
colors.cyan('Important! Answer NO to "Generate travis.yml" question')
);
console.log();
console.log(
colors.gray(
'Note: Make sure "repository.url" in your package.json is correct before'
)
);
} else {
console.log(
colors.red(
'First you need to set the "repository.url" property in package.json'
)
);
console.log(colors.cyan('Then run:'));
console.log(colors.cyan(' npm install -g semantic-release-cli'));
console.log(colors.cyan(' semantic-release-cli setup'));
console.log();
console.log(
colors.cyan('Important! Answer NO to "Generate travis.yml" question')
);
}
console.log();