@regenbio/regenbio-components-react 1.2.29 → 1.2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regenbio/regenbio-components-react",
3
- "version": "1.2.29",
3
+ "version": "1.2.30",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -8,9 +8,11 @@
8
8
  "main": "build/index.js",
9
9
  "types": "build/index.d.ts",
10
10
  "scripts": {
11
+ "checkVersion": "node scripts/checkVersion.js",
12
+ "reinstall": "rm -rf node_modules && yarn install",
11
13
  "start": "webpack --watch",
12
14
  "build": "rimraf build && webpack",
13
- "prepublishOnly": "npm run build",
15
+ "prepublishOnly": "npm run checkVersion && npm run reinstall && npm run build",
14
16
  "test": "echo \"Error: no test specified\" && exit 1"
15
17
  },
16
18
  "keywords": [],
@@ -27,6 +29,7 @@
27
29
  },
28
30
  "devDependencies": {
29
31
  "@ant-design/pro-components": "^2.6.48",
32
+ "@umijs/max": "^4.1.1",
30
33
  "@babel/core": "^7.26.0",
31
34
  "@babel/preset-env": "^7.26.0",
32
35
  "@babel/preset-react": "^7.26.3",
@@ -0,0 +1,19 @@
1
+ const { execSync } = require('child_process');
2
+ const packageJson = require('../package.json');
3
+
4
+ const packageName = packageJson.name;
5
+ const packageVersion = packageJson.version;
6
+
7
+ try {
8
+ const result = execSync(`npm view ${packageName}@${packageVersion}`, {
9
+ stdio: 'pipe'
10
+ }).toString();
11
+
12
+ if (result) {
13
+ console.error(`\x1b[31m当前版本号 ${packageName}:${packageVersion} 已存在,请更新版本号。\x1b[0m`);
14
+ process.exit(1); // 终止发布
15
+ }
16
+ } catch (error) {
17
+ // 如果版本不存在,npm view 会抛出错误,可以继续发布
18
+ console.log(`\x1b[32m当前版本号 ${packageVersion} 不存在冲突,可以发布。\x1b[0m`);
19
+ }