Skip to content

Commit 008908b

Browse files
committed
feat(projects): add release command
1 parent a6f41fe commit 008908b

File tree

6 files changed

+460
-12
lines changed

6 files changed

+460
-12
lines changed

CHANGELOG.md

Lines changed: 434 additions & 5 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@
3838
"commit": "soy git-commit",
3939
"cleanup": "soy cleanup",
4040
"update-pkg": "soy update-pkg",
41-
"update-version": "bumpp **/package.json !**/node_modules --execute=\"pnpm soy changelog && git add .\" --tag --commit=\"chore(projects): release v%s\"",
4241
"publish-pkg": "pnpm -r publish --access public",
4342
"typecheck": "tsc --noEmit",
44-
"release": "pnpm update-version && pnpm build && pnpm publish-pkg"
43+
"release": "soy release && pnpm build && pnpm publish-pkg"
4544
},
4645
"dependencies": {
4746
"bumpp": "9.1.0",

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/command/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ export * from './format';
77
export * from './eslint-prettier';
88
export * from './lint-staged';
99
export * from './changelog';
10+
export * from './release';

src/command/release.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { execa } from 'execa';
2+
3+
export async function release() {
4+
await execa('npx', [
5+
'bumpp',
6+
'**/package.json',
7+
'!**/node_modules',
8+
'--execute="npx soy changelog"',
9+
'--all',
10+
'--tag',
11+
'--commit="chore(projects): release v%s"'
12+
]);
13+
}

src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
prettierFormat,
1111
eslintPretter,
1212
lintStaged,
13-
genChangelog
13+
genChangelog,
14+
release
1415
} from './command';
1516

1617
const cli = cac('soybean');
@@ -26,7 +27,8 @@ type Command =
2627
| 'prettier-format'
2728
| 'eslint-prettier'
2829
| 'lint-staged'
29-
| 'changelog';
30+
| 'changelog'
31+
| 'release';
3032

3133
type CommandAction<A extends object> = (args?: A) => Promise<void> | void;
3234

@@ -74,6 +76,10 @@ const commands: CommandWithAction<CommandArg> = {
7476
action: async args => {
7577
await genChangelog(args?.total);
7678
}
79+
},
80+
release: {
81+
desc: '发布:更新版本号、生成changelog、提交代码',
82+
action: release
7783
}
7884
};
7985

0 commit comments

Comments
 (0)