@pisell/common 1.0.56 → 1.0.58
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/CHANGELOG.md +6 -431
- package/es/_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js +28 -0
- package/es/_virtual/_@oxc-project_runtime@0.108.0/helpers/defineProperty.js +14 -0
- package/es/_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js +27 -0
- package/es/_virtual/_@oxc-project_runtime@0.108.0/helpers/toPrimitive.js +16 -0
- package/es/_virtual/_@oxc-project_runtime@0.108.0/helpers/toPropertyKey.js +11 -0
- package/es/_virtual/_@oxc-project_runtime@0.108.0/helpers/typeof.js +12 -0
- package/es/bin/pisell.js +5 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- package/es/script/aws/index.js +127 -210
- package/es/script/constants/index.js +84 -63
- package/es/script/deploy.js +33 -44
- package/es/script/index.js +43 -37
- package/es/script/release/index.js +83 -150
- package/es/script/release/release.js +82 -167
- package/es/script/uploadCode/index.js +238 -308
- package/es/script/uploadCode/uploadCode.js +219 -432
- package/es/script/utils/index.js +255 -369
- package/lib/_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js +29 -0
- package/lib/_virtual/_@oxc-project_runtime@0.108.0/helpers/defineProperty.js +14 -0
- package/lib/_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js +27 -0
- package/lib/_virtual/_@oxc-project_runtime@0.108.0/helpers/toPrimitive.js +16 -0
- package/lib/_virtual/_@oxc-project_runtime@0.108.0/helpers/toPropertyKey.js +11 -0
- package/lib/_virtual/_@oxc-project_runtime@0.108.0/helpers/typeof.js +18 -0
- package/lib/_virtual/rolldown_runtime.js +29 -0
- package/lib/bin/pisell.js +4 -24
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -23
- package/lib/script/aws/index.js +139 -124
- package/lib/script/constants/index.js +85 -98
- package/lib/script/deploy.js +34 -55
- package/lib/script/index.js +41 -56
- package/lib/script/release/index.js +90 -108
- package/lib/script/release/release.js +82 -85
- package/lib/script/uploadCode/index.js +244 -223
- package/lib/script/uploadCode/uploadCode.js +222 -219
- package/lib/script/utils/index.js +270 -264
- package/package.json +3 -2
- package/src/bin/pisell.js +1 -1
- package/src/script/constants/index.js +12 -0
- package/src/script/uploadCode/index.js +10 -3
- package/src/script/uploadCode/uploadCode.js +10 -4
- package/src/script/utils/index.js +16 -11
- package/tsdown.config.ts +93 -0
|
@@ -1,102 +1,89 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
1
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
2
|
+
//#region src/script/constants/index.js
|
|
3
|
+
const outPathMap = {
|
|
4
|
+
my_pisel_shop: {
|
|
5
|
+
prod: "../data/release/project/my_pisel_shop",
|
|
6
|
+
release: "../data/release/project/my_pisel_shop",
|
|
7
|
+
pre: "../data/release/project/my_pisel_shop"
|
|
8
|
+
},
|
|
9
|
+
admin: {
|
|
10
|
+
prod: "../data/release/project/pisell_v2",
|
|
11
|
+
release: "../data/release/project/pisell_v2",
|
|
12
|
+
pre: "../data/release/project/pisell_v2"
|
|
13
|
+
},
|
|
14
|
+
my_pisel_pc_v2: {
|
|
15
|
+
prod: "../data/release/project/my_pisel_pc_v2",
|
|
16
|
+
release: "../data/release/project/my_pisel_pc_v2",
|
|
17
|
+
pre: "../data/release/project/my_pisel_pc_v2"
|
|
18
|
+
},
|
|
19
|
+
my_pisel_h5_v2: {
|
|
20
|
+
prod: "../data/release/project/my_pisel_h5_v2",
|
|
21
|
+
release: "../data/release/project/my_pisel_h5_v2",
|
|
22
|
+
pre: "../data/release/project/my_pisel_h5_v2"
|
|
23
|
+
},
|
|
24
|
+
xzero: {
|
|
25
|
+
prod: "../data/release/project/xzero",
|
|
26
|
+
release: "../data/release/project/xzero",
|
|
27
|
+
pre: "../data/release/project/xzero"
|
|
28
|
+
},
|
|
29
|
+
saas_admin: {
|
|
30
|
+
prod: "../data/release/project/saas_admin",
|
|
31
|
+
release: "../data/release/project/saas_admin",
|
|
32
|
+
pre: "../data/release/project/saas_admin"
|
|
33
|
+
},
|
|
34
|
+
saas_shop: {
|
|
35
|
+
prod: "../data/release/project/saas_shop",
|
|
36
|
+
release: "../data/release/project/saas_shop",
|
|
37
|
+
pre: "../data/release/project/saas_shop"
|
|
38
|
+
},
|
|
39
|
+
saas_kds: {
|
|
40
|
+
prod: "../data/release/project/saas_kds",
|
|
41
|
+
release: "../data/release/project/saas_kds",
|
|
42
|
+
pre: "../data/release/project/saas_kds"
|
|
43
|
+
},
|
|
44
|
+
saas_ads: {
|
|
45
|
+
prod: "../data/release/project/saas_ads",
|
|
46
|
+
release: "../data/release/project/saas_ads",
|
|
47
|
+
pre: "../data/release/project/saas_ads"
|
|
48
|
+
},
|
|
49
|
+
saas_home: {
|
|
50
|
+
prod: "../data/release/project/saas_home",
|
|
51
|
+
release: "../data/release/project/saas_home",
|
|
52
|
+
pre: "../data/release/project/saas_home"
|
|
53
|
+
},
|
|
54
|
+
docs: {
|
|
55
|
+
prod: "../data/release/project/docs",
|
|
56
|
+
release: "../data/release/project/docs",
|
|
57
|
+
pre: "../data/release/project/docs"
|
|
58
|
+
},
|
|
59
|
+
saas_shop_pos: {
|
|
60
|
+
prod: "../data/release/project/saas_shop_pos",
|
|
61
|
+
release: "../data/release/project/saas_shop_pos",
|
|
62
|
+
pre: "../data/release/project/saas_shop_pos"
|
|
63
|
+
}
|
|
78
64
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
65
|
+
const isSsrMap = {
|
|
66
|
+
my_pisel_shop: false,
|
|
67
|
+
admin: false,
|
|
68
|
+
my_pisel_pc_v2: true,
|
|
69
|
+
my_pisel_h5_v2: true,
|
|
70
|
+
xzero: false,
|
|
71
|
+
docs: false,
|
|
72
|
+
saas_admin: false,
|
|
73
|
+
saas_shop: false,
|
|
74
|
+
saas_kds: false,
|
|
75
|
+
saas_ads: false,
|
|
76
|
+
saas_shop_pos: false
|
|
89
77
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
const checkPackages = [
|
|
79
|
+
"@pisell/date-picker",
|
|
80
|
+
"@pisell/lowcode-renderer",
|
|
81
|
+
"@pisell/common",
|
|
82
|
+
"@pisell/utils",
|
|
83
|
+
"@pisell/materials"
|
|
96
84
|
];
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
exports.checkPackages = checkPackages;
|
|
88
|
+
exports.isSsrMap = isSsrMap;
|
|
89
|
+
exports.outPathMap = outPathMap;
|
package/lib/script/deploy.js
CHANGED
|
@@ -1,59 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_asyncToGenerator = require('../_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js');
|
|
3
|
+
const require_script_release_index = require('./release/index.js');
|
|
4
|
+
const require_script_uploadCode_index = require('./uploadCode/index.js');
|
|
5
|
+
let inquirer = require("inquirer");
|
|
6
|
+
inquirer = require_rolldown_runtime.__toESM(inquirer);
|
|
28
7
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(deploy_exports);
|
|
35
|
-
var import_inquirer = __toESM(require("inquirer"));
|
|
36
|
-
var import_release = __toESM(require("./release/index.js"));
|
|
37
|
-
var import_uploadCode = __toESM(require("./uploadCode/index.js"));
|
|
38
|
-
var actions = {
|
|
39
|
-
uploadCode: import_uploadCode.default,
|
|
40
|
-
release: import_release.default
|
|
8
|
+
//#region src/script/deploy.js
|
|
9
|
+
const actions = {
|
|
10
|
+
uploadCode: require_script_uploadCode_index,
|
|
11
|
+
release: require_script_release_index
|
|
41
12
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
var deploy = async () => {
|
|
56
|
-
let res = await inquirerResult();
|
|
57
|
-
return actions[res.action]();
|
|
13
|
+
const inquirerResult = () => {
|
|
14
|
+
return inquirer.default.prompt([{
|
|
15
|
+
type: "list",
|
|
16
|
+
message: "请选择功能",
|
|
17
|
+
name: "action",
|
|
18
|
+
choices: [{
|
|
19
|
+
value: "uploadCode",
|
|
20
|
+
name: "上传代码"
|
|
21
|
+
}, {
|
|
22
|
+
value: "release",
|
|
23
|
+
name: "发布代码"
|
|
24
|
+
}]
|
|
25
|
+
}]);
|
|
58
26
|
};
|
|
27
|
+
const deploy = function() {
|
|
28
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
29
|
+
return actions[(yield inquirerResult()).action]();
|
|
30
|
+
});
|
|
31
|
+
return function deploy() {
|
|
32
|
+
return _ref.apply(this, arguments);
|
|
33
|
+
};
|
|
34
|
+
}();
|
|
59
35
|
var deploy_default = deploy;
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
module.exports = deploy_default;
|
package/lib/script/index.js
CHANGED
|
@@ -1,61 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
-
for (let key of __getOwnPropNames(from))
|
|
10
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
}
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_script_utils_index = require('./utils/index.js');
|
|
3
|
+
const require_script_deploy = require('./deploy.js');
|
|
4
|
+
let url = require("url");
|
|
23
5
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
6
|
+
//#region src/script/index.js
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const isVersion = (v) => {
|
|
9
|
+
return [
|
|
10
|
+
"-v",
|
|
11
|
+
"--version",
|
|
12
|
+
"-V"
|
|
13
|
+
].includes(v);
|
|
32
14
|
};
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
const isHelp = (v) => {
|
|
16
|
+
return [
|
|
17
|
+
"-h",
|
|
18
|
+
"--help",
|
|
19
|
+
"-H"
|
|
20
|
+
].includes(v);
|
|
35
21
|
};
|
|
36
|
-
|
|
22
|
+
const __dirname$1 = path.dirname((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
37
23
|
(() => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
console.error(e.stack);
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
24
|
+
try {
|
|
25
|
+
const params = args.slice(1);
|
|
26
|
+
switch (true) {
|
|
27
|
+
case args[0] === "deploy":
|
|
28
|
+
require_script_deploy(...params);
|
|
29
|
+
break;
|
|
30
|
+
case isVersion(args[0]):
|
|
31
|
+
console.log(`@pisell/common@${require_script_utils_index.loadJSON(path.join(__dirname$1, "../../package.json")).version}`);
|
|
32
|
+
break;
|
|
33
|
+
case isHelp(args[0]):
|
|
34
|
+
console.log("pisell -h --help -H [全部命令]");
|
|
35
|
+
console.log("pisell -v --version -V [显示版本]");
|
|
36
|
+
console.log("pisell deploy [上传代码|发布代码]");
|
|
37
|
+
break;
|
|
38
|
+
default: break;
|
|
39
|
+
}
|
|
40
|
+
} catch (e) {
|
|
41
|
+
console.error(e.stack);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
61
44
|
})();
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
@@ -1,114 +1,96 @@
|
|
|
1
1
|
#!/usr/bin/env zx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
3
|
+
const require_asyncToGenerator = require('../../_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js');
|
|
4
|
+
const require_objectSpread2 = require('../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
|
|
5
|
+
const require_script_utils_index = require('../utils/index.js');
|
|
6
|
+
const require_script_release_release = require('./release.js');
|
|
7
|
+
let inquirer = require("inquirer");
|
|
8
|
+
inquirer = require_rolldown_runtime.__toESM(inquirer);
|
|
29
9
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// type: "list",
|
|
43
|
-
// message: "请选择项目",
|
|
44
|
-
// name: "project",
|
|
45
|
-
// choices: [
|
|
46
|
-
// {
|
|
47
|
-
// value: {
|
|
48
|
-
// fileName: "my_pisel_shop",
|
|
49
|
-
// path:"./",
|
|
50
|
-
// },
|
|
51
|
-
// name: "my_pisel_shop"
|
|
52
|
-
// },
|
|
53
|
-
// ],
|
|
54
|
-
// },
|
|
55
|
-
{
|
|
56
|
-
type: "list",
|
|
57
|
-
message: "请选择发布环境",
|
|
58
|
-
name: "env",
|
|
59
|
-
choices: ["release", "pre", "prod"]
|
|
60
|
-
}
|
|
61
|
-
]);
|
|
62
|
-
};
|
|
63
|
-
var inquirerResult = (versionList) => {
|
|
64
|
-
return import_inquirer.default.prompt([
|
|
65
|
-
{
|
|
66
|
-
type: "list",
|
|
67
|
-
message: "请选择发布版本号",
|
|
68
|
-
name: "version",
|
|
69
|
-
default: versionList,
|
|
70
|
-
choices: versionList
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: "confirm",
|
|
74
|
-
message: "确认发布",
|
|
75
|
-
name: "is_release",
|
|
76
|
-
default: true
|
|
77
|
-
}
|
|
78
|
-
]);
|
|
10
|
+
//#region src/script/release/index.js
|
|
11
|
+
const selectProject = () => {
|
|
12
|
+
return inquirer.default.prompt([{
|
|
13
|
+
type: "list",
|
|
14
|
+
message: "请选择发布环境",
|
|
15
|
+
name: "env",
|
|
16
|
+
choices: [
|
|
17
|
+
"release",
|
|
18
|
+
"pre",
|
|
19
|
+
"prod"
|
|
20
|
+
]
|
|
21
|
+
}]);
|
|
79
22
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
23
|
+
/**
|
|
24
|
+
* @Title: 选择器函数
|
|
25
|
+
* @Describe:
|
|
26
|
+
* @Author: Wzw
|
|
27
|
+
*/
|
|
28
|
+
const inquirerResult = (versionList) => {
|
|
29
|
+
return inquirer.default.prompt([{
|
|
30
|
+
type: "list",
|
|
31
|
+
message: "请选择发布版本号",
|
|
32
|
+
name: "version",
|
|
33
|
+
default: versionList,
|
|
34
|
+
choices: versionList
|
|
35
|
+
}, {
|
|
36
|
+
type: "confirm",
|
|
37
|
+
message: "确认发布",
|
|
38
|
+
name: "is_release",
|
|
39
|
+
default: true
|
|
40
|
+
}]);
|
|
95
41
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
42
|
+
const ignoreName = [
|
|
43
|
+
"master",
|
|
44
|
+
".git",
|
|
45
|
+
"pre-master"
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* @Title: 获取所选项目的版本号列表
|
|
49
|
+
* @Describe:
|
|
50
|
+
* @Author: Zsj
|
|
51
|
+
*/
|
|
52
|
+
const getVersionList = function() {
|
|
53
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* ({ env, project }) {
|
|
54
|
+
const config = yield require_script_utils_index.getServerConfig(project.fileName);
|
|
55
|
+
let host = config[env].host;
|
|
56
|
+
if (env === "release") host = config.cn[env].host;
|
|
57
|
+
let projectName = project.fileName;
|
|
58
|
+
if (projectName === "my_pisel_shop" && env === "prod") projectName = "mypisel_shop";
|
|
59
|
+
return require_script_utils_index.versionSort((yield fetch(`http://${host}:3600/version?projectName=${projectName}`).then((res) => res.json())).filter((item) => !ignoreName.includes(item)));
|
|
60
|
+
});
|
|
61
|
+
return function getVersionList(_x) {
|
|
62
|
+
return _ref.apply(this, arguments);
|
|
63
|
+
};
|
|
64
|
+
}();
|
|
65
|
+
function init() {
|
|
66
|
+
return _init.apply(this, arguments);
|
|
67
|
+
}
|
|
68
|
+
function _init() {
|
|
69
|
+
_init = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
70
|
+
/** 选择项目 */
|
|
71
|
+
let projectAndEnv = yield selectProject();
|
|
72
|
+
/** 之前选择项目模式改为获取当前主项目 */
|
|
73
|
+
projectAndEnv.project = {
|
|
74
|
+
path: "./",
|
|
75
|
+
fileName: require_script_utils_index.getCurrentProjectName()
|
|
76
|
+
};
|
|
77
|
+
const releaseInstance = new require_script_release_release(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, yield inquirerResult(yield getVersionList(projectAndEnv))), projectAndEnv));
|
|
78
|
+
try {
|
|
79
|
+
/** 设置连接服务器配置 */
|
|
80
|
+
yield releaseInstance.setConfig();
|
|
81
|
+
/** 连接服务器 */
|
|
82
|
+
yield releaseInstance.connectServer();
|
|
83
|
+
/** 发布 */
|
|
84
|
+
yield releaseInstance.release();
|
|
85
|
+
/** 断开 */
|
|
86
|
+
yield releaseInstance.disconnectServer();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.log(error);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return _init.apply(this, arguments);
|
|
113
92
|
}
|
|
114
93
|
var release_default = init;
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
module.exports = release_default;
|