@pisell/common 1.0.57 → 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 +7 -0
- 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 -69
- 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 -104
- 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 -229
- package/lib/script/uploadCode/uploadCode.js +222 -224
- package/lib/script/utils/index.js +270 -264
- package/package.json +2 -2
- package/src/script/constants/index.js +6 -0
- package/src/script/uploadCode/index.js +1 -0
- package/src/script/uploadCode/uploadCode.js +1 -0
- package/src/script/utils/index.js +3 -1
|
@@ -1,89 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
1
|
+
const require_asyncToGenerator = require('../../_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js');
|
|
2
|
+
const require_script_utils_index = require('../utils/index.js');
|
|
3
|
+
const require_script_constants_index = require('../constants/index.js');
|
|
18
4
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var import_constants = require("../constants/index.js");
|
|
26
|
-
var import_utils = require("../utils/index.js");
|
|
5
|
+
//#region src/script/release/release.js
|
|
6
|
+
/**
|
|
7
|
+
* @Title: 执行发布类
|
|
8
|
+
* @Describe:
|
|
9
|
+
* @Author: Zsj
|
|
10
|
+
*/
|
|
27
11
|
var Release = class {
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
12
|
+
constructor(props) {
|
|
13
|
+
const { project, env, version, conn } = props;
|
|
14
|
+
this.projectName = project.fileName;
|
|
15
|
+
this.env = env;
|
|
16
|
+
this.version = version;
|
|
17
|
+
this.conn = conn;
|
|
18
|
+
this.outPath = require_script_constants_index.outPathMap[this.projectName][this.env];
|
|
19
|
+
this.isSSR = require_script_constants_index.isSsrMap[this.projectName];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @Title: 设置连接服务器配置
|
|
23
|
+
* @Describe:
|
|
24
|
+
* @Author: Zsj
|
|
25
|
+
*/
|
|
26
|
+
setConfig() {
|
|
27
|
+
var _this = this;
|
|
28
|
+
return require_asyncToGenerator._asyncToGenerator(function* () {
|
|
29
|
+
const serverConfigMap = yield require_script_utils_index.getServerConfig(_this.projectName);
|
|
30
|
+
let serverConfig = serverConfigMap[_this.env];
|
|
31
|
+
if (_this.env === "release") serverConfig = serverConfigMap.cn[_this.env];
|
|
32
|
+
if (_this.env === "prod") {
|
|
33
|
+
serverConfig = serverConfigMap.aws.service[_this.env];
|
|
34
|
+
serverConfig.privateKey = fs.readFileSync("../../../pem/pisell-pro.pem");
|
|
35
|
+
}
|
|
36
|
+
_this.serverConfig = serverConfig;
|
|
37
|
+
})();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @Title: 连接服务器
|
|
41
|
+
* @Describe:
|
|
42
|
+
* @Author: Zsj
|
|
43
|
+
*/
|
|
44
|
+
connectServer() {
|
|
45
|
+
var _this2 = this;
|
|
46
|
+
return require_asyncToGenerator._asyncToGenerator(function* () {
|
|
47
|
+
if (!_this2.serverConfig) {
|
|
48
|
+
console.log("未找到发布配置!");
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
_this2.conn = yield require_script_utils_index.connectServer(_this2.serverConfig);
|
|
52
|
+
return _this2.conn;
|
|
53
|
+
})();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @Title: 执行发布操作
|
|
57
|
+
* @Describe:
|
|
58
|
+
* @Author: Zsj
|
|
59
|
+
*/
|
|
60
|
+
release() {
|
|
61
|
+
var _this3 = this;
|
|
62
|
+
return require_asyncToGenerator._asyncToGenerator(function* () {
|
|
63
|
+
return yield require_script_utils_index.releaseProject(_this3.conn, {
|
|
64
|
+
path: _this3.outPath,
|
|
65
|
+
fileName: `${_this3.version}`,
|
|
66
|
+
isSSR: _this3.isSSR,
|
|
67
|
+
env: _this3.env
|
|
68
|
+
});
|
|
69
|
+
})();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @Title: 断开服务连接
|
|
73
|
+
* @Describe:
|
|
74
|
+
* @Author: Zsj
|
|
75
|
+
*/
|
|
76
|
+
disconnectServer() {
|
|
77
|
+
var _this4 = this;
|
|
78
|
+
return require_asyncToGenerator._asyncToGenerator(function* () {
|
|
79
|
+
return yield _this4.conn.end();
|
|
80
|
+
})();
|
|
81
|
+
}
|
|
88
82
|
};
|
|
89
83
|
var release_default = Release;
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
module.exports = release_default;
|
|
@@ -1,234 +1,249 @@
|
|
|
1
1
|
#!/usr/bin/env zx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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_script_utils_index = require('../utils/index.js');
|
|
5
|
+
const require_script_release_release = require('../release/release.js');
|
|
6
|
+
const require_script_aws_index = require('../aws/index.js');
|
|
7
|
+
const require_script_uploadCode_uploadCode = require('./uploadCode.js');
|
|
8
|
+
let inquirer = require("inquirer");
|
|
9
|
+
inquirer = require_rolldown_runtime.__toESM(inquirer);
|
|
10
|
+
require("zx/globals");
|
|
29
11
|
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
type: "confirm",
|
|
97
|
-
message: "确认信息无误",
|
|
98
|
-
name: "is_confirm",
|
|
99
|
-
default: true
|
|
100
|
-
}
|
|
101
|
-
]);
|
|
12
|
+
//#region src/script/uploadCode/index.js
|
|
13
|
+
/**
|
|
14
|
+
* @Title: 选择器函数
|
|
15
|
+
* @Describe:
|
|
16
|
+
* @Author: Wzw
|
|
17
|
+
*/
|
|
18
|
+
const inquirerResult = () => {
|
|
19
|
+
return inquirer.default.prompt([
|
|
20
|
+
{
|
|
21
|
+
type: "list",
|
|
22
|
+
message: "请选择发布环境",
|
|
23
|
+
name: "env",
|
|
24
|
+
choices: [
|
|
25
|
+
"release",
|
|
26
|
+
"pre",
|
|
27
|
+
"prod"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "rawlist",
|
|
32
|
+
message: "请选择当前更新版本号",
|
|
33
|
+
name: "version",
|
|
34
|
+
default: false,
|
|
35
|
+
choices: [
|
|
36
|
+
"patch",
|
|
37
|
+
"minor",
|
|
38
|
+
"major"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: "input",
|
|
43
|
+
message: "请输入更新内容",
|
|
44
|
+
name: "changelog",
|
|
45
|
+
default: "update"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "list",
|
|
49
|
+
message: "上传之后是否执行发布",
|
|
50
|
+
name: "is_release",
|
|
51
|
+
choices: [{
|
|
52
|
+
value: true,
|
|
53
|
+
name: "上传并发布"
|
|
54
|
+
}, {
|
|
55
|
+
value: false,
|
|
56
|
+
name: "只上传"
|
|
57
|
+
}]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: "list",
|
|
61
|
+
message: "是否执行build打包",
|
|
62
|
+
name: "whether_build",
|
|
63
|
+
choices: [{
|
|
64
|
+
value: true,
|
|
65
|
+
name: "执行打包"
|
|
66
|
+
}, {
|
|
67
|
+
value: false,
|
|
68
|
+
name: "不执行打包,使用项目根目录/dist文件夹"
|
|
69
|
+
}]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "confirm",
|
|
73
|
+
message: "确认信息无误",
|
|
74
|
+
name: "is_confirm",
|
|
75
|
+
default: true
|
|
76
|
+
}
|
|
77
|
+
]);
|
|
102
78
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
});
|
|
232
|
-
uploadCode.deleteLocalZip();
|
|
79
|
+
function init() {
|
|
80
|
+
return _init.apply(this, arguments);
|
|
81
|
+
}
|
|
82
|
+
function _init() {
|
|
83
|
+
_init = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
84
|
+
let res = yield inquirerResult();
|
|
85
|
+
if (!res.is_confirm) {
|
|
86
|
+
console.log("取消发布");
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
/** 之前选择项目模式改为获取当前主项目 */
|
|
90
|
+
res.project = {
|
|
91
|
+
path: "./",
|
|
92
|
+
fileName: require_script_utils_index.getCurrentProjectName()
|
|
93
|
+
};
|
|
94
|
+
yield $`git fetch --prune-tags`;
|
|
95
|
+
const uploadCode = new require_script_uploadCode_uploadCode(res);
|
|
96
|
+
if (!(yield uploadCode.check())) return;
|
|
97
|
+
console.log("开始更新版本号");
|
|
98
|
+
const version = yield uploadCode.updateVersion();
|
|
99
|
+
console.log("✅ 版本更新完成");
|
|
100
|
+
const currentUserName = yield require_script_utils_index.getCurrentUserName();
|
|
101
|
+
const result = yield require_script_utils_index.sendWebhook({
|
|
102
|
+
title: `${res.project.fileName} ${res.env}环境开始${res.is_release ? "上传并发布" : "上传"}`,
|
|
103
|
+
content: [
|
|
104
|
+
{
|
|
105
|
+
key: "发布人",
|
|
106
|
+
value: currentUserName.replace("\n", "")
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "更新内容",
|
|
110
|
+
value: res.changelog
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
key: "版本号",
|
|
114
|
+
value: version || ""
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
});
|
|
118
|
+
console.log(result, "result");
|
|
119
|
+
try {
|
|
120
|
+
if (res.whether_build) {
|
|
121
|
+
console.log("开始打包");
|
|
122
|
+
yield uploadCode.build();
|
|
123
|
+
console.log("✅ 打包完成");
|
|
124
|
+
} else console.log("使用本地/dist");
|
|
125
|
+
if (res.env === "prod") {
|
|
126
|
+
let _fileName = res.project.fileName;
|
|
127
|
+
if (res.env === "pre") _fileName = "pre_" + _fileName;
|
|
128
|
+
if (_fileName === "admin") _fileName = "my_pisell_v2";
|
|
129
|
+
if (![
|
|
130
|
+
"xzero",
|
|
131
|
+
"docs",
|
|
132
|
+
"saas_admin",
|
|
133
|
+
"saas_shop",
|
|
134
|
+
"saas_shop_pos",
|
|
135
|
+
"saas_kds",
|
|
136
|
+
"saas_ads",
|
|
137
|
+
"saas_home"
|
|
138
|
+
].includes(_fileName)) yield require_script_aws_index.uploadStaticToOSS(_fileName);
|
|
139
|
+
}
|
|
140
|
+
console.log("开始压缩");
|
|
141
|
+
yield uploadCode.compress();
|
|
142
|
+
console.log("✅ 压缩完成");
|
|
143
|
+
console.log("开始连接服务器");
|
|
144
|
+
const conn = yield uploadCode.connectServer();
|
|
145
|
+
console.log("✅ 连接服务器完成");
|
|
146
|
+
console.log("开始上传");
|
|
147
|
+
yield uploadCode.serverUpload();
|
|
148
|
+
console.log("✅ 上传完成");
|
|
149
|
+
console.log("开始解压");
|
|
150
|
+
yield uploadCode.serverUnpack();
|
|
151
|
+
if (res.is_release) {
|
|
152
|
+
const releaseInstance = new require_script_release_release({
|
|
153
|
+
project: res.project,
|
|
154
|
+
env: res.env,
|
|
155
|
+
version,
|
|
156
|
+
conn
|
|
157
|
+
});
|
|
158
|
+
console.log("开始发布");
|
|
159
|
+
yield releaseInstance.release();
|
|
160
|
+
}
|
|
161
|
+
yield uploadCode.disconnectServer();
|
|
162
|
+
yield $`git pull --no-edit`;
|
|
163
|
+
yield $`git push --follow-tags`;
|
|
164
|
+
console.log("✅ 成功后推送到git");
|
|
165
|
+
} catch (error) {
|
|
166
|
+
console.log(error, "执行出错 请排查重试");
|
|
167
|
+
yield $`git reset HEAD~1`;
|
|
168
|
+
yield $`git tag -d v${uploadCode.currentVersion}`;
|
|
169
|
+
yield require_script_utils_index.sendWebhook({
|
|
170
|
+
title: `${res.project.fileName} ${res.env}环境${res.is_release ? "上传并发布" : "上传"}失败`,
|
|
171
|
+
content: [
|
|
172
|
+
{
|
|
173
|
+
key: "发布人",
|
|
174
|
+
value: currentUserName.replace("\n", "")
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
key: "更新内容",
|
|
178
|
+
value: res.changelog
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
key: "版本号",
|
|
182
|
+
value: version || ""
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
yield require_script_utils_index.sendWebhook({
|
|
188
|
+
title: `${res.project.fileName} ${res.env}环境${res.is_release ? "上传并发布" : "上传"}成功`,
|
|
189
|
+
content: [
|
|
190
|
+
{
|
|
191
|
+
key: "发布人",
|
|
192
|
+
value: currentUserName.replace("\n", "")
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
key: "更新内容",
|
|
196
|
+
value: res.changelog
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
key: "版本号",
|
|
200
|
+
value: version || ""
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
});
|
|
204
|
+
uploadCode.deleteLocalZip();
|
|
205
|
+
});
|
|
206
|
+
return _init.apply(this, arguments);
|
|
233
207
|
}
|
|
234
208
|
var uploadCode_default = init;
|
|
209
|
+
/**
|
|
210
|
+
*
|
|
211
|
+
* 上传
|
|
212
|
+
* 1. 选择项目 环境等.
|
|
213
|
+
* 2. 打包
|
|
214
|
+
* 3. 打包完成后生成dist文件压缩包
|
|
215
|
+
* 4. 重命名为当前版本号
|
|
216
|
+
* 5. 上传到服务器,并解压. 上传完成
|
|
217
|
+
*
|
|
218
|
+
*
|
|
219
|
+
*
|
|
220
|
+
* 服务器目录结构:
|
|
221
|
+
*
|
|
222
|
+
* project: 所有前端项目
|
|
223
|
+
*
|
|
224
|
+
* my_pisel_h5: 某个项目文件夹
|
|
225
|
+
*
|
|
226
|
+
* master: 当前线上环境指向的代码包
|
|
227
|
+
*
|
|
228
|
+
* v1.0.0: 某个版本
|
|
229
|
+
*
|
|
230
|
+
*
|
|
231
|
+
* 部署, 此部分可界面化.
|
|
232
|
+
* 1. 将master备份, 把对应版本的代码合并到master内.
|
|
233
|
+
* 2. 重启当前服务
|
|
234
|
+
*
|
|
235
|
+
*
|
|
236
|
+
* 回滚指定版本
|
|
237
|
+
*
|
|
238
|
+
* 1. 将master内文件清空并将某个版本的包解压到master内
|
|
239
|
+
* 2. 重启服务
|
|
240
|
+
*
|
|
241
|
+
* node端需要提供以下接口
|
|
242
|
+
*
|
|
243
|
+
* 1. 获取每个项目的所有版本包名称.
|
|
244
|
+
* 2. 通过 项目 + 版本包名称 将对应的包更新至maser 实现发布
|
|
245
|
+
* 3. 将操作记录写成日志存储.
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
//#endregion
|
|
249
|
+
module.exports = uploadCode_default;
|