@pisell/common 1.0.44 → 1.0.46
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 +14 -0
- package/es/script/aws/index.js +9 -9
- package/es/script/constants/index.js +13 -1
- package/es/script/deploy.js +2 -2
- package/es/script/release/index.js +6 -6
- package/es/script/release/release.js +12 -9
- package/es/script/uploadCode/index.js +39 -36
- package/es/script/uploadCode/uploadCode.js +51 -41
- package/es/script/utils/index.js +20 -18
- package/lib/script/aws/index.js +3 -3
- package/lib/script/constants/index.js +13 -1
- package/lib/script/uploadCode/index.js +5 -1
- package/lib/script/uploadCode/uploadCode.js +6 -0
- package/lib/script/utils/index.js +9 -10
- package/package.json +2 -2
- package/src/script/aws/index.js +5 -5
- package/src/script/constants/index.js +12 -0
- package/src/script/uploadCode/index.js +9 -3
- package/src/script/uploadCode/uploadCode.js +35 -25
- package/src/script/utils/index.js +5 -3
package/es/script/utils/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3;
|
|
3
|
-
function ownKeys(
|
|
4
|
-
function _objectSpread(
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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; }
|
|
6
|
-
function _toPropertyKey(
|
|
7
|
-
function _toPrimitive(
|
|
8
|
-
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
9
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
10
10
|
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); } }
|
|
11
11
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
12
|
import * as dotenv from 'dotenv';
|
|
13
13
|
import npmCheck from 'npm-check';
|
|
14
14
|
import path from 'path';
|
|
15
|
+
import fs from 'fs';
|
|
15
16
|
import ssh2 from 'ssh2';
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -72,7 +73,7 @@ var getGitCurrentBranch = /*#__PURE__*/function () {
|
|
|
72
73
|
* monorepo项目名称
|
|
73
74
|
* @type {string[]}
|
|
74
75
|
*/
|
|
75
|
-
var monorepoProjectNameArr = ['admin'];
|
|
76
|
+
var monorepoProjectNameArr = ['admin', 'my_pisell_v2'];
|
|
76
77
|
|
|
77
78
|
/**
|
|
78
79
|
* @Title: 获取本地lm_config.json配置信息
|
|
@@ -84,20 +85,21 @@ var getServerConfig = /*#__PURE__*/function () {
|
|
|
84
85
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
85
86
|
while (1) switch (_context3.prev = _context3.next) {
|
|
86
87
|
case 0:
|
|
88
|
+
console.log(project, 'project');
|
|
87
89
|
if (!monorepoProjectNameArr.includes(project)) {
|
|
88
|
-
_context3.next =
|
|
90
|
+
_context3.next = 5;
|
|
89
91
|
break;
|
|
90
92
|
}
|
|
91
|
-
_context3.next =
|
|
92
|
-
return fs.
|
|
93
|
-
case 3:
|
|
94
|
-
return _context3.abrupt("return", _context3.sent);
|
|
93
|
+
_context3.next = 4;
|
|
94
|
+
return JSON.parse(fs.readFileSync('../../../lm_config.json', 'utf8'));
|
|
95
95
|
case 4:
|
|
96
|
-
_context3.next = 6;
|
|
97
|
-
return fs.readJson('../lm_config.json');
|
|
98
|
-
case 6:
|
|
99
96
|
return _context3.abrupt("return", _context3.sent);
|
|
97
|
+
case 5:
|
|
98
|
+
_context3.next = 7;
|
|
99
|
+
return JSON.parse(fs.readFileSync('../lm_config.json', 'utf8'));
|
|
100
100
|
case 7:
|
|
101
|
+
return _context3.abrupt("return", _context3.sent);
|
|
102
|
+
case 8:
|
|
101
103
|
case "end":
|
|
102
104
|
return _context3.stop();
|
|
103
105
|
}
|
|
@@ -315,21 +317,21 @@ var getNonExcludedPackages = function getNonExcludedPackages(excludedPackages) {
|
|
|
315
317
|
};
|
|
316
318
|
var sendWebhook = /*#__PURE__*/function () {
|
|
317
319
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref8) {
|
|
318
|
-
var _dotenv$config, _dotenv$
|
|
320
|
+
var _dotenv$config, _dotenv$config2;
|
|
319
321
|
var title, content, contentStr, response;
|
|
320
322
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
321
323
|
while (1) switch (_context5.prev = _context5.next) {
|
|
322
324
|
case 0:
|
|
323
325
|
title = _ref8.title, content = _ref8.content;
|
|
324
326
|
contentStr = createFeishuMessageContent(content);
|
|
325
|
-
if ((_dotenv$config = dotenv.config()) !== null && _dotenv$config !== void 0 && (_dotenv$config
|
|
327
|
+
if ((_dotenv$config = dotenv.config()) !== null && _dotenv$config !== void 0 && (_dotenv$config = _dotenv$config.parsed) !== null && _dotenv$config !== void 0 && _dotenv$config.WEBHOOK) {
|
|
326
328
|
_context5.next = 4;
|
|
327
329
|
break;
|
|
328
330
|
}
|
|
329
331
|
return _context5.abrupt("return");
|
|
330
332
|
case 4:
|
|
331
333
|
_context5.next = 6;
|
|
332
|
-
return fetch((_dotenv$config2 = dotenv.config()) === null || _dotenv$config2 === void 0
|
|
334
|
+
return fetch((_dotenv$config2 = dotenv.config()) === null || _dotenv$config2 === void 0 || (_dotenv$config2 = _dotenv$config2.parsed) === null || _dotenv$config2 === void 0 ? void 0 : _dotenv$config2.WEBHOOK, {
|
|
333
335
|
headers: {
|
|
334
336
|
'Content-Type': 'application/json'
|
|
335
337
|
},
|
package/lib/script/aws/index.js
CHANGED
|
@@ -42,9 +42,9 @@ var filterFiles = ["index.html", "umi.server.js", "umi.server.d.ts"];
|
|
|
42
42
|
var __dirname = process.cwd();
|
|
43
43
|
var s3Client = null;
|
|
44
44
|
var bucketName = "";
|
|
45
|
-
var init = async () => {
|
|
45
|
+
var init = async (directory) => {
|
|
46
46
|
try {
|
|
47
|
-
const serverConfig = await (0, import_utils.getServerConfig)(
|
|
47
|
+
const serverConfig = await (0, import_utils.getServerConfig)(directory);
|
|
48
48
|
let awsConfig = serverConfig.aws;
|
|
49
49
|
if (awsConfig) {
|
|
50
50
|
bucketName = awsConfig.bucketName;
|
|
@@ -115,7 +115,7 @@ var uploadFolderContents = async (directory, folderPath = import_path.default.re
|
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
117
|
var uploadStaticToOSS = async (directory, folderPath = import_path.default.resolve(__dirname, "dist")) => {
|
|
118
|
-
await init();
|
|
118
|
+
await init(directory);
|
|
119
119
|
return uploadFolderContents(directory, folderPath);
|
|
120
120
|
};
|
|
121
121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -59,6 +59,16 @@ var outPathMap = {
|
|
|
59
59
|
prod: "../data/release/project/saas_shop",
|
|
60
60
|
release: "../data/release/project/saas_shop",
|
|
61
61
|
pre: "../data/release/project/saas_shop"
|
|
62
|
+
},
|
|
63
|
+
saas_kds: {
|
|
64
|
+
prod: "../data/release/project/saas_kds",
|
|
65
|
+
release: "../data/release/project/saas_kds",
|
|
66
|
+
pre: "../data/release/project/saas_kds"
|
|
67
|
+
},
|
|
68
|
+
saas_ads: {
|
|
69
|
+
prod: "../data/release/project/saas_ads",
|
|
70
|
+
release: "../data/release/project/saas_ads",
|
|
71
|
+
pre: "../data/release/project/saas_ads"
|
|
62
72
|
}
|
|
63
73
|
};
|
|
64
74
|
var isSsrMap = {
|
|
@@ -68,7 +78,9 @@ var isSsrMap = {
|
|
|
68
78
|
my_pisel_h5_v2: true,
|
|
69
79
|
xzero: false,
|
|
70
80
|
saas_admin: false,
|
|
71
|
-
saas_shop: false
|
|
81
|
+
saas_shop: false,
|
|
82
|
+
saas_kds: false,
|
|
83
|
+
saas_ads: false
|
|
72
84
|
};
|
|
73
85
|
var checkPackages = [
|
|
74
86
|
"@pisell/date-picker",
|
|
@@ -153,7 +153,11 @@ async function init() {
|
|
|
153
153
|
if (_fileName === "admin") {
|
|
154
154
|
_fileName = "my_pisell_v2";
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
if (!["xzero", "saas_admin", "saas_shop", "saas_kds", "saas_ads"].includes(
|
|
157
|
+
_fileName
|
|
158
|
+
)) {
|
|
159
|
+
await (0, import_aws.uploadStaticToOSS)(_fileName);
|
|
160
|
+
}
|
|
157
161
|
}
|
|
158
162
|
console.log("开始压缩");
|
|
159
163
|
await uploadCode.compress();
|
|
@@ -90,6 +90,12 @@ var UploadCode = class {
|
|
|
90
90
|
if (this.env === "prod") {
|
|
91
91
|
serverConfig = this.setConfig(serverConfigMap["prod3"]);
|
|
92
92
|
}
|
|
93
|
+
if (this.env === "prod" && ["xzero", "saas_admin", "saas_shop", "saas_kds", "saas_ads"].includes(
|
|
94
|
+
this.projectName
|
|
95
|
+
)) {
|
|
96
|
+
serverConfig = serverConfigMap.aws.service[this.env];
|
|
97
|
+
serverConfig.privateKey = fs.readFileSync(serverConfig.privateKey);
|
|
98
|
+
}
|
|
93
99
|
if (this.env === "prod" && this.projectName === "admin") {
|
|
94
100
|
serverConfig = serverConfigMap.aws.service[this.env];
|
|
95
101
|
serverConfig.privateKey = fs.readFileSync("../../../pem/pisell-pro.pem");
|
|
@@ -47,6 +47,7 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
47
47
|
var dotenv = __toESM(require("dotenv"));
|
|
48
48
|
var import_npm_check = __toESM(require("npm-check"));
|
|
49
49
|
var import_path = __toESM(require("path"));
|
|
50
|
+
var import_fs = __toESM(require("fs"));
|
|
50
51
|
var import_ssh2 = __toESM(require("ssh2"));
|
|
51
52
|
var isWorkingTreeClean = async () => {
|
|
52
53
|
const v = await $`git status --porcelain`;
|
|
@@ -56,12 +57,13 @@ var getGitCurrentBranch = async () => {
|
|
|
56
57
|
const v = await $`git symbolic-ref --short HEAD`;
|
|
57
58
|
return v.stdout;
|
|
58
59
|
};
|
|
59
|
-
var monorepoProjectNameArr = ["admin"];
|
|
60
|
+
var monorepoProjectNameArr = ["admin", "my_pisell_v2"];
|
|
60
61
|
var getServerConfig = async (project) => {
|
|
62
|
+
console.log(project, "project");
|
|
61
63
|
if (monorepoProjectNameArr.includes(project)) {
|
|
62
|
-
return await
|
|
64
|
+
return await JSON.parse(import_fs.default.readFileSync("../../../lm_config.json", "utf8"));
|
|
63
65
|
}
|
|
64
|
-
return await
|
|
66
|
+
return await JSON.parse(import_fs.default.readFileSync("../lm_config.json", "utf8"));
|
|
65
67
|
};
|
|
66
68
|
var connectServer = (config2) => {
|
|
67
69
|
const conn = new import_ssh2.default.Client();
|
|
@@ -75,8 +77,7 @@ var connectServer = (config2) => {
|
|
|
75
77
|
});
|
|
76
78
|
};
|
|
77
79
|
var serverUpload = (conn, { localPath, remotePath }) => {
|
|
78
|
-
if (!conn)
|
|
79
|
-
return Promise.reject("未连接服务器");
|
|
80
|
+
if (!conn) return Promise.reject("未连接服务器");
|
|
80
81
|
return new Promise((resolve, reject) => {
|
|
81
82
|
conn.sftp((err, sftp) => {
|
|
82
83
|
if (err) {
|
|
@@ -119,8 +120,7 @@ var serverUpload = (conn, { localPath, remotePath }) => {
|
|
|
119
120
|
});
|
|
120
121
|
};
|
|
121
122
|
var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog, env }) => {
|
|
122
|
-
if (!conn)
|
|
123
|
-
return Promise.reject("未连接服务器");
|
|
123
|
+
if (!conn) return Promise.reject("未连接服务器");
|
|
124
124
|
return new Promise((resolve, reject) => {
|
|
125
125
|
conn.shell((err, stream) => {
|
|
126
126
|
if (err) {
|
|
@@ -213,7 +213,7 @@ var getCurrentProjectName = () => {
|
|
|
213
213
|
var getCurrentProjectPkg = () => {
|
|
214
214
|
return loadJSON(import_path.default.join(process.cwd(), "./package.json"));
|
|
215
215
|
};
|
|
216
|
-
var loadJSON = (path2) => JSON.parse(
|
|
216
|
+
var loadJSON = (path2) => JSON.parse(import_fs.default.readFileSync(path2));
|
|
217
217
|
var getCurrentUserName = async () => {
|
|
218
218
|
const { stdout } = await $`git config user.name`;
|
|
219
219
|
return stdout;
|
|
@@ -242,8 +242,7 @@ var getNonExcludedPackages = (excludedPackages) => {
|
|
|
242
242
|
var sendWebhook = async ({ title, content }) => {
|
|
243
243
|
var _a, _b, _c, _d;
|
|
244
244
|
const contentStr = createFeishuMessageContent(content);
|
|
245
|
-
if (!((_b = (_a = dotenv.config()) == null ? void 0 : _a.parsed) == null ? void 0 : _b.WEBHOOK))
|
|
246
|
-
return;
|
|
245
|
+
if (!((_b = (_a = dotenv.config()) == null ? void 0 : _a.parsed) == null ? void 0 : _b.WEBHOOK)) return;
|
|
247
246
|
const response = await fetch((_d = (_c = dotenv.config()) == null ? void 0 : _c.parsed) == null ? void 0 : _d.WEBHOOK, {
|
|
248
247
|
headers: {
|
|
249
248
|
"Content-Type": "application/json"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.less"
|
|
6
6
|
],
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"archiver": "^5.3.1",
|
|
21
21
|
"dotenv": "^16.0.3",
|
|
22
22
|
"ssh2": "^1.13.0",
|
|
23
|
-
"@pisell/utils": "1.0.
|
|
23
|
+
"@pisell/utils": "1.0.45"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"father": "^4.1.6"
|
package/src/script/aws/index.js
CHANGED
|
@@ -15,10 +15,10 @@ let bucketName = '';
|
|
|
15
15
|
* @Author: zhiwei.Wang
|
|
16
16
|
* @Date: 2023-11-24 14:05
|
|
17
17
|
*/
|
|
18
|
-
const init = async () => {
|
|
18
|
+
const init = async (directory) => {
|
|
19
19
|
try {
|
|
20
20
|
// 读取本地config
|
|
21
|
-
const serverConfig = await getServerConfig(
|
|
21
|
+
const serverConfig = await getServerConfig(directory);
|
|
22
22
|
|
|
23
23
|
// aws配置
|
|
24
24
|
let awsConfig = serverConfig.aws;
|
|
@@ -84,7 +84,7 @@ const uploadFile = async (directory, fileKey, filePath) => {
|
|
|
84
84
|
*/
|
|
85
85
|
export const uploadFolderContents = async (
|
|
86
86
|
directory,
|
|
87
|
-
folderPath = path.resolve(__dirname, 'dist')
|
|
87
|
+
folderPath = path.resolve(__dirname, 'dist')
|
|
88
88
|
) => {
|
|
89
89
|
const files = fs.readdirSync(folderPath);
|
|
90
90
|
|
|
@@ -129,10 +129,10 @@ export const uploadFolderContents = async (
|
|
|
129
129
|
*/
|
|
130
130
|
export const uploadStaticToOSS = async (
|
|
131
131
|
directory,
|
|
132
|
-
folderPath = path.resolve(__dirname, 'dist')
|
|
132
|
+
folderPath = path.resolve(__dirname, 'dist')
|
|
133
133
|
) => {
|
|
134
134
|
// 初始化aws
|
|
135
|
-
await init();
|
|
135
|
+
await init(directory);
|
|
136
136
|
|
|
137
137
|
return uploadFolderContents(directory, folderPath);
|
|
138
138
|
};
|
|
@@ -34,6 +34,16 @@ const outPathMap = {
|
|
|
34
34
|
release: '../data/release/project/saas_shop',
|
|
35
35
|
pre: '../data/release/project/saas_shop',
|
|
36
36
|
},
|
|
37
|
+
saas_kds: {
|
|
38
|
+
prod: '../data/release/project/saas_kds',
|
|
39
|
+
release: '../data/release/project/saas_kds',
|
|
40
|
+
pre: '../data/release/project/saas_kds',
|
|
41
|
+
},
|
|
42
|
+
saas_ads: {
|
|
43
|
+
prod: '../data/release/project/saas_ads',
|
|
44
|
+
release: '../data/release/project/saas_ads',
|
|
45
|
+
pre: '../data/release/project/saas_ads',
|
|
46
|
+
},
|
|
37
47
|
};
|
|
38
48
|
|
|
39
49
|
const isSsrMap = {
|
|
@@ -44,6 +54,8 @@ const isSsrMap = {
|
|
|
44
54
|
xzero: false,
|
|
45
55
|
saas_admin: false,
|
|
46
56
|
saas_shop: false,
|
|
57
|
+
saas_kds: false,
|
|
58
|
+
saas_ads: false,
|
|
47
59
|
};
|
|
48
60
|
|
|
49
61
|
const checkPackages = [
|
|
@@ -144,10 +144,16 @@ async function init() {
|
|
|
144
144
|
_fileName = 'pre_' + _fileName;
|
|
145
145
|
}
|
|
146
146
|
if (_fileName === 'admin') {
|
|
147
|
-
_fileName = 'my_pisell_v2'
|
|
147
|
+
_fileName = 'my_pisell_v2';
|
|
148
|
+
}
|
|
149
|
+
if (
|
|
150
|
+
!['xzero', 'saas_admin', 'saas_shop', 'saas_kds', 'saas_ads'].includes(
|
|
151
|
+
_fileName
|
|
152
|
+
)
|
|
153
|
+
) {
|
|
154
|
+
// 上传oss
|
|
155
|
+
await uploadStaticToOSS(_fileName);
|
|
148
156
|
}
|
|
149
|
-
// 上传oss
|
|
150
|
-
await uploadStaticToOSS(_fileName);
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
console.log('开始压缩');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import archiver from
|
|
2
|
-
import path from
|
|
3
|
-
import { checkPackages, isSsrMap, outPathMap } from
|
|
1
|
+
import archiver from 'archiver';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { checkPackages, isSsrMap, outPathMap } from '../constants/index.js';
|
|
4
4
|
import {
|
|
5
5
|
checkPkgVersion,
|
|
6
6
|
connectServer,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
isWorkingTreeClean,
|
|
10
10
|
serverUnpack,
|
|
11
11
|
serverUpload,
|
|
12
|
-
} from
|
|
12
|
+
} from '../utils/index.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @Title: 上传代码至服务器类
|
|
@@ -26,8 +26,8 @@ class UploadCode {
|
|
|
26
26
|
this.changelog = changelog;
|
|
27
27
|
this.is_release = is_release;
|
|
28
28
|
|
|
29
|
-
this.currentVersion =
|
|
30
|
-
this.projectAbsolutePath =
|
|
29
|
+
this.currentVersion = '';
|
|
30
|
+
this.projectAbsolutePath = '';
|
|
31
31
|
this.conn = null;
|
|
32
32
|
this.serverConfig = null;
|
|
33
33
|
// 是否是ssr项目
|
|
@@ -55,7 +55,7 @@ class UploadCode {
|
|
|
55
55
|
const serverConfigMap = await getServerConfig(this.projectName);
|
|
56
56
|
|
|
57
57
|
if (!serverConfigMap) {
|
|
58
|
-
console.log(
|
|
58
|
+
console.log('未找到发布脚本!');
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -69,7 +69,7 @@ class UploadCode {
|
|
|
69
69
|
this.projectAbsolutePath = process.cwd();
|
|
70
70
|
|
|
71
71
|
if (!(await isWorkingTreeClean())) {
|
|
72
|
-
console.log(
|
|
72
|
+
console.log('工作区不干净, 请先提交代码');
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -83,33 +83,43 @@ class UploadCode {
|
|
|
83
83
|
let serverConfig = this.setConfig(serverConfigMap[this.env]);
|
|
84
84
|
|
|
85
85
|
// 选择release默认用国内cn服务器
|
|
86
|
-
if (this.env ===
|
|
86
|
+
if (this.env === 'release') {
|
|
87
87
|
serverConfig = this.setConfig(serverConfigMap.cn[this.env]);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
if (this.env ===
|
|
90
|
+
if (this.env === 'prod') {
|
|
91
91
|
serverConfig = this.setConfig(serverConfigMap['prod3']);
|
|
92
92
|
// serverConfig.privateKey = fs.readFileSync(
|
|
93
93
|
// path.join(process.env.HOME, '.ssh', 'id_rsa'),
|
|
94
94
|
// );
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
if (
|
|
98
|
+
this.env === 'prod' &&
|
|
99
|
+
['xzero', 'saas_admin', 'saas_shop', 'saas_kds', 'saas_ads'].includes(
|
|
100
|
+
this.projectName
|
|
101
|
+
)
|
|
102
|
+
) {
|
|
103
|
+
serverConfig = serverConfigMap.aws.service[this.env];
|
|
104
|
+
serverConfig.privateKey = fs.readFileSync(serverConfig.privateKey);
|
|
105
|
+
}
|
|
106
|
+
|
|
97
107
|
// pisell2.0正式环境使用亚马逊服务器
|
|
98
|
-
if (this.env ===
|
|
108
|
+
if (this.env === 'prod' && this.projectName === 'admin') {
|
|
99
109
|
serverConfig = serverConfigMap.aws.service[this.env];
|
|
100
|
-
serverConfig.privateKey = fs.readFileSync(
|
|
110
|
+
serverConfig.privateKey = fs.readFileSync('../../../pem/pisell-pro.pem');
|
|
101
111
|
}
|
|
102
112
|
|
|
103
|
-
console.log(serverConfig,'serverConfig')
|
|
113
|
+
console.log(serverConfig, 'serverConfig');
|
|
104
114
|
|
|
105
115
|
this.setConfig(serverConfig);
|
|
106
116
|
|
|
107
117
|
if (!serverConfig) {
|
|
108
|
-
console.log(
|
|
118
|
+
console.log('您当前没有权限!');
|
|
109
119
|
return false;
|
|
110
120
|
}
|
|
111
121
|
|
|
112
|
-
console.log(
|
|
122
|
+
console.log('当前主项目分支', await getGitCurrentBranch());
|
|
113
123
|
|
|
114
124
|
return true;
|
|
115
125
|
}
|
|
@@ -120,15 +130,15 @@ class UploadCode {
|
|
|
120
130
|
* @Author: Zsj
|
|
121
131
|
*/
|
|
122
132
|
async updateVersion() {
|
|
123
|
-
if (this.env ===
|
|
133
|
+
if (this.env === 'prod') {
|
|
124
134
|
await $`npm version ${this.version} -m "%s ${this.changelog}"`;
|
|
125
|
-
let { version } = await fs.readJson(
|
|
135
|
+
let { version } = await fs.readJson('./package.json');
|
|
126
136
|
this.currentVersion = version;
|
|
127
137
|
}
|
|
128
|
-
if (this.env !==
|
|
138
|
+
if (this.env !== 'prod') {
|
|
129
139
|
await $`npm version ${this.version} --no-git-tag-version`;
|
|
130
140
|
await $`git add package.json`;
|
|
131
|
-
let { version } = await fs.readJson(
|
|
141
|
+
let { version } = await fs.readJson('./package.json');
|
|
132
142
|
this.currentVersion = version;
|
|
133
143
|
await $`git commit -m "chore: ${this.currentVersion} ${this.changelog}"`;
|
|
134
144
|
}
|
|
@@ -153,22 +163,22 @@ class UploadCode {
|
|
|
153
163
|
return new Promise((resolve, reject) => {
|
|
154
164
|
const __dirname = process.cwd();
|
|
155
165
|
const zipFile = path.resolve(__dirname, `${this.currentVersion}.zip`);
|
|
156
|
-
const originFilePath = path.resolve(__dirname,
|
|
166
|
+
const originFilePath = path.resolve(__dirname, 'dist');
|
|
157
167
|
const output = fs.createWriteStream(zipFile);
|
|
158
|
-
const archive = archiver(
|
|
168
|
+
const archive = archiver('zip', {
|
|
159
169
|
zlib: { level: 9 }, // 设置压缩级别
|
|
160
170
|
});
|
|
161
|
-
archive.on(
|
|
171
|
+
archive.on('error', function (err) {
|
|
162
172
|
reject(err);
|
|
163
173
|
});
|
|
164
174
|
|
|
165
|
-
output.on(
|
|
175
|
+
output.on('close', function () {
|
|
166
176
|
resolve(true);
|
|
167
177
|
});
|
|
168
178
|
|
|
169
179
|
archive.pipe(output);
|
|
170
180
|
|
|
171
|
-
archive.directory(originFilePath,
|
|
181
|
+
archive.directory(originFilePath, '/dist'); //将srcPath路径对应的内容添加到zip包中/dist路径
|
|
172
182
|
|
|
173
183
|
archive.finalize();
|
|
174
184
|
});
|
|
@@ -181,7 +191,7 @@ class UploadCode {
|
|
|
181
191
|
*/
|
|
182
192
|
async connectServer() {
|
|
183
193
|
if (!this.serverConfig) {
|
|
184
|
-
console.log(
|
|
194
|
+
console.log('未找到发布配置!');
|
|
185
195
|
return null;
|
|
186
196
|
}
|
|
187
197
|
this.conn = await connectServer(this.serverConfig);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as dotenv from 'dotenv';
|
|
2
2
|
import npmCheck from 'npm-check';
|
|
3
3
|
import path from 'path';
|
|
4
|
+
import fs from 'fs';
|
|
4
5
|
import ssh2 from 'ssh2';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -27,7 +28,7 @@ const getGitCurrentBranch = async () => {
|
|
|
27
28
|
* monorepo项目名称
|
|
28
29
|
* @type {string[]}
|
|
29
30
|
*/
|
|
30
|
-
const monorepoProjectNameArr = ['admin'];
|
|
31
|
+
const monorepoProjectNameArr = ['admin', 'my_pisell_v2'];
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* @Title: 获取本地lm_config.json配置信息
|
|
@@ -35,10 +36,11 @@ const monorepoProjectNameArr = ['admin'];
|
|
|
35
36
|
* @Author: Zsj
|
|
36
37
|
*/
|
|
37
38
|
const getServerConfig = async (project) => {
|
|
39
|
+
console.log(project,'project')
|
|
38
40
|
if (monorepoProjectNameArr.includes(project)) {
|
|
39
|
-
return await fs.
|
|
41
|
+
return await JSON.parse(fs.readFileSync('../../../lm_config.json', 'utf8'))
|
|
40
42
|
}
|
|
41
|
-
return await fs.
|
|
43
|
+
return await JSON.parse(fs.readFileSync('../lm_config.json', 'utf8'))
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
/**
|