iv-npm 1.2.58 → 1.2.59

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": "iv-npm",
3
- "version": "1.2.58",
3
+ "version": "1.2.59",
4
4
  "description": "公共通用包",
5
5
  "author": "Mr.Cong",
6
6
  "license": "ISC",
@@ -8,7 +8,10 @@
8
8
  "packageManager": "pnpm@7.9.0",
9
9
  "scripts": {
10
10
  "build": "turbo run build",
11
- "build:pkg": "pnpm run prepare -r"
11
+ "build:pkg": "pnpm run prepare -r",
12
+ "push": "node ../scripts/changeVersion.js & turbo run build & npm publish",
13
+ "push2": " node ../scripts/changeVersion.js 2 & turbo run build & npm publish",
14
+ "push1": "node ../scripts/changeVersion.js 1 & turbo run build & npm publish"
12
15
  },
13
16
  "repository": {
14
17
  "type": "git",
@@ -0,0 +1,38 @@
1
+ /*
2
+ * @Author: Mr.Cong Wei
3
+ * @Date: 2022-08-26 15:21:36
4
+ * @LastEditTime: 2022-08-26 15:46:46
5
+ */
6
+ const fs = require("fs");
7
+
8
+ const package = require("../package.json");
9
+ const version = package.version;
10
+
11
+ writeVersion(package, version);
12
+
13
+ function writeVersion(cbDataPackage, wholeVersion) {
14
+ cbDataPackage.version = formatVersion(wholeVersion);
15
+ fs.writeFile(
16
+ "../package.json",
17
+ JSON.stringify(cbDataPackage),
18
+ function (err) {
19
+ if (err) console.error(err);
20
+ console.log(
21
+ "----------------------修改package.json文件完毕,version修改为:",
22
+ cbDataPackage.version
23
+ );
24
+ }
25
+ );
26
+ }
27
+
28
+ function formatVersion(v) {
29
+ const LEVEL_LIST = {
30
+ 3: 2,
31
+ 2: 1,
32
+ 1: 0,
33
+ };
34
+ const level = process.argv[2] ? LEVEL_LIST[process.argv[2]] : 2;
35
+ const versionList = v.split(".");
36
+ versionList[level] = Number(versionList[level]) + 1;
37
+ return versionList.join(".");
38
+ }