Skip to content

Commit

Permalink
build: supplementary deployment mode
Browse files Browse the repository at this point in the history
  • Loading branch information
anran758 committed Mar 20, 2024
1 parent 04046f2 commit 81fc004
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 29 deletions.
30 changes: 1 addition & 29 deletions docs/dev-and-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,6 @@ git branch -d feature/cli

## 发布

开启新的 release 分支,准备发布。

```bash
git flow release start v0.1.1
```

通过 `lerna` 更新 package 发版。

> 注意,若 package 是需要编译源码的话,请确保 `package.json` 中含有 `prepublishOnly` 的 hook 做构建相关的工作,确保上传到 npm 的代码是最新的。
```bash
lerna publish --no-private

# lerna version 会自动升级项目中的包版本号。具体的说它会做以下事情:

# 1. 检查项目中的所有包的当前版本号和它们的依赖关系,确定下一个版本号(根据 semver 规范)。
# 2. 更新每个包的 package.json 文件中的版本号字段。
# 3. 提交更新后的 package.json 文件和版本变更记录到 Git 仓库。
# 4. 为每个更新后的包创建 Git tag。
# 5. 将更新后的包发布到适当的 registry。
```

`master` 分支是受保护的,不允许直接操作 `master` 分支。经过测试确认无误后,需要通过 Github 提出 Pull Request ,并且经过审核后再合并至 master 分支中。

合并到 `master` 分支后需要关闭 `release` 分支:

```bash
git flow release finish v0.1.1
```

由于 `release` 分支已经被合并到 `master` 中,因此默认会跳过合并 `master` 的步骤,只会合并到 `develop` 中,并删除 `release` 分支。
`master` 分支执行 `npx lerna run release`
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"version": "independent",
"command": {
"version": {
"createRelease": "github",
"conventionalCommits": true,
"message": "chore(release): publish"
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"scripts": {
"pre-commit": "pnpm lint-staged",
"postinstall": "husky install",
"release": "lerna release --no-private",
"build": "pnpm -r --filter \"./packages/*\" run build",
"lint-fix": "eslint . --fix",
"lint": "eslint .",
Expand Down
1 change: 1 addition & 0 deletions packages/faas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"scripts": {
"prepare": "pnpm run build",
"prepublishOnly": "pnpm run build",
"test": "jest --verbose",
"build": "pnpm run '/build:.*/'",
"build:esm": "rm -rf lib/esm && tsc -p ./tsconfig.json",
Expand Down
1 change: 1 addition & 0 deletions packages/io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dist"
],
"scripts": {
"prepublishOnly": "pnpm run build",
"lint": "eslint .",
"test": "jest --verbose",
"build": "webpack --mode=production --node-env=production",
Expand Down

0 comments on commit 81fc004

Please sign in to comment.