@pisell/common 0.0.47 → 0.0.49

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.
@@ -78,6 +78,14 @@ var inquirerResult = function inquirerResult() {
78
78
  default: true
79
79
  }]);
80
80
  };
81
+ var inquirerOss = function inquirerOss() {
82
+ return inquirer.prompt([{
83
+ type: 'confirm',
84
+ message: '确认OSS上传完成, 并且vpn环境正确',
85
+ name: 'is_upload_completed_OSS',
86
+ default: true
87
+ }]);
88
+ };
81
89
  function init() {
82
90
  return _init.apply(this, arguments);
83
91
  }
@@ -92,7 +100,7 @@ function init() {
92
100
  */
93
101
  function _init() {
94
102
  _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
95
- var res, uploadCode, version, currentUserName, result, _fileName, conn, releaseInstance;
103
+ var res, uploadCode, version, currentUserName, result, _fileName, ossRes, conn, releaseInstance;
96
104
  return _regeneratorRuntime().wrap(function _callee$(_context) {
97
105
  while (1) switch (_context.prev = _context.next) {
98
106
  case 0:
@@ -171,36 +179,46 @@ function _init() {
171
179
  case 34:
172
180
  console.log('使用本地/dist');
173
181
  case 35:
174
- if (!(res.env === 'prod')) {
175
- _context.next = 39;
182
+ if (!(res.env === 'prod' || res.env === 'pre')) {
183
+ _context.next = 44;
176
184
  break;
177
185
  }
178
186
  _fileName = res.project.fileName; // 上传oss
179
187
  _context.next = 39;
180
188
  return uploadStaticToOSS(_fileName);
181
189
  case 39:
190
+ _context.next = 41;
191
+ return inquirerOss();
192
+ case 41:
193
+ ossRes = _context.sent;
194
+ if (ossRes.is_upload_completed_OSS) {
195
+ _context.next = 44;
196
+ break;
197
+ }
198
+ return _context.abrupt("return");
199
+ case 44:
182
200
  console.log('开始压缩');
183
- _context.next = 42;
201
+ _context.next = 47;
184
202
  return uploadCode.compress();
185
- case 42:
203
+ case 47:
186
204
  console.log('✅ 压缩完成');
187
205
  console.log('开始连接服务器');
188
- _context.next = 46;
206
+ _context.next = 51;
189
207
  return uploadCode.connectServer();
190
- case 46:
208
+ case 51:
191
209
  conn = _context.sent;
192
210
  console.log('✅ 连接服务器完成');
193
211
  console.log('开始上传');
194
- _context.next = 51;
212
+ _context.next = 56;
195
213
  return uploadCode.serverUpload();
196
- case 51:
214
+ case 56:
197
215
  console.log('✅ 上传完成');
198
216
  console.log('开始解压');
199
- _context.next = 55;
217
+ _context.next = 60;
200
218
  return uploadCode.serverUnpack();
201
- case 55:
219
+ case 60:
202
220
  if (!res.is_release) {
203
- _context.next = 60;
221
+ _context.next = 65;
204
222
  break;
205
223
  }
206
224
  releaseInstance = new Release({
@@ -210,32 +228,32 @@ function _init() {
210
228
  conn: conn
211
229
  });
212
230
  console.log('开始发布');
213
- _context.next = 60;
231
+ _context.next = 65;
214
232
  return releaseInstance.release();
215
- case 60:
216
- _context.next = 62;
233
+ case 65:
234
+ _context.next = 67;
217
235
  return uploadCode.disconnectServer();
218
- case 62:
219
- _context.next = 64;
236
+ case 67:
237
+ _context.next = 69;
220
238
  return $(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["git pull --no-edit"])));
221
- case 64:
222
- _context.next = 66;
239
+ case 69:
240
+ _context.next = 71;
223
241
  return $(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["git push --follow-tags"])));
224
- case 66:
242
+ case 71:
225
243
  console.log('✅ 成功后推送到git');
226
244
 
227
245
  // 只有在shop端发布
228
246
  if (!(res.project.fileName === 'my_pisel_shop')) {
229
- _context.next = 70;
247
+ _context.next = 75;
230
248
  break;
231
249
  }
232
- _context.next = 70;
250
+ _context.next = 75;
233
251
  return updateVersion({
234
252
  version: version,
235
253
  changelog: res.changelog
236
254
  }, res.env);
237
- case 70:
238
- _context.next = 72;
255
+ case 75:
256
+ _context.next = 77;
239
257
  return sendWebhook({
240
258
  title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u6210\u529F"),
241
259
  content: [{
@@ -249,20 +267,20 @@ function _init() {
249
267
  value: version || ''
250
268
  }]
251
269
  });
252
- case 72:
253
- _context.next = 83;
270
+ case 77:
271
+ _context.next = 88;
254
272
  break;
255
- case 74:
256
- _context.prev = 74;
273
+ case 79:
274
+ _context.prev = 79;
257
275
  _context.t0 = _context["catch"](26);
258
276
  console.log(_context.t0, '执行出错 请排查重试');
259
- _context.next = 79;
277
+ _context.next = 84;
260
278
  return $(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["git reset HEAD~1"])));
261
- case 79:
262
- _context.next = 81;
279
+ case 84:
280
+ _context.next = 86;
263
281
  return deleteGitTag("v".concat(uploadCode.currentVersion));
264
- case 81:
265
- _context.next = 83;
282
+ case 86:
283
+ _context.next = 88;
266
284
  return sendWebhook({
267
285
  title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u5931\u8D25"),
268
286
  content: [{
@@ -279,13 +297,13 @@ function _init() {
279
297
  value: "".concat(_context.t0) || ''
280
298
  }]
281
299
  });
282
- case 83:
300
+ case 88:
283
301
  uploadCode.deleteLocalZip();
284
- case 84:
302
+ case 89:
285
303
  case "end":
286
304
  return _context.stop();
287
305
  }
288
- }, _callee, null, [[26, 74]]);
306
+ }, _callee, null, [[26, 79]]);
289
307
  }));
290
308
  return _init.apply(this, arguments);
291
309
  }
@@ -100,6 +100,16 @@ var inquirerResult = () => {
100
100
  }
101
101
  ]);
102
102
  };
103
+ var inquirerOss = () => {
104
+ return import_inquirer.default.prompt([
105
+ {
106
+ type: "confirm",
107
+ message: "确认OSS上传完成, 并且vpn环境正确",
108
+ name: "is_upload_completed_OSS",
109
+ default: true
110
+ }
111
+ ]);
112
+ };
103
113
  async function init() {
104
114
  let res = await inquirerResult();
105
115
  if (!res.is_confirm) {
@@ -145,9 +155,13 @@ async function init() {
145
155
  } else {
146
156
  console.log("使用本地/dist");
147
157
  }
148
- if (res.env === "prod") {
158
+ if (res.env === "prod" || res.env === "pre") {
149
159
  let _fileName = res.project.fileName;
150
160
  await (0, import_aws.uploadStaticToOSS)(_fileName);
161
+ const ossRes = await inquirerOss();
162
+ if (!ossRes.is_upload_completed_OSS) {
163
+ return;
164
+ }
151
165
  }
152
166
  console.log("开始压缩");
153
167
  await uploadCode.compress();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/common",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "description": "A collection of reusable UI components for web development",
5
5
  "license": "MIT",
6
6
  "sideEffects": [