Skip to content

Commit 4979291

Browse files
committed
fix(release): sync root package version
1 parent 1d5ac35 commit 4979291

5 files changed

Lines changed: 113 additions & 104 deletions

File tree

‎RELEASE.md‎

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
Deep Code 使用三个脚本管理 monorepo 的版本发布流程:
44

5-
| 脚本 | 命令 | 用途 |
6-
|------|------|------|
7-
| `scripts/version.js` | `npm run release:version` | 升级所有 workspace 包的版本号 + 重新生成 lockfile |
8-
| `scripts/prepare-package.js` | `npm run prepare:package` | 构建 CLI + 质量检查 + 发布到 npm + git commit & tag |
9-
| `scripts/prepare-vscode.js` | `npm run prepare:vscode` | 构建 VSCode 扩展 + 质量检查 + 发布到 VS Code 市场 + git commit & tag |
5+
| 脚本 | 命令 | 用途 |
6+
| ---------------------------- | ------------------------- | -------------------------------------------------------------------- |
7+
| `scripts/version.js` | `npm run release:version` | 同步根包和所有 workspace 包的版本号 + 更新 lockfile |
8+
| `scripts/prepare-package.js` | `npm run prepare:package` | 构建 CLI + 质量检查 + 发布到 npm + git commit & tag |
9+
| `scripts/prepare-vscode.js` | `npm run prepare:vscode` | 构建 VSCode 扩展 + 质量检查 + 发布到 VS Code 市场 + git commit & tag |
1010

1111
发布流程:先升版本号,再分别发布 CLI 和 VSCode 扩展。
1212

@@ -26,16 +26,16 @@ npm run release:version -- <bump-type | version> [options]
2626
2727
### 支持的 bump 类型
2828

29-
| 类型 | 当前版本 | 结果 | 说明 |
30-
|------|---------|------|------|
31-
| `patch` | `0.1.31` | `0.1.32` | 补丁版本 +1 |
32-
| `minor` | `0.1.31` | `0.2.0` | 次版本 +1,patch 归零 |
33-
| `major` | `0.1.31` | `1.0.0` | 主版本 +1,minor/patch 归零 |
34-
| `prepatch` | `0.1.31` | `0.1.32-0` | 预发布补丁 |
35-
| `preminor` | `0.1.31` | `0.2.0-0` | 预发布次版本 |
36-
| `premajor` | `0.1.31` | `1.0.0-0` | 预发布主版本 |
37-
| `prerelease` | `0.1.31` | `0.1.32-0` | 递增预发布号 |
38-
| `from-git` | — | 从最新 git tag 读取 | 适用于已有 tag 但未更新 package.json 的情况 |
29+
| 类型 | 当前版本 | 结果 | 说明 |
30+
| ------------ | -------- | ------------------- | ------------------------------------------- |
31+
| `patch` | `0.1.31` | `0.1.32` | 补丁版本 +1 |
32+
| `minor` | `0.1.31` | `0.2.0` | 次版本 +1,patch 归零 |
33+
| `major` | `0.1.31` | `1.0.0` | 主版本 +1,minor/patch 归零 |
34+
| `prepatch` | `0.1.31` | `0.1.32-0` | 预发布补丁 |
35+
| `preminor` | `0.1.31` | `0.2.0-0` | 预发布次版本 |
36+
| `premajor` | `0.1.31` | `1.0.0-0` | 预发布主版本 |
37+
| `prerelease` | `0.1.31` | `0.1.32-0` | 递增预发布号 |
38+
| `from-git` | — | 从最新 git tag 读取 | 适用于已有 tag 但未更新 package.json 的情况 |
3939

4040
也可以直接指定版本号:
4141

@@ -71,8 +71,8 @@ npm run release:version -- premajor --preid alpha
7171

7272
1. 读取 `packages/core/package.json` 中的当前版本
7373
2. 根据 bump 类型计算目标版本
74-
3. 更新 **所有** `packages/*/package.json` 的 `version` 字段(core、cli、vscode-ide-companion)
75-
4. 删除旧的 `package-lock.json`,执行 `npm install --package-lock-only` 重新生成
74+
3. 更新根 `package.json` 和 **所有** `packages/*/package.json` 的 `version` 字段(core、cli、vscode-ide-companion)
75+
4. 同步更新 `package-lock.json` 中根包和各工作区包的版本条目
7676

7777
### 完整示例
7878

@@ -116,25 +116,25 @@ npm run prepare:package -- <version> [options]
116116

117117
### 参数
118118

119-
| 参数 | 说明 |
120-
|------|------|
121-
| `<version>` | **必填**,要发布的 semver 版本号 |
119+
| 参数 | 说明 |
120+
| ------------------ | ---------------------------------------------------- |
121+
| `<version>` | **必填**,要发布的 semver 版本号 |
122122
| `--tag <dist-tag>` | npm dist-tag,默认 `"latest`",常用于 `beta`、`next` |
123-
| `--dry-run` | 预演模式,不实际执行任何写操作 |
124-
| `--force` | 跳过 main 分支检查,允许从其他分支发布 |
123+
| `--dry-run` | 预演模式,不实际执行任何写操作 |
124+
| `--force` | 跳过 main 分支检查,允许从其他分支发布 |
125125

126126
### 执行流程(8 步)
127127

128-
| 步骤 | 操作 | 说明 |
129-
|------|------|------|
130-
| 1 | Git 检查 | 工作区必须 clean,必须在 main 分支(`--force` 可跳过分支检查) |
131-
| 2 | npm 认证 | 检查 `npm whoami`,未登录则中止 |
132-
| 3 | 更新版本号 | 同时更新 `packages/core` 和 `packages/cli` 的 version |
133-
| 4 | 质量检查 | `npm run check`(typecheck + eslint + prettier) |
134-
| 5 | 测试 | `npm run test --workspaces` |
135-
| 6 | 构建 | `npm run build`(core tsc + esbuild 将 core 及所有依赖内联到 `dist/cli.js`) |
136-
| 7 | 发布 CLI | 往 `dist/` 写入 `dependencies: {}` 的 package.json,从 `dist/` 目录执行 `npm publish` |
137-
| 8 | Git commit & tag | `chore(release): v<version>` + `git tag v<version>` |
128+
| 步骤 | 操作 | 说明 |
129+
| ---- | ---------------- | ------------------------------------------------------------------------------------- |
130+
| 1 | Git 检查 | 工作区必须 clean,必须在 main 分支(`--force` 可跳过分支检查) |
131+
| 2 | npm 认证 | 检查 `npm whoami`,未登录则中止 |
132+
| 3 | 更新版本号 | 同时更新 `packages/core` 和 `packages/cli` 的 version |
133+
| 4 | 质量检查 | `npm run check`(typecheck + eslint + prettier) |
134+
| 5 | 测试 | `npm run test --workspaces` |
135+
| 6 | 构建 | `npm run build`(core tsc + esbuild 将 core 及所有依赖内联到 `dist/cli.js`) |
136+
| 7 | 发布 CLI | 往 `dist/` 写入 `dependencies: {}` 的 package.json,从 `dist/` 目录执行 `npm publish` |
137+
| 8 | Git commit & tag | `chore(release): v<version>` + `git tag v<version>` |
138138

139139
### 完整示例
140140

@@ -192,23 +192,23 @@ VSCE_PAT=<token> npm run prepare:vscode -- <version> [options]
192192

193193
### 参数
194194

195-
| 参数 | 说明 |
196-
|------|------|
197-
| `<version>` | **必填**,要发布的 semver 版本号 |
198-
| `--dry-run` | 预演模式,不实际执行任何写操作 |
199-
| `--force` | 跳过 main 分支检查,允许从其他分支发布 |
195+
| 参数 | 说明 |
196+
| ----------- | -------------------------------------- |
197+
| `<version>` | **必填**,要发布的 semver 版本号 |
198+
| `--dry-run` | 预演模式,不实际执行任何写操作 |
199+
| `--force` | 跳过 main 分支检查,允许从其他分支发布 |
200200

201201
### 执行流程(7 步)
202202

203-
| 步骤 | 操作 | 说明 |
204-
|------|------|------|
205-
| 1 | Git 检查 | 工作区必须 clean,必须在 main 分支 |
206-
| 2 | VSCE_PAT 检查 | 环境变量必须已设置 |
207-
| 3 | 更新版本号 | 同时更新 `packages/core`、`packages/cli`、`packages/vscode-ide-companion` 的 version |
208-
| 4 | 质量检查 | `npm run check`(typecheck + eslint + prettier) |
209-
| 5 | 测试 | `npm run test --workspaces` |
210-
| 6 | 构建 | `npm run build:vscode`(core tsc + esbuild 打包扩展 + 拷贝模板 + vsce package) |
211-
| 7 | 发布 | `vsce publish <version> --no-dependencies` 发布到 VS Code Marketplace |
203+
| 步骤 | 操作 | 说明 |
204+
| ---- | ------------- | ------------------------------------------------------------------------------------ |
205+
| 1 | Git 检查 | 工作区必须 clean,必须在 main 分支 |
206+
| 2 | VSCE_PAT 检查 | 环境变量必须已设置 |
207+
| 3 | 更新版本号 | 同时更新 `packages/core`、`packages/cli`、`packages/vscode-ide-companion` 的 version |
208+
| 4 | 质量检查 | `npm run check`(typecheck + eslint + prettier) |
209+
| 5 | 测试 | `npm run test --workspaces` |
210+
| 6 | 构建 | `npm run build:vscode`(core tsc + esbuild 打包扩展 + 拷贝模板 + vsce package) |
211+
| 7 | 发布 | `vsce publish <version> --no-dependencies` 发布到 VS Code Marketplace |
212212

213213
### 完整示例
214214

‎RELEASE_en.md‎

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
Deep Code uses three scripts to manage version releases in the monorepo:
44

5-
| Script | Command | Purpose |
6-
|--------|---------|---------|
7-
| `scripts/version.js` | `npm run release:version` | Bump all workspace package versions + regenerate lockfile |
8-
| `scripts/prepare-package.js` | `npm run prepare:package` | Build CLI + quality checks + publish to npm + git commit & tag |
9-
| `scripts/prepare-vscode.js` | `npm run prepare:vscode` | Build VSCode extension + quality checks + publish to VS Code Marketplace + git commit & tag |
5+
| Script | Command | Purpose |
6+
| ---------------------------- | ------------------------- | ------------------------------------------------------------------------------------------- |
7+
| `scripts/version.js` | `npm run release:version` | Sync root and workspace package versions + update lockfile |
8+
| `scripts/prepare-package.js` | `npm run prepare:package` | Build CLI + quality checks + publish to npm + git commit & tag |
9+
| `scripts/prepare-vscode.js` | `npm run prepare:vscode` | Build VSCode extension + quality checks + publish to VS Code Marketplace + git commit & tag |
1010

1111
Release flow: bump version first, then publish CLI and VSCode extension separately.
1212

@@ -26,16 +26,16 @@ npm run release:version -- <bump-type | version> [options]
2626
2727
### Supported Bump Types
2828

29-
| Type | Current | Result | Description |
30-
|------|---------|--------|-------------|
31-
| `patch` | `0.1.31` | `0.1.32` | Patch version +1 |
32-
| `minor` | `0.1.31` | `0.2.0` | Minor version +1, patch reset |
33-
| `major` | `0.1.31` | `1.0.0` | Major version +1, minor/patch reset |
34-
| `prepatch` | `0.1.31` | `0.1.32-0` | Pre-release patch |
35-
| `preminor` | `0.1.31` | `0.2.0-0` | Pre-release minor |
36-
| `premajor` | `0.1.31` | `1.0.0-0` | Pre-release major |
37-
| `prerelease` | `0.1.31` | `0.1.32-0` | Increment pre-release number |
38-
| `from-git` | — | Read from latest git tag | For cases where tag exists but package.json not updated |
29+
| Type | Current | Result | Description |
30+
| ------------ | -------- | ------------------------ | ------------------------------------------------------- |
31+
| `patch` | `0.1.31` | `0.1.32` | Patch version +1 |
32+
| `minor` | `0.1.31` | `0.2.0` | Minor version +1, patch reset |
33+
| `major` | `0.1.31` | `1.0.0` | Major version +1, minor/patch reset |
34+
| `prepatch` | `0.1.31` | `0.1.32-0` | Pre-release patch |
35+
| `preminor` | `0.1.31` | `0.2.0-0` | Pre-release minor |
36+
| `premajor` | `0.1.31` | `1.0.0-0` | Pre-release major |
37+
| `prerelease` | `0.1.31` | `0.1.32-0` | Increment pre-release number |
38+
| `from-git` | — | Read from latest git tag | For cases where tag exists but package.json not updated |
3939

4040
You can also specify an exact version:
4141

@@ -71,8 +71,8 @@ npm run release:version -- premajor --preid alpha
7171

7272
1. Reads current version from `packages/core/package.json`
7373
2. Calculates target version based on bump type
74-
3. Updates `version` field in **all** `packages/*/package.json` (core, cli, vscode-ide-companion)
75-
4. Deletes old `package-lock.json` and regenerates via `npm install --package-lock-only`
74+
3. Updates the root `package.json` and **all** `packages/*/package.json` version fields (core, cli, vscode-ide-companion)
75+
4. Updates the root and workspace package version entries in `package-lock.json`
7676

7777
### Examples
7878

@@ -116,25 +116,25 @@ npm run prepare:package -- <version> [options]
116116

117117
### Arguments
118118

119-
| Argument | Description |
120-
|----------|-------------|
121-
| `<version>` | **Required**. Semver version to publish |
122-
| `--tag <dist-tag>` | npm dist-tag, default `"latest"`, commonly `beta` or `next` |
123-
| `--dry-run` | Preview mode, no actual writes |
124-
| `--force` | Skip main branch check, allow publishing from other branches |
119+
| Argument | Description |
120+
| ------------------ | ------------------------------------------------------------ |
121+
| `<version>` | **Required**. Semver version to publish |
122+
| `--tag <dist-tag>` | npm dist-tag, default `"latest"`, commonly `beta` or `next` |
123+
| `--dry-run` | Preview mode, no actual writes |
124+
| `--force` | Skip main branch check, allow publishing from other branches |
125125

126126
### Execution Flow (8 Steps)
127127

128-
| Step | Action | Description |
129-
|------|--------|-------------|
130-
| 1 | Git check | Working tree must be clean, must be on main branch (`--force` skips branch check) |
131-
| 2 | npm auth | Checks `npm whoami`, aborts if not logged in |
132-
| 3 | Update versions | Updates `packages/core` and `packages/cli` version fields |
133-
| 4 | Quality checks | `npm run check` (typecheck + eslint + prettier) |
134-
| 5 | Tests | `npm run test --workspaces` |
135-
| 6 | Build | `npm run build` (core tsc + esbuild inlines core and all deps into `dist/cli.js`) |
136-
| 7 | Publish CLI | Writes `dist/package.json` with `dependencies: {}`, runs `npm publish` from `dist/` |
137-
| 8 | Git commit & tag | `chore(release): v<version>` + `git tag v<version>` |
128+
| Step | Action | Description |
129+
| ---- | ---------------- | ----------------------------------------------------------------------------------- |
130+
| 1 | Git check | Working tree must be clean, must be on main branch (`--force` skips branch check) |
131+
| 2 | npm auth | Checks `npm whoami`, aborts if not logged in |
132+
| 3 | Update versions | Updates `packages/core` and `packages/cli` version fields |
133+
| 4 | Quality checks | `npm run check` (typecheck + eslint + prettier) |
134+
| 5 | Tests | `npm run test --workspaces` |
135+
| 6 | Build | `npm run build` (core tsc + esbuild inlines core and all deps into `dist/cli.js`) |
136+
| 7 | Publish CLI | Writes `dist/package.json` with `dependencies: {}`, runs `npm publish` from `dist/` |
137+
| 8 | Git commit & tag | `chore(release): v<version>` + `git tag v<version>` |
138138

139139
### Examples
140140

@@ -192,23 +192,23 @@ VSCE_PAT=<token> npm run prepare:vscode -- <version> [options]
192192

193193
### Arguments
194194

195-
| Argument | Description |
196-
|----------|-------------|
197-
| `<version>` | **Required**. Semver version to publish |
198-
| `--dry-run` | Preview mode, no actual writes |
199-
| `--force` | Skip main branch check, allow publishing from other branches |
195+
| Argument | Description |
196+
| ----------- | ------------------------------------------------------------ |
197+
| `<version>` | **Required**. Semver version to publish |
198+
| `--dry-run` | Preview mode, no actual writes |
199+
| `--force` | Skip main branch check, allow publishing from other branches |
200200

201201
### Execution Flow (7 Steps)
202202

203-
| Step | Action | Description |
204-
|------|--------|-------------|
205-
| 1 | Git check | Working tree must be clean, must be on main branch |
206-
| 2 | VSCE_PAT check | Environment variable must be set |
207-
| 3 | Update versions | Updates `packages/core`, `packages/cli`, and `packages/vscode-ide-companion` version fields |
208-
| 4 | Quality checks | `npm run check` (typecheck + eslint + prettier) |
209-
| 5 | Tests | `npm run test --workspaces` |
210-
| 6 | Build | `npm run build:vscode` (core tsc + esbuild bundle extension + copy templates + vsce package) |
211-
| 7 | Publish | `vsce publish <version> --no-dependencies` to VS Code Marketplace |
203+
| Step | Action | Description |
204+
| ---- | --------------- | -------------------------------------------------------------------------------------------- |
205+
| 1 | Git check | Working tree must be clean, must be on main branch |
206+
| 2 | VSCE_PAT check | Environment variable must be set |
207+
| 3 | Update versions | Updates `packages/core`, `packages/cli`, and `packages/vscode-ide-companion` version fields |
208+
| 4 | Quality checks | `npm run check` (typecheck + eslint + prettier) |
209+
| 5 | Tests | `npm run test --workspaces` |
210+
| 6 | Build | `npm run build:vscode` (core tsc + esbuild bundle extension + copy templates + vsce package) |
211+
| 7 | Publish | `vsce publish <version> --no-dependencies` to VS Code Marketplace |
212212

213213
### Examples
214214

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vegamo/deepcode-monorepo",
3-
"version": "0.2.1",
3+
"version": "0.3.1",
44
"private": true,
55
"description": "Deep Code — CLI, core library, and VSCode companion",
66
"license": "MIT",

0 commit comments

Comments
 (0)