Skip to content

Commit c8896bb

Browse files
style(scripts): rename utils.shell to utils.sh, add '$ ' as prefix of cmd printed
1 parent 8b7ccc7 commit c8896bb

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

scripts/gen-docs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
const path = require('../release/cjs/index.cjs.js');
2-
const { shell } = require('./utils');
2+
const { sh } = require('./utils');
33

44
main();
55
async function main() {
66
await path('README.md').rename('README-en.md');
77
await path('README-cn.md').rename('README.md');
88

9-
await shell('typedoc --options typedoc.json');
9+
await sh('typedoc --options typedoc.json');
1010

1111
await path('docs/index.html').rename('docs/index-cn.html');
1212

1313
await path('README.md').rename('README-cn.md');
1414
await path('README-en.md').rename('README.md');
1515

16-
await shell('typedoc --options typedoc.json');
16+
await sh('typedoc --options typedoc.json');
1717

1818
await Promise.all([fixPath('docs/index.html'), fixPath('docs/index-cn.html')]);
1919

scripts/release.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fs = require('fs-extra');
22
const chalk = require('chalk');
3-
const { x, shell } = require('./utils');
3+
const { x, sh } = require('./utils');
44

55
main();
66
async function main() {
@@ -18,29 +18,29 @@ async function main() {
1818
return;
1919
}
2020

21-
await shell('git rebase -i main');
22-
await shell('git checkout main');
23-
await shell('git merge dev');
21+
await sh('git rebase -i main');
22+
await sh('git checkout main');
23+
await sh('git merge dev');
2424

2525
await fs.remove('./build');
26-
await shell('tsc -p tsconfig.cjs.json');
27-
await shell('tsc -p tsconfig.esm.json');
28-
await shell('jest');
26+
await sh('tsc -p tsconfig.cjs.json');
27+
await sh('tsc -p tsconfig.esm.json');
28+
await sh('jest');
2929

3030
const path = require('../build/cjs/index.cjs.js');
3131

3232
await path('package.json').updateJSON((pkg) => {
3333
pkg.version = version;
3434
});
3535
await genRelease();
36-
await shell('yarn docs');
37-
await shell('conventional-changelog -p angular -i CHANGELOG.md -s');
38-
39-
await shell('git add -A');
40-
await shell(`git commit -m "chore: release ${version}"`);
41-
await shell('git push');
42-
await shell(`git tag v${version}`);
43-
await shell(`git push origin v${version}`);
36+
await sh('yarn docs');
37+
await sh('conventional-changelog -p angular -i CHANGELOG.md -s');
38+
39+
await sh('git add -A');
40+
await sh(`git commit -m "chore: release ${version}"`);
41+
await sh('git push');
42+
await sh(`git tag v${version}`);
43+
await sh(`git push origin v${version}`);
4444

4545
console.log(chalk.red(`Critical operation:`));
4646
console.log(chalk.red(` $ npm publish --dry-run ./release`));

scripts/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ const { spawn, exec } = require('child_process');
44

55
const _exec = util.promisify(exec);
66
exports.x = async function x(cmd) {
7-
console.log(chalk.bgCyan(cmd));
7+
console.log(chalk.bgCyan('$ ' + cmd));
88
const { stdout } = await _exec(cmd);
99
return stdout.trim();
1010
};
1111

12-
exports.shell = async function shell(cmd) {
13-
console.log(chalk.bgCyan(cmd));
12+
exports.sh = async function sh(cmd) {
13+
console.log(chalk.bgCyan('$ ' + cmd));
1414
return new Promise((ok, err) => {
1515
const proc = spawn(cmd, {
1616
stdio: 'inherit',

0 commit comments

Comments
 (0)