Skip to content

Commit 2a490e3

Browse files
chore: update scripts
1 parent 64fea43 commit 2a490e3

File tree

2 files changed

+40
-33
lines changed

2 files changed

+40
-33
lines changed

scripts/gen-docs.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
const path = require('../release/cjs/index.cjs.js');
1+
let path;
2+
3+
try {
4+
path = require('../build/cjs/index.cjs.js');
5+
} catch (e) {
6+
console.log('Cannot import path-nice from ./build/cjs, do you forget to build?');
7+
}
8+
29
const { sh } = require('./utils');
310

411
main();

scripts/release.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ async function main() {
88

99
console.log('release: v' + version);
1010

11-
// // at dev branch
12-
// if ((await x('git branch --show-current')) !== 'dev') {
13-
// console.log(`x('git branch --show-current') !== 'dev'`);
14-
// return;
15-
// }
16-
17-
// // working tree is clean
18-
// if ((await x('git status --porcelain')) !== '') {
19-
// console.log(`x('git status --porcelain') !== ''`);
20-
// return;
21-
// }
22-
23-
// // rebase & merge
24-
// await sh('git rebase -i main');
25-
// await sh('git checkout main');
26-
// await sh('git merge dev');
11+
// at dev branch
12+
if ((await x('git branch --show-current')) !== 'dev') {
13+
console.log(`x('git branch --show-current') !== 'dev'`);
14+
return;
15+
}
16+
17+
// working tree is clean
18+
if ((await x('git status --porcelain')) !== '') {
19+
console.log(`x('git status --porcelain') !== ''`);
20+
return;
21+
}
22+
23+
// rebase & merge
24+
await sh('git rebase -i main');
25+
await sh('git checkout main');
26+
await sh('git merge dev');
2727

2828
// build & test
2929
await fs.remove('./build');
3030
await sh('tsc -p tsconfig.cjs.json');
3131
await sh('tsc -p tsconfig.esm.json');
32-
// await sh('jest');
32+
await sh('yarn test');
3333

3434
// we can use path-nice now
3535
const path = require('../build/cjs/index.cjs.js');
@@ -44,21 +44,21 @@ async function main() {
4444
// generate CHANGLOG.md
4545
await sh('conventional-changelog -p angular -i CHANGELOG.md -s');
4646

47-
// // commit, back to dev branch, tag
48-
// await sh('git add -A');
49-
// await sh(`git commit -m "chore: release ${version}"`);
50-
// await sh(`git tag v${version}`);
51-
// await sh('git checkout dev');
52-
// await sh('git merge main');
53-
54-
// // sync
55-
// await sh('git push --all');
56-
// await sh(`git push origin v${version}`);
57-
58-
// console.log(chalk.red(`Critical operation:`));
59-
// console.log(chalk.red(` $ npm publish --dry-run ./release`));
60-
// console.log(chalk.red(` $ npm publish ./release`));
61-
// console.log(chalk.red(`Copy the command and execute it yourself.`));
47+
// commit, back to dev branch, tag
48+
await sh('git add -A');
49+
await sh(`git commit -m "chore: release ${version}"`);
50+
await sh(`git tag v${version}`);
51+
await sh('git checkout dev');
52+
await sh('git merge main');
53+
54+
// sync
55+
await sh('git push --all');
56+
await sh(`git push origin v${version}`);
57+
58+
console.log(chalk.red(`Critical operation:`));
59+
console.log(chalk.red(` $ npm publish --dry-run ./release`));
60+
console.log(chalk.red(` $ npm publish ./release`));
61+
console.log(chalk.red(`Copy the command and execute it yourself.`));
6262
}
6363

6464
function getInput() {

0 commit comments

Comments
 (0)