Skip to content

Commit

Permalink
feat(projects): add release command
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Jun 4, 2023
1 parent a6f41fe commit 008908b
Show file tree
Hide file tree
Showing 6 changed files with 460 additions and 12 deletions.
439 changes: 434 additions & 5 deletions CHANGELOG.md

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@
"commit": "soy git-commit",
"cleanup": "soy cleanup",
"update-pkg": "soy update-pkg",
"update-version": "bumpp **/package.json !**/node_modules --execute=\"pnpm soy changelog && git add .\" --tag --commit=\"chore(projects): release v%s\"",
"publish-pkg": "pnpm -r publish --access public",
"typecheck": "tsc --noEmit",
"release": "pnpm update-version && pnpm build && pnpm publish-pkg"
"release": "soy release && pnpm build && pnpm publish-pkg"
},
"dependencies": {
"bumpp": "9.1.0",
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from './format';
export * from './eslint-prettier';
export * from './lint-staged';
export * from './changelog';
export * from './release';
13 changes: 13 additions & 0 deletions src/command/release.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { execa } from 'execa';

export async function release() {
await execa('npx', [
'bumpp',
'**/package.json',
'!**/node_modules',
'--execute="npx soy changelog"',
'--all',
'--tag',
'--commit="chore(projects): release v%s"'
]);
}
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
prettierFormat,
eslintPretter,
lintStaged,
genChangelog
genChangelog,
release
} from './command';

const cli = cac('soybean');
Expand All @@ -26,7 +27,8 @@ type Command =
| 'prettier-format'
| 'eslint-prettier'
| 'lint-staged'
| 'changelog';
| 'changelog'
| 'release';

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

Expand Down Expand Up @@ -74,6 +76,10 @@ const commands: CommandWithAction<CommandArg> = {
action: async args => {
await genChangelog(args?.total);
}
},
release: {
desc: '发布:更新版本号、生成changelog、提交代码',
action: release
}
};

Expand Down

0 comments on commit 008908b

Please sign in to comment.