cloudcc-cli 1.0.9 → 1.1.2

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.
@@ -1,52 +1,52 @@
1
- {
2
- "name": "cloudcc-plugin",
3
- "version": "1.0.0",
4
- "description": "cloudcc-plugin-dev",
5
- "devConsoleConfig": {
6
- "baseUrl": "http://xxx", //组件提交地址
7
- "username": "xxx",// 用户名
8
- "secretKey": "xxx",// 通过用户名,访问接口获得
9
- },
10
- "scripts": {
11
- "serve": "vue-cli-service serve",
12
- "build-plugin": "cloudccBuild"
13
- },
14
- "dependencies": {
15
- "axios": "^0.21.1",
16
- "core-js": "^3.6.5",
17
- "vue": "^2.6.11",
18
- "vue-cookies": "^1.7.4",
19
- "vue-custom-element": "^3.3.0"
20
- },
21
- "devDependencies": {
22
- "@vue/cli-plugin-babel": "~4.5.0",
23
- "@vue/cli-plugin-eslint": "~4.5.0",
24
- "@vue/cli-service": "~4.5.0",
25
- "babel-eslint": "^10.1.0",
26
- "element-ui": "^2.15.2",
27
- "eslint": "^6.7.2",
28
- "eslint-plugin-vue": "^6.2.2",
29
- "vue-template-compiler": "^2.6.11",
30
- "sass": "1.26.8",
31
- "sass-loader": "8.0.2"
32
- },
33
- "eslintConfig": {
34
- "root": true,
35
- "env": {
36
- "node": true
37
- },
38
- "extends": [
39
- "plugin:vue/essential",
40
- "eslint:recommended"
41
- ],
42
- "parserOptions": {
43
- "parser": "babel-eslint"
44
- },
45
- "rules": {}
46
- },
47
- "browserslist": [
48
- "> 1%",
49
- "last 2 versions",
50
- "not dead"
51
- ]
52
- }
1
+ {
2
+ "name": "cloudcc-plugin",
3
+ "version": "1.0.0",
4
+ "description": "cloudcc-plugin-dev",
5
+ "devConsoleConfig": {
6
+ "baseUrl": "http://xxx", //组件提交地址
7
+ "username": "xxx",// 用户名
8
+ "secretKey": "xxx",// 通过用户名,访问接口获得
9
+ },
10
+ "scripts": {
11
+ "serve": "vue-cli-service serve",
12
+ "build-plugin": "cloudccBuild"
13
+ },
14
+ "dependencies": {
15
+ "axios": "^0.21.1",
16
+ "core-js": "^3.6.5",
17
+ "vue": "^2.6.11",
18
+ "vue-cookies": "^1.7.4",
19
+ "vue-custom-element": "^3.3.0"
20
+ },
21
+ "devDependencies": {
22
+ "@vue/cli-plugin-babel": "~4.5.0",
23
+ "@vue/cli-plugin-eslint": "~4.5.0",
24
+ "@vue/cli-service": "~4.5.0",
25
+ "babel-eslint": "^10.1.0",
26
+ "element-ui": "^2.15.2",
27
+ "eslint": "^6.7.2",
28
+ "eslint-plugin-vue": "^6.2.2",
29
+ "vue-template-compiler": "^2.6.11",
30
+ "sass": "1.26.8",
31
+ "sass-loader": "8.0.2"
32
+ },
33
+ "eslintConfig": {
34
+ "root": true,
35
+ "env": {
36
+ "node": true
37
+ },
38
+ "extends": [
39
+ "plugin:vue/essential",
40
+ "eslint:recommended"
41
+ ],
42
+ "parserOptions": {
43
+ "parser": "babel-eslint"
44
+ },
45
+ "rules": {}
46
+ },
47
+ "browserslist": [
48
+ "> 1%",
49
+ "last 2 versions",
50
+ "not dead"
51
+ ]
52
+ }
@@ -1,7 +1,7 @@
1
- module.exports = {
2
- publicPath: '/',
3
- productionSourceMap: false,//关闭生成Map文件
4
- configureWebpack: {
5
- },
6
- css: { extract: false },//css强制内联在js中
1
+ module.exports = {
2
+ publicPath: '/',
3
+ productionSourceMap: false,//关闭生成Map文件
4
+ configureWebpack: {
5
+ },
6
+ css: { extract: false },//css强制内联在js中
7
7
  }
package/test/index.html CHANGED
@@ -1,15 +1,15 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
- <title>开发日志</title>
9
- </head>
10
-
11
- <body>
12
-
13
- </body>
14
-
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <title>开发日志</title>
9
+ </head>
10
+
11
+ <body>
12
+
13
+ </body>
14
+
15
15
  </html>
package/test/test.js CHANGED
@@ -1,6 +1,6 @@
1
- let versions = ["A-V", "bbbb-V", "B", "C", "D"]
2
- let version;
3
- version = versions.find((item) => {
4
- return item.includes("-V");
5
- })
1
+ let versions = ["A-V", "bbbb-V", "B", "C", "D"]
2
+ let version;
3
+ version = versions.find((item) => {
4
+ return item.includes("-V");
5
+ })
6
6
  console.log(version);
package/utils/askTool.js CHANGED
@@ -1,64 +1,64 @@
1
- // 同步执行exe命令
2
- const exec = require('child_process').execSync;
3
- // 文件管理器
4
- const fs = require('fs');
5
- // 配置信息
6
- const projectConfig = JSON.parse(fs.readFileSync('package.json', 'utf8'))
7
- // 常用控制台交互
8
- const inquirer = require("inquirer")
9
-
10
- let choices = [
11
- { name: "客户环境-Release", value: "Release" },
12
- { name: "客户环境-Release-99", value: "Release-99" },
13
- { name: "公司环境-GA", value: "GA" },
14
- { name: "预生产环境-RC", value: "RC" },
15
- { name: "预生产环境-RC-99", value: "RC-99" },
16
- { name: "uat环境-Beta", value: "Beta" },
17
- { name: "研发联调环境-Dev", value: "Dev" }
18
- ]
19
-
20
- module.exports = {
21
- /**
22
- * 请求版本信息
23
- * @returns 结果
24
- */
25
- askType: () => {
26
- // 如果存在配置,那么从配置中读取
27
- if (projectConfig && projectConfig.config) {
28
- let branch = exec('git rev-parse --abbrev-ref HEAD');
29
- branch = branch.toString("utf8").trim();
30
- choices = projectConfig.config["branch-" + branch]
31
- if (choices) {
32
- choices.push({ name: "其他", value: "other" })
33
- }else{
34
- choices = projectConfig.config["branch-other"]
35
- }
36
- }
37
- const prompt = [{
38
- type: 'list',
39
- message: '请选择发布版本:',
40
- name: 'type',
41
- choices: choices,
42
- }
43
- ];
44
- return inquirer.prompt(prompt)
45
- },
46
- /**
47
- * 请求版本信息
48
- * @returns 结果
49
- */
50
- askTypeOther: () => {
51
- // 如果存在配置,那么从配置中读取
52
- if (projectConfig && projectConfig.config) {
53
- choices = projectConfig.config["branch-other"]
54
- }
55
- const prompt = [{
56
- type: 'list',
57
- message: '请选择发布版本:',
58
- name: 'type',
59
- choices: choices,
60
- }
61
- ];
62
- return inquirer.prompt(prompt)
63
- }
1
+ // 同步执行exe命令
2
+ const exec = require('child_process').execSync;
3
+ // 文件管理器
4
+ const fs = require('fs');
5
+ // 配置信息
6
+ const projectConfig = JSON.parse(fs.readFileSync('package.json', 'utf8'))
7
+ // 常用控制台交互
8
+ const inquirer = require("inquirer")
9
+
10
+ let choices = [
11
+ { name: "客户环境-Release", value: "Release" },
12
+ { name: "客户环境-Release-99", value: "Release-99" },
13
+ { name: "公司环境-GA", value: "GA" },
14
+ { name: "预生产环境-RC", value: "RC" },
15
+ { name: "预生产环境-RC-99", value: "RC-99" },
16
+ { name: "uat环境-Beta", value: "Beta" },
17
+ { name: "研发联调环境-Dev", value: "Dev" }
18
+ ]
19
+
20
+ module.exports = {
21
+ /**
22
+ * 请求版本信息
23
+ * @returns 结果
24
+ */
25
+ askType: () => {
26
+ // 如果存在配置,那么从配置中读取
27
+ if (projectConfig && projectConfig.config) {
28
+ let branch = exec('git rev-parse --abbrev-ref HEAD');
29
+ branch = branch.toString("utf8").trim();
30
+ choices = projectConfig.config["branch-" + branch]
31
+ if (choices) {
32
+ choices.push({ name: "其他", value: "other" })
33
+ }else{
34
+ choices = projectConfig.config["branch-other"]
35
+ }
36
+ }
37
+ const prompt = [{
38
+ type: 'list',
39
+ message: '请选择发布版本:',
40
+ name: 'type',
41
+ choices: choices,
42
+ }
43
+ ];
44
+ return inquirer.prompt(prompt)
45
+ },
46
+ /**
47
+ * 请求版本信息
48
+ * @returns 结果
49
+ */
50
+ askTypeOther: () => {
51
+ // 如果存在配置,那么从配置中读取
52
+ if (projectConfig && projectConfig.config) {
53
+ choices = projectConfig.config["branch-other"]
54
+ }
55
+ const prompt = [{
56
+ type: 'list',
57
+ message: '请选择发布版本:',
58
+ name: 'type',
59
+ choices: choices,
60
+ }
61
+ ];
62
+ return inquirer.prompt(prompt)
63
+ }
64
64
  }
@@ -1,75 +1,75 @@
1
-
2
- function change(ori) {
3
- //   let ori = "12.0.9";
4
- let split = ori.split(".");
5
- let ret = "";
6
- if (split.length == 4) {
7
- // 12.1.0.0 形式的
8
- for (let i = 0; i < split.length; i++) {
9
- let last = split[3];
10
- if (last < 9999) {
11
- last++;
12
- ret = split[0] + "." + split[1] + "." + split[2] + "." + last;
13
- break;
14
- } else {
15
- let second = split[2];
16
- if (second < 9) {
17
- second++;
18
- ret = split[0] + "." + split[1] + "." + second + ".0";
19
- break;
20
- } else {
21
- let third = split[1];
22
- if (third < 9) {
23
- third++;
24
- ret = split[0] + "." + third + ".0" + ".0";
25
- break;
26
- } else {
27
- let forth = split[0];
28
- forth++;
29
- ret = forth + ".0.0.0";
30
- break;
31
- }
32
- }
33
- }
34
- }
35
- return ret;
36
- } else {
37
- // 12.0.9 形式的
38
- for (let i = 0; i < split.length; i++) {
39
- let last = split[2];
40
- if (last < 9) {
41
- last++;
42
- ret = split[0] + "." + split[1] + "." + last;
43
- break;
44
- } else {
45
- let second = split[1];
46
- if (second < 9) {
47
- second++;
48
- ret = split[0] + "." + second + ".0";
49
- break;
50
- } else {
51
- let third = split[0];
52
- third++;
53
- ret = third + ".0.0";
54
- break;
55
- }
56
- }
57
- }
58
- return ret;
59
- }
60
- }
61
- module.exports = { change }
62
-
63
-
64
-
65
- /**
66
- * 修改版本号
67
- * @param {ori} 版本号
68
- * @param {type} 类型:Dev,uat,GA,Release
69
- * @returns 新的版本号
70
- */
71
- // 需要更新第二位
72
- const updateSecond = ["Release"];
73
-
74
- // 需要更新第三位
1
+
2
+ function change(ori) {
3
+ //   let ori = "12.0.9";
4
+ let split = ori.split(".");
5
+ let ret = "";
6
+ if (split.length == 4) {
7
+ // 12.1.0.0 形式的
8
+ for (let i = 0; i < split.length; i++) {
9
+ let last = split[3];
10
+ if (last < 9999) {
11
+ last++;
12
+ ret = split[0] + "." + split[1] + "." + split[2] + "." + last;
13
+ break;
14
+ } else {
15
+ let second = split[2];
16
+ if (second < 9) {
17
+ second++;
18
+ ret = split[0] + "." + split[1] + "." + second + ".0";
19
+ break;
20
+ } else {
21
+ let third = split[1];
22
+ if (third < 9) {
23
+ third++;
24
+ ret = split[0] + "." + third + ".0" + ".0";
25
+ break;
26
+ } else {
27
+ let forth = split[0];
28
+ forth++;
29
+ ret = forth + ".0.0.0";
30
+ break;
31
+ }
32
+ }
33
+ }
34
+ }
35
+ return ret;
36
+ } else {
37
+ // 12.0.9 形式的
38
+ for (let i = 0; i < split.length; i++) {
39
+ let last = split[2];
40
+ if (last < 9) {
41
+ last++;
42
+ ret = split[0] + "." + split[1] + "." + last;
43
+ break;
44
+ } else {
45
+ let second = split[1];
46
+ if (second < 9) {
47
+ second++;
48
+ ret = split[0] + "." + second + ".0";
49
+ break;
50
+ } else {
51
+ let third = split[0];
52
+ third++;
53
+ ret = third + ".0.0";
54
+ break;
55
+ }
56
+ }
57
+ }
58
+ return ret;
59
+ }
60
+ }
61
+ module.exports = { change }
62
+
63
+
64
+
65
+ /**
66
+ * 修改版本号
67
+ * @param {ori} 版本号
68
+ * @param {type} 类型:Dev,uat,GA,Release
69
+ * @returns 新的版本号
70
+ */
71
+ // 需要更新第二位
72
+ const updateSecond = ["Release"];
73
+
74
+ // 需要更新第三位
75
75
  const updateLast = ["Dev", "uat", "GA", "RC"];
@@ -1,27 +1,27 @@
1
- /**
2
- * 修改版本号
3
- * @param {ori} 版本号:12.0.123
4
- * @param {type} 类型:Dev,uat,GA,Release
5
- * @returns 新的版本号
6
- */
7
- // 需要更新第二位
8
- const updateSecond = ["Release"];
9
-
10
- // 需要更新第三位
11
- const updateLast = ["Dev", "Beta", "GA", "RC", "RC-99", "Release-99"];
12
-
13
- function change(version, type) {
14
- if (version) {
15
- let split = version.split(".");
16
- let ret = "";
17
- if (split && split.length === 3) {
18
- if (updateSecond.includes(type)) {
19
- ret = split[0] + "." + (++split[1]) + "." + split[2];
20
- } else if (updateLast.includes(type)) {
21
- ret = split[0] + "." + split[1] + "." + (++split[2]);
22
- }
23
- }
24
- return ret;
25
- }
26
- }
1
+ /**
2
+ * 修改版本号
3
+ * @param {ori} 版本号:12.0.123
4
+ * @param {type} 类型:Dev,uat,GA,Release
5
+ * @returns 新的版本号
6
+ */
7
+ // 需要更新第二位
8
+ const updateSecond = ["Release"];
9
+
10
+ // 需要更新第三位
11
+ const updateLast = ["Dev", "Beta", "GA", "RC", "RC-99", "Release-99"];
12
+
13
+ function change(version, type) {
14
+ if (version) {
15
+ let split = version.split(".");
16
+ let ret = "";
17
+ if (split && split.length === 3) {
18
+ if (updateSecond.includes(type)) {
19
+ ret = split[0] + "." + (++split[1]) + "." + split[2];
20
+ } else if (updateLast.includes(type)) {
21
+ ret = split[0] + "." + split[1] + "." + (++split[2]);
22
+ }
23
+ }
24
+ return ret;
25
+ }
26
+ }
27
27
  module.exports = { change }
@@ -1,74 +1,79 @@
1
- // 导入cli配置文件
2
- const config = require("../package.json")
3
- const inquirer = require("inquirer")
4
- const exec = require('child_process').execSync;
5
- const chalk = require("chalk")
6
- /**
7
- * 检查版本号
8
- */
9
- function checkNpmVersion() {
10
- let currentVersion = Number(config.version.replace(/\./g, ""));
11
- let onlineVersion = exec(`npm view cloudcc-cli version --registry http://registry.npmjs.org`)
12
- onlineVersion = onlineVersion.toString("utf8").trim();
13
- let onlineVersionNum = Number(onlineVersion.replace(/\./g, ""))
14
- // 如果结果大于0,那么提示升级
15
- if (onlineVersionNum - currentVersion > 0) {
16
- console.log();
17
- console.log(chalk.green("Cloudcc-cli发现新版本!"));
18
- console.log();
19
- console.log(chalk.green("当前版本:v" + config.version));
20
- console.log(chalk.green("最新版本:v" + onlineVersion));
21
- console.log();
22
- console.log(chalk.yellow(`如无法自动更新,请使用命令更新:npm install -g cloudcc-cli@${onlineVersion} --registry https://registry.npmjs.org`));
23
- return onlineVersion;
24
- }
25
- return null;
26
- }
27
-
28
- /**
29
- * 是否升级
30
- * @returns 对象
31
- */
32
- function askUpdate() {
33
- console.log();
34
- const prompt = [{
35
- type: 'list',
36
- message: '是否进行自动升级?',
37
- name: 'update',
38
- choices: [
39
- "Yes", 'No'
40
- ],
41
- }];
42
- return inquirer.prompt(prompt)
43
- }
44
-
45
- /**
46
- * 升级cli
47
- */
48
- function update(onlineVersion) {
49
- console.log()
50
- console.log(chalk.green("升级中,请稍后..."));
51
- exec(`npm install -g cloudcc-cli@${onlineVersion} --registry https://registry.npmjs.org`)
52
- console.log()
53
- console.log(chalk.green("升级完成!请重新运行"));
54
- }
55
-
56
- /**
57
- * 检查更新
58
- */
59
- async function checkUpdate() {
60
- let onlineVersion = checkNpmVersion();
61
- if (onlineVersion) {
62
- let res = await askUpdate()
63
- if ("Yes" == res.update) {
64
- update(onlineVersion)
65
- return true;
66
- } else {
67
- return false
68
- }
69
- }
70
- return false
71
- }
72
-
73
-
74
- module.exports = { checkUpdate }
1
+ // 导入cli配置文件
2
+ const config = require("../package.json")
3
+ const inquirer = require("inquirer")
4
+ const exec = require('child_process').execSync;
5
+ const chalk = require("chalk")
6
+ /**
7
+ * 检查版本号
8
+ */
9
+ function checkNpmVersion() {
10
+ let currentVersion = Number(config.version.replace(/\./g, ""));
11
+ let onlineVersion = exec(`npm view cloudcc-cli version --registry http://registry.npmjs.org`)
12
+ onlineVersion = onlineVersion.toString("utf8").trim();
13
+ let onlineVersionNum = Number(onlineVersion.replace(/\./g, ""))
14
+ // 如果结果大于0,那么提示升级
15
+ if (onlineVersionNum - currentVersion > 0) {
16
+ console.log();
17
+ console.log(chalk.green("Cloudcc-cli发现新版本!"));
18
+ console.log();
19
+ console.log(chalk.green("当前版本:v" + config.version));
20
+ console.log(chalk.green("最新版本:v" + onlineVersion));
21
+ console.log();
22
+ console.log(chalk.yellow(`如无法自动更新,请使用命令更新:npm install -g cloudcc-cli@${onlineVersion} --registry https://registry.npmjs.org`));
23
+ return onlineVersion;
24
+ }
25
+ return null;
26
+ }
27
+
28
+ /**
29
+ * 是否升级
30
+ * @returns 对象
31
+ */
32
+ function askUpdate() {
33
+ console.log();
34
+ const prompt = [{
35
+ type: 'list',
36
+ message: '是否进行自动升级?',
37
+ name: 'update',
38
+ choices: [
39
+ "Yes", 'No'
40
+ ],
41
+ }];
42
+ return inquirer.prompt(prompt)
43
+ }
44
+
45
+ /**
46
+ * 升级cli
47
+ */
48
+ function update(onlineVersion) {
49
+ console.log()
50
+ console.log(chalk.green("升级中,请稍后..."));
51
+ exec(`npm install -g cloudcc-cli@${onlineVersion} --registry https://registry.npmjs.org`)
52
+ console.log()
53
+ console.log(chalk.green("升级完成!请重新运行"));
54
+ }
55
+
56
+ /**
57
+ * 检查更新
58
+ */
59
+ async function checkUpdate() {
60
+ let onlineVersion;
61
+ try {
62
+ onlineVersion = checkNpmVersion();
63
+ } catch (error) {
64
+ onlineVersion = false;
65
+ }
66
+ if (onlineVersion) {
67
+ let res = await askUpdate()
68
+ if ("Yes" == res.update) {
69
+ update(onlineVersion)
70
+ return true;
71
+ } else {
72
+ return false
73
+ }
74
+ }
75
+ return false
76
+ }
77
+
78
+
79
+ module.exports = { checkUpdate }