@pisell/common 0.0.41 → 0.0.43

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.
@@ -84,7 +84,7 @@ var uploadFile = /*#__PURE__*/function () {
84
84
  contentType = mime.lookup(filePath);
85
85
  uploadParams = {
86
86
  Bucket: bucketName,
87
- Key: "static/".concat(directory, "/").concat(fileKey),
87
+ Key: "".concat(directory, "/").concat(fileKey),
88
88
  // 指定目录路径
89
89
  Body: fileStream,
90
90
  ContentType: contentType,
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env zx
2
2
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
4
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5
5
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
6
6
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
@@ -9,7 +9,7 @@ import inquirer from 'inquirer';
9
9
  import 'zx/globals';
10
10
  import { uploadStaticToOSS } from "../aws/index.js";
11
11
  import Release from "../release/release.js";
12
- import { getCurrentProjectName, getCurrentUserName, sendWebhook } from "../utils/index.js";
12
+ import { deleteGitTag, getCurrentProjectName, getCurrentUserName, sendWebhook } from "../utils/index.js";
13
13
  import UploadCode from "./uploadCode.js";
14
14
  // {\"post\":{\"zh_cn\":{\"title\":\"my_pisell_shop release环境开始上传并发布\",\"content\":[[{\"text\":\"发布人:\",\"style\":[\"bold\"]},{\"text\":\"左胜杰\",\"style\":[\"bold\"]}],[{\"text\":\"版本号:\",\"style\":[\"bold\"]},{\"text\":\"1.0.71\",\"style\":[\"bold\"]}]]}}}
15
15
  /**
@@ -227,21 +227,21 @@ function _init() {
227
227
  return $(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["git push --follow-tags"])));
228
228
  case 67:
229
229
  console.log('✅ 成功后推送到git');
230
- _context.next = 79;
231
- break;
232
- case 70:
233
- _context.prev = 70;
234
- _context.t0 = _context["catch"](26);
235
- console.log(_context.t0, '执行出错 请排查重试');
236
- _context.next = 75;
237
- return $(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["git reset HEAD~1"])));
238
- case 75:
239
- _context.next = 77;
240
- return $(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["git tag -d v", ""])), uploadCode.currentVersion);
241
- case 77:
242
- _context.next = 79;
230
+
231
+ // 只有在shop端发布
232
+ if (!(res.project.fileName === 'my_pisel_shop')) {
233
+ _context.next = 71;
234
+ break;
235
+ }
236
+ _context.next = 71;
237
+ return updateVersion({
238
+ version: version,
239
+ changelog: res.changelog
240
+ }, res.env);
241
+ case 71:
242
+ _context.next = 73;
243
243
  return sendWebhook({
244
- title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u5931\u8D25"),
244
+ title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u6210\u529F"),
245
245
  content: [{
246
246
  key: '发布人',
247
247
  value: currentUserName.replace('\n', '')
@@ -253,20 +253,22 @@ function _init() {
253
253
  value: version || ''
254
254
  }]
255
255
  });
256
- case 79:
257
- if (!(res.project.fileName === 'my_pisel_shop')) {
258
- _context.next = 82;
259
- break;
260
- }
256
+ case 73:
257
+ _context.next = 84;
258
+ break;
259
+ case 75:
260
+ _context.prev = 75;
261
+ _context.t0 = _context["catch"](26);
262
+ console.log(_context.t0, '执行出错 请排查重试');
263
+ _context.next = 80;
264
+ return $(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["git reset HEAD~1"])));
265
+ case 80:
261
266
  _context.next = 82;
262
- return updateVersion({
263
- version: version,
264
- changelog: res.changelog
265
- }, res.env);
267
+ return deleteGitTag("v".concat(uploadCode.currentVersion));
266
268
  case 82:
267
269
  _context.next = 84;
268
270
  return sendWebhook({
269
- title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u6210\u529F"),
271
+ title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u5931\u8D25"),
270
272
  content: [{
271
273
  key: '发布人',
272
274
  value: currentUserName.replace('\n', '')
@@ -276,6 +278,9 @@ function _init() {
276
278
  }, {
277
279
  key: '版本号',
278
280
  value: version || ''
281
+ }, {
282
+ key: '错误信息',
283
+ value: "".concat(_context.t0) || ''
279
284
  }]
280
285
  });
281
286
  case 84:
@@ -284,7 +289,7 @@ function _init() {
284
289
  case "end":
285
290
  return _context.stop();
286
291
  }
287
- }, _callee, null, [[26, 70]]);
292
+ }, _callee, null, [[26, 75]]);
288
293
  }));
289
294
  return _init.apply(this, arguments);
290
295
  }
@@ -1,5 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _templateObject, _templateObject2, _templateObject3;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -373,4 +373,42 @@ var checkPkgVersion = /*#__PURE__*/function () {
373
373
  return _ref10.apply(this, arguments);
374
374
  };
375
375
  }();
376
- export { isWorkingTreeClean, getServerConfig, connectServer, serverUpload, serverUnpack, versionSort, releaseProject, getGitCurrentBranch, getCurrentProjectName, loadJSON, getCurrentUserName, sendWebhook, checkPkgVersion };
376
+ function deleteGitTag(_x3) {
377
+ return _deleteGitTag.apply(this, arguments);
378
+ }
379
+ function _deleteGitTag() {
380
+ _deleteGitTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(tag) {
381
+ var tags;
382
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
383
+ while (1) switch (_context7.prev = _context7.next) {
384
+ case 0:
385
+ _context7.prev = 0;
386
+ _context7.next = 3;
387
+ return $(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["git show-ref --tags"])));
388
+ case 3:
389
+ tags = _context7.sent;
390
+ tags = tags.stdout.split('\n').map(function (line) {
391
+ return line.split(' ')[1];
392
+ });
393
+ if (!tags.includes("refs/tags/".concat(tag))) {
394
+ _context7.next = 8;
395
+ break;
396
+ }
397
+ _context7.next = 8;
398
+ return $(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["git tag -d ", ""])), tag);
399
+ case 8:
400
+ _context7.next = 13;
401
+ break;
402
+ case 10:
403
+ _context7.prev = 10;
404
+ _context7.t0 = _context7["catch"](0);
405
+ console.error("An error occurred: ".concat(_context7.t0));
406
+ case 13:
407
+ case "end":
408
+ return _context7.stop();
409
+ }
410
+ }, _callee7, null, [[0, 10]]);
411
+ }));
412
+ return _deleteGitTag.apply(this, arguments);
413
+ }
414
+ export { isWorkingTreeClean, getServerConfig, connectServer, serverUpload, serverUnpack, versionSort, releaseProject, getGitCurrentBranch, getCurrentProjectName, loadJSON, getCurrentUserName, sendWebhook, checkPkgVersion, deleteGitTag };
@@ -71,7 +71,7 @@ var uploadFile = async (directory, fileKey, filePath) => {
71
71
  const contentType = import_mime_types.default.lookup(filePath);
72
72
  const uploadParams = {
73
73
  Bucket: bucketName,
74
- Key: `static/${directory}/${fileKey}`,
74
+ Key: `${directory}/${fileKey}`,
75
75
  // 指定目录路径
76
76
  Body: fileStream,
77
77
  ContentType: contentType,
@@ -177,10 +177,36 @@ async function init() {
177
177
  await $`git pull --no-edit`;
178
178
  await $`git push --follow-tags`;
179
179
  console.log("✅ 成功后推送到git");
180
+ if (res.project.fileName === "my_pisel_shop") {
181
+ await updateVersion(
182
+ {
183
+ version,
184
+ changelog: res.changelog
185
+ },
186
+ res.env
187
+ );
188
+ }
189
+ await (0, import_utils.sendWebhook)({
190
+ title: `${res.project.fileName} ${res.env}环境${res.is_release ? "上传并发布" : "上传"}成功`,
191
+ content: [
192
+ {
193
+ key: "发布人",
194
+ value: currentUserName.replace("\n", "")
195
+ },
196
+ {
197
+ key: "更新内容",
198
+ value: res.changelog
199
+ },
200
+ {
201
+ key: "版本号",
202
+ value: version || ""
203
+ }
204
+ ]
205
+ });
180
206
  } catch (error) {
181
207
  console.log(error, "执行出错 请排查重试");
182
208
  await $`git reset HEAD~1`;
183
- await $`git tag -d v${uploadCode.currentVersion}`;
209
+ await (0, import_utils.deleteGitTag)(`v${uploadCode.currentVersion}`);
184
210
  await (0, import_utils.sendWebhook)({
185
211
  title: `${res.project.fileName} ${res.env}环境${res.is_release ? "上传并发布" : "上传"}失败`,
186
212
  content: [
@@ -195,36 +221,14 @@ async function init() {
195
221
  {
196
222
  key: "版本号",
197
223
  value: version || ""
224
+ },
225
+ {
226
+ key: "错误信息",
227
+ value: `${error}` || ""
198
228
  }
199
229
  ]
200
230
  });
201
231
  }
202
- if (res.project.fileName === "my_pisel_shop") {
203
- await updateVersion(
204
- {
205
- version,
206
- changelog: res.changelog
207
- },
208
- res.env
209
- );
210
- }
211
- await (0, import_utils.sendWebhook)({
212
- title: `${res.project.fileName} ${res.env}环境${res.is_release ? "上传并发布" : "上传"}成功`,
213
- content: [
214
- {
215
- key: "发布人",
216
- value: currentUserName.replace("\n", "")
217
- },
218
- {
219
- key: "更新内容",
220
- value: res.changelog
221
- },
222
- {
223
- key: "版本号",
224
- value: version || ""
225
- }
226
- ]
227
- });
228
232
  uploadCode.deleteLocalZip();
229
233
  }
230
234
  async function updateVersion(params, env) {
@@ -31,6 +31,7 @@ var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  checkPkgVersion: () => checkPkgVersion,
33
33
  connectServer: () => connectServer,
34
+ deleteGitTag: () => deleteGitTag,
34
35
  getCurrentProjectName: () => getCurrentProjectName,
35
36
  getCurrentUserName: () => getCurrentUserName,
36
37
  getGitCurrentBranch: () => getGitCurrentBranch,
@@ -268,10 +269,22 @@ var checkPkgVersion = async (checkPackages) => {
268
269
  message: errorMessage
269
270
  };
270
271
  };
272
+ async function deleteGitTag(tag) {
273
+ try {
274
+ let tags = await $`git show-ref --tags`;
275
+ tags = tags.stdout.split("\n").map((line) => line.split(" ")[1]);
276
+ if (tags.includes(`refs/tags/${tag}`)) {
277
+ await $`git tag -d ${tag}`;
278
+ }
279
+ } catch (error) {
280
+ console.error(`An error occurred: ${error}`);
281
+ }
282
+ }
271
283
  // Annotate the CommonJS export names for ESM import in node:
272
284
  0 && (module.exports = {
273
285
  checkPkgVersion,
274
286
  connectServer,
287
+ deleteGitTag,
275
288
  getCurrentProjectName,
276
289
  getCurrentUserName,
277
290
  getGitCurrentBranch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/common",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "A collection of reusable UI components for web development",
5
5
  "license": "MIT",
6
6
  "sideEffects": [