@pisell/common 3.0.1 → 3.0.3
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 +12 -0
- package/es/script/uploadCode/index.js +37 -34
- package/es/script/uploadCode/uploadCode.js +10 -5
- package/lib/script/uploadCode/index.js +3 -1
- package/lib/script/uploadCode/uploadCode.js +4 -0
- package/package.json +1 -1
- package/src/script/uploadCode/index.js +4 -2
- package/src/script/uploadCode/uploadCode.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -163,7 +163,7 @@ function _init() {
|
|
|
163
163
|
console.log('使用本地/dist');
|
|
164
164
|
case 35:
|
|
165
165
|
if (!(res.env === 'prod')) {
|
|
166
|
-
_context.next =
|
|
166
|
+
_context.next = 42;
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
_fileName = res.project.fileName;
|
|
@@ -173,32 +173,35 @@ function _init() {
|
|
|
173
173
|
if (_fileName === 'admin') {
|
|
174
174
|
_fileName = 'my_pisell_v2';
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
if (!(_fileName !== 'xzero')) {
|
|
177
|
+
_context.next = 42;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
_context.next = 42;
|
|
178
181
|
return uploadStaticToOSS(_fileName);
|
|
179
|
-
case
|
|
182
|
+
case 42:
|
|
180
183
|
console.log('开始压缩');
|
|
181
|
-
_context.next =
|
|
184
|
+
_context.next = 45;
|
|
182
185
|
return uploadCode.compress();
|
|
183
|
-
case
|
|
186
|
+
case 45:
|
|
184
187
|
console.log('✅ 压缩完成');
|
|
185
188
|
console.log('开始连接服务器');
|
|
186
|
-
_context.next =
|
|
189
|
+
_context.next = 49;
|
|
187
190
|
return uploadCode.connectServer();
|
|
188
|
-
case
|
|
191
|
+
case 49:
|
|
189
192
|
conn = _context.sent;
|
|
190
193
|
console.log('✅ 连接服务器完成');
|
|
191
194
|
console.log('开始上传');
|
|
192
|
-
_context.next =
|
|
195
|
+
_context.next = 54;
|
|
193
196
|
return uploadCode.serverUpload();
|
|
194
|
-
case
|
|
197
|
+
case 54:
|
|
195
198
|
console.log('✅ 上传完成');
|
|
196
199
|
console.log('开始解压');
|
|
197
|
-
_context.next =
|
|
200
|
+
_context.next = 58;
|
|
198
201
|
return uploadCode.serverUnpack();
|
|
199
|
-
case
|
|
202
|
+
case 58:
|
|
200
203
|
if (!res.is_release) {
|
|
201
|
-
_context.next =
|
|
204
|
+
_context.next = 63;
|
|
202
205
|
break;
|
|
203
206
|
}
|
|
204
207
|
releaseInstance = new Release({
|
|
@@ -208,32 +211,32 @@ function _init() {
|
|
|
208
211
|
conn: conn
|
|
209
212
|
});
|
|
210
213
|
console.log('开始发布');
|
|
211
|
-
_context.next =
|
|
214
|
+
_context.next = 63;
|
|
212
215
|
return releaseInstance.release();
|
|
213
|
-
case
|
|
214
|
-
_context.next =
|
|
216
|
+
case 63:
|
|
217
|
+
_context.next = 65;
|
|
215
218
|
return uploadCode.disconnectServer();
|
|
216
|
-
case
|
|
217
|
-
_context.next =
|
|
219
|
+
case 65:
|
|
220
|
+
_context.next = 67;
|
|
218
221
|
return $(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["git pull --no-edit"])));
|
|
219
|
-
case
|
|
220
|
-
_context.next =
|
|
222
|
+
case 67:
|
|
223
|
+
_context.next = 69;
|
|
221
224
|
return $(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["git push --follow-tags"])));
|
|
222
|
-
case
|
|
225
|
+
case 69:
|
|
223
226
|
console.log('✅ 成功后推送到git');
|
|
224
|
-
_context.next =
|
|
227
|
+
_context.next = 81;
|
|
225
228
|
break;
|
|
226
|
-
case
|
|
227
|
-
_context.prev =
|
|
229
|
+
case 72:
|
|
230
|
+
_context.prev = 72;
|
|
228
231
|
_context.t0 = _context["catch"](26);
|
|
229
232
|
console.log(_context.t0, '执行出错 请排查重试');
|
|
230
|
-
_context.next =
|
|
233
|
+
_context.next = 77;
|
|
231
234
|
return $(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["git reset HEAD~1"])));
|
|
232
|
-
case
|
|
233
|
-
_context.next =
|
|
235
|
+
case 77:
|
|
236
|
+
_context.next = 79;
|
|
234
237
|
return $(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["git tag -d v", ""])), uploadCode.currentVersion);
|
|
235
|
-
case
|
|
236
|
-
_context.next =
|
|
238
|
+
case 79:
|
|
239
|
+
_context.next = 81;
|
|
237
240
|
return sendWebhook({
|
|
238
241
|
title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u5931\u8D25"),
|
|
239
242
|
content: [{
|
|
@@ -247,8 +250,8 @@ function _init() {
|
|
|
247
250
|
value: version || ''
|
|
248
251
|
}]
|
|
249
252
|
});
|
|
250
|
-
case
|
|
251
|
-
_context.next =
|
|
253
|
+
case 81:
|
|
254
|
+
_context.next = 83;
|
|
252
255
|
return sendWebhook({
|
|
253
256
|
title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u6210\u529F"),
|
|
254
257
|
content: [{
|
|
@@ -262,13 +265,13 @@ function _init() {
|
|
|
262
265
|
value: version || ''
|
|
263
266
|
}]
|
|
264
267
|
});
|
|
265
|
-
case 82:
|
|
266
|
-
uploadCode.deleteLocalZip();
|
|
267
268
|
case 83:
|
|
269
|
+
uploadCode.deleteLocalZip();
|
|
270
|
+
case 84:
|
|
268
271
|
case "end":
|
|
269
272
|
return _context.stop();
|
|
270
273
|
}
|
|
271
|
-
}, _callee, null, [[26,
|
|
274
|
+
}, _callee, null, [[26, 72]]);
|
|
272
275
|
}));
|
|
273
276
|
return _init.apply(this, arguments);
|
|
274
277
|
}
|
|
@@ -107,6 +107,11 @@ var UploadCode = /*#__PURE__*/function () {
|
|
|
107
107
|
// );
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
if (this.env === 'prod' && this.projectName === 'xzero') {
|
|
111
|
+
serverConfig = serverConfigMap.aws.service[this.env];
|
|
112
|
+
serverConfig.privateKey = fs.readFileSync("../../../pem/pisell-pro.pem");
|
|
113
|
+
}
|
|
114
|
+
|
|
110
115
|
// pisell2.0正式环境使用亚马逊服务器
|
|
111
116
|
if (this.env === "prod" && this.projectName === "admin") {
|
|
112
117
|
serverConfig = serverConfigMap.aws.service[this.env];
|
|
@@ -115,20 +120,20 @@ var UploadCode = /*#__PURE__*/function () {
|
|
|
115
120
|
console.log(serverConfig, 'serverConfig');
|
|
116
121
|
this.setConfig(serverConfig);
|
|
117
122
|
if (serverConfig) {
|
|
118
|
-
_context.next =
|
|
123
|
+
_context.next = 23;
|
|
119
124
|
break;
|
|
120
125
|
}
|
|
121
126
|
console.log("您当前没有权限!");
|
|
122
127
|
return _context.abrupt("return", false);
|
|
123
|
-
case
|
|
128
|
+
case 23:
|
|
124
129
|
_context.t0 = console;
|
|
125
|
-
_context.next =
|
|
130
|
+
_context.next = 26;
|
|
126
131
|
return getGitCurrentBranch();
|
|
127
|
-
case
|
|
132
|
+
case 26:
|
|
128
133
|
_context.t1 = _context.sent;
|
|
129
134
|
_context.t0.log.call(_context.t0, "当前主项目分支", _context.t1);
|
|
130
135
|
return _context.abrupt("return", true);
|
|
131
|
-
case
|
|
136
|
+
case 29:
|
|
132
137
|
case "end":
|
|
133
138
|
return _context.stop();
|
|
134
139
|
}
|
|
@@ -153,7 +153,9 @@ async function init() {
|
|
|
153
153
|
if (_fileName === "admin") {
|
|
154
154
|
_fileName = "my_pisell_v2";
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
if (_fileName !== "xzero") {
|
|
157
|
+
await (0, import_aws.uploadStaticToOSS)(_fileName);
|
|
158
|
+
}
|
|
157
159
|
}
|
|
158
160
|
console.log("开始压缩");
|
|
159
161
|
await uploadCode.compress();
|
|
@@ -85,6 +85,10 @@ var UploadCode = class {
|
|
|
85
85
|
if (this.env === "prod") {
|
|
86
86
|
serverConfig = this.setConfig(serverConfigMap["prod3"]);
|
|
87
87
|
}
|
|
88
|
+
if (this.env === "prod" && this.projectName === "xzero") {
|
|
89
|
+
serverConfig = serverConfigMap.aws.service[this.env];
|
|
90
|
+
serverConfig.privateKey = fs.readFileSync("../../../pem/pisell-pro.pem");
|
|
91
|
+
}
|
|
88
92
|
if (this.env === "prod" && this.projectName === "admin") {
|
|
89
93
|
serverConfig = serverConfigMap.aws.service[this.env];
|
|
90
94
|
serverConfig.privateKey = fs.readFileSync("../../../pem/pisell-pro.pem");
|
package/package.json
CHANGED
|
@@ -146,8 +146,10 @@ async function init() {
|
|
|
146
146
|
if (_fileName === 'admin') {
|
|
147
147
|
_fileName = 'my_pisell_v2'
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
if (_fileName !== 'xzero') {
|
|
150
|
+
// 上传oss
|
|
151
|
+
await uploadStaticToOSS(_fileName);
|
|
152
|
+
}
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
console.log('开始压缩');
|
|
@@ -86,6 +86,11 @@ class UploadCode {
|
|
|
86
86
|
// );
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
if (this.env === 'prod' && this.projectName === 'xzero') {
|
|
90
|
+
serverConfig = serverConfigMap.aws.service[this.env];
|
|
91
|
+
serverConfig.privateKey = fs.readFileSync("../../../pem/pisell-pro.pem");
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
// pisell2.0正式环境使用亚马逊服务器
|
|
90
95
|
if (this.env === "prod" && this.projectName === "admin") {
|
|
91
96
|
serverConfig = serverConfigMap.aws.service[this.env];
|