cloudcc-cli 0.9.5 → 0.9.8

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/README.md CHANGED
@@ -1,3 +1,25 @@
1
+ # ReleaseV0.9.8
2
+ #### 发布日期:2022-3-3
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 优化
6
+ * 删除不必要打印信息
7
+ * 兼容vue@cli5.0
8
+
9
+ # ReleaseV0.9.7
10
+ #### 发布日期:2022-2-15
11
+ #### 发布范围:全量
12
+ #### 发布内容
13
+ * 优化
14
+ * 发布项目,使用服务器功能
15
+
16
+ # ReleaseV0.9.6
17
+ #### 发布日期:2022-2-14
18
+ #### 发布范围:全量
19
+ #### 发布内容
20
+ * 优化
21
+ * 还原builderPlugin
22
+
1
23
  # ReleaseV0.9.5
2
24
  #### 发布日期:2022-2-10
3
25
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "0.9.5",
3
+ "version": "0.9.8",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -87,23 +87,19 @@ class Builder {
87
87
  */
88
88
  getVueValue(buildFileName) {
89
89
  let vueContent = fs.readFileSync(this.getVueContent(buildFileName), 'utf8');
90
-
91
- // 获取componentInfo
92
- let reg = /componentInfo([\s\S]*?)\}/;
93
- let componentInfo = vueContent.match(reg)[1].split("{")[1];
94
- componentInfo = eval(`(${"function getInfo() { return {" + componentInfo + " } }"})`)()
95
- // 组件名字
96
- let compName = componentInfo.component
97
- // 组件类型
98
- let bizType = componentInfo.bizType
99
- // 组件描述
100
- let compDesc = componentInfo.compDesc
101
- // 组件状态
102
- let category = componentInfo.category
103
-
104
- // 获取vueDate内容
105
- let vueData = vueContent.split("data()")[1].split("return")[1].split("isLock:")[0] + "isLock:false,}";
106
-
90
+ let vueData = vueContent + ""
91
+ // 去除空格
92
+ // vueData = vueData.replace(/\ +/g, "")
93
+ // 去除换行
94
+ // vueData =vueData.replace(/[\r\n]/g, "");
95
+ vueData = vueData.split("data()")[1].split("isLock:")[0] + "isLock:false,};}";
96
+ vueData = "function data()" + vueData;
97
+ const data = eval(`(${vueData})`)()
98
+ let compName = data.componentInfo.component // 组件名字
99
+ vueData = JSON.stringify(data);
100
+ let bizType = data.componentInfo.bizType // 组件类型
101
+ let compDesc = data.componentInfo.compDesc // 组件描述
102
+ let category = data.componentInfo.category // 组件状态
107
103
  return { compName, vueContent, vueData, bizType, compDesc, category }
108
104
  };
109
105
  /**
@@ -129,7 +125,7 @@ class Builder {
129
125
  */
130
126
  build(obj) {
131
127
  console.log(chalk.green('编译中,请稍后...'));
132
- let { stdout, stderr, error } = execSync('vue build -t lib -n ' + obj.compName + ' -d build plugin/plugin.js');
128
+ let { stdout, stderr, error } = execSync('npx vue-cli-service build --target lib --name ' + obj.compName + ' --dest build plugin/plugin.js');
133
129
  if (null == error) {
134
130
  console.log(chalk.green('编译成功!'));
135
131
  } else {
@@ -147,6 +143,7 @@ class Builder {
147
143
  jsContent = fs.readFileSync(this.filterFile()[0], 'utf8')
148
144
  } catch (err) {
149
145
  console.error(err)
146
+ return;
150
147
  }
151
148
  let body = {
152
149
  "compUniName": obj.compName,
@@ -69,7 +69,7 @@ class Creator {
69
69
  console.log();
70
70
  console.log(chalk.green('构建完成'));
71
71
  console.log();
72
- console.log(chalk.green(`运行项目: cd ${this.options.name} && npm install`));
72
+ console.log(chalk.green(`运行项目: \n 1:cd ${this.options.name} \n 2:code . \n 3:npm install`));
73
73
  })
74
74
  }
75
75
 
@@ -15,7 +15,7 @@ const { getNewVersionName, pushCodeAndTags } = require("../utils/pushCode")
15
15
  // 触发构建器
16
16
  const { jenkins } = require("../utils/trigger")
17
17
  // 通知飞书
18
- const { notifyFeishu } = require("../utils/NotifyIM")
18
+ const { notifyFeishu } = require("../utils/notifyIM")
19
19
  // 时间库
20
20
  const dayjs = require("dayjs")
21
21
  /**
@@ -23,6 +23,16 @@ const dayjs = require("dayjs")
23
23
  */
24
24
  class Publish {
25
25
  constructor() {
26
+ /**
27
+ * 控制台参数
28
+ * type:发布类型
29
+ * branch:使用的分支
30
+ */
31
+ this.args = new Map();
32
+ this.arguments = process.argv.splice(2).map((item) => {
33
+ let arr = item.split("=");
34
+ this.args.set(arr[0].split("-")[1], arr[1]);
35
+ });
26
36
  }
27
37
  /**
28
38
  * 初始化
@@ -30,13 +40,29 @@ class Publish {
30
40
  async init() {
31
41
  let res = await checkUpdate();
32
42
  if (!res) {
33
- // 询问发布类型
34
- let condition = await askType();
43
+ let condition = {};
44
+ // 检查参数是否存在发布类型
45
+ if (this.args.get("type")) {
46
+ condition.type = this.args.get("type")
47
+ } else {
48
+ // 询问发布类型
49
+ condition = await askType();
50
+ }
51
+
52
+ // 如果存在分支,则切换分支
53
+ if (this.args.get("branch")) {
54
+ exec(`git checkout ${this.args.get("branch")}`);
55
+ console.log(chalk.green("切换分支:" + this.args.get("branch")))
56
+ console.log()
57
+ }
58
+
35
59
  // 获得version
36
60
  let version = getNewVersionName([condition.type])
37
61
  console.log();
38
62
  console.log(chalk.green('待发布版本:' + version));
39
63
  console.log();
64
+
65
+ // 开始打包
40
66
  if (await this.build()) {
41
67
  // 将readme生成为html,并复制到dist中
42
68
  let outPath = "dist"
package/template/indexvue CHANGED
@@ -40,7 +40,7 @@ export default {
40
40
  * private:私有组件(自己组织可见)
41
41
  * beta:组件测试版本
42
42
  */
43
- category: "public", // public private
43
+ category: "private",
44
44
  },
45
45
  style: {
46
46
  unit: "px",
package/utils/pushCode.js CHANGED
@@ -21,14 +21,11 @@ function getNewVersionName(types) {
21
21
  version = versions.find((item) => {
22
22
  return item.includes("-V");
23
23
  })
24
- console.log("version 1", version);
25
24
  if (version) {
26
25
  // 取版本号
27
26
  version = version.split("-V")[1]
28
- console.log("version 2", version);
29
27
  // 改变版本号
30
28
  version = changeVersion.change(version, item)
31
- console.log("version 3", version);
32
29
  // 生成最后的版本号
33
30
  item = item + "-V" + version
34
31
  } else {