Skip to content

Commit 7b6daed

Browse files
committed
fix(ci): change the version of pkg.json published actually
1 parent b4e39bc commit 7b6daed

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
id: changesets
4747
uses: changesets/action@v1
4848
with:
49-
version: pnpm exec changeset version
49+
version: pnpm run version
5050
publish: pnpm exec changeset publish --access public
5151
commit: "chore(release): release in ci"
5252
title: "chore(release): release in ci"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"build:inula-request": "pnpm -F inula-request build",
2121
"build:inula-router": "pnpm -F inula-router build",
2222
"commitlint": "commitlint --config commitlint.config.js -e",
23+
"version": "pnpm exec changeset version && node packages/inula/scripts/sync-version.js",
2324
"postinstall": "husky install"
2425
},
2526
"lint-staged": {

packages/inula/scripts/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"keywords": [
55
"inula"
66
],
7-
"version": "0.1.13",
7+
"version": "0.1.14",
88
"homepage": "",
99
"bugs": "",
1010
"license": "MulanPSL2",
@@ -18,7 +18,7 @@
1818
".": {
1919
"default": "./index.js"
2020
},
21-
"./package.json":"./package.json",
21+
"./package.json": "./package.json",
2222
"./jsx-runtime": "./jsx-runtime.js",
2323
"./jsx-dev-runtime": "./jsx-dev-runtime.js"
2424
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
// 读取主 package.json
5+
const mainPackagePath = path.resolve('./packages/inula/package.json');
6+
const mainPackage = require(mainPackagePath);
7+
8+
// 读取目标 package.json
9+
const targetPackagePath = path.resolve('./packages/inula/scripts/package.json');
10+
const targetPackage = require(targetPackagePath);
11+
12+
// 同步版本号
13+
targetPackage.version = mainPackage.version;
14+
15+
// 写回目标文件
16+
fs.writeFileSync(targetPackagePath, JSON.stringify(targetPackage, null, 2) + '\n', 'utf8');
17+
18+
console.log(`版本号已同步: ${mainPackage.version}`);

0 commit comments

Comments
 (0)