@pisell/common 0.0.9 → 0.0.11

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.
@@ -0,0 +1,225 @@
1
+ #!/usr/bin/env zx
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;
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
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
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); } }
7
+ 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); }); }; }
8
+ import inquirer from 'inquirer';
9
+ import 'zx/globals';
10
+ import Release from "../release/release.js";
11
+ import { getCurrentProjectName } from "../utils/index.js";
12
+ import UploadCode from "./uploadCode.js";
13
+
14
+ /**
15
+ * @Title: 选择器函数
16
+ * @Describe:
17
+ * @Author: Wzw
18
+ */
19
+ var inquirerResult = function inquirerResult() {
20
+ return inquirer.prompt([
21
+ // {
22
+ // type: "list",
23
+ // message: "请选择项目",
24
+ // name: "project",
25
+ // choices: [
26
+ // {
27
+ // value: {
28
+ // path: "./",
29
+ // fileName: "my_pisel_shop"
30
+ // },
31
+ // name: "my_pisel_shop"
32
+ // },
33
+ // ],
34
+ // },
35
+ {
36
+ type: 'list',
37
+ message: '请选择发布环境',
38
+ name: 'env',
39
+ choices: ['release', 'pre', 'prod']
40
+ }, {
41
+ type: 'rawlist',
42
+ message: '请选择当前更新版本号',
43
+ name: 'version',
44
+ default: false,
45
+ choices: ['patch', 'minor', 'major']
46
+ }, {
47
+ type: 'input',
48
+ message: '请输入更新内容',
49
+ name: 'changelog',
50
+ default: 'update'
51
+ }, {
52
+ type: 'list',
53
+ message: '上传之后是否执行发布',
54
+ name: 'is_release',
55
+ choices: [{
56
+ value: false,
57
+ name: '只上传'
58
+ }, {
59
+ value: true,
60
+ name: '上传并发布'
61
+ }]
62
+ }, {
63
+ type: 'confirm',
64
+ message: '确认信息无误',
65
+ name: 'is_confirm',
66
+ default: true
67
+ }]);
68
+ };
69
+ function init() {
70
+ return _init.apply(this, arguments);
71
+ }
72
+ function _init() {
73
+ _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
74
+ var res, uploadCode, version, conn, releaseInstance;
75
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
76
+ while (1) switch (_context.prev = _context.next) {
77
+ case 0:
78
+ _context.next = 2;
79
+ return inquirerResult();
80
+ case 2:
81
+ res = _context.sent;
82
+ if (res.is_confirm) {
83
+ _context.next = 6;
84
+ break;
85
+ }
86
+ console.log('取消发布');
87
+ return _context.abrupt("return");
88
+ case 6:
89
+ /** 之前选择项目模式改为获取当前主项目 */
90
+ res.project = {
91
+ path: './',
92
+ fileName: getCurrentProjectName()
93
+ };
94
+
95
+ // 删除本地在远程不存在的tag
96
+ _context.next = 9;
97
+ return $(_templateObject || (_templateObject = _taggedTemplateLiteral(["git fetch --prune --prune-tags"])));
98
+ case 9:
99
+ uploadCode = new UploadCode(res);
100
+ _context.next = 12;
101
+ return uploadCode.check();
102
+ case 12:
103
+ if (_context.sent) {
104
+ _context.next = 14;
105
+ break;
106
+ }
107
+ return _context.abrupt("return");
108
+ case 14:
109
+ console.log('开始更新版本号');
110
+ _context.next = 17;
111
+ return uploadCode.updateVersion();
112
+ case 17:
113
+ version = _context.sent;
114
+ console.log('✅ 版本更新完成');
115
+ _context.prev = 19;
116
+ console.log('开始打包');
117
+ _context.next = 23;
118
+ return uploadCode.build();
119
+ case 23:
120
+ console.log('✅ 打包完成');
121
+ console.log('开始压缩');
122
+ _context.next = 27;
123
+ return uploadCode.compress();
124
+ case 27:
125
+ console.log('✅ 压缩完成');
126
+ console.log('开始连接服务器');
127
+ _context.next = 31;
128
+ return uploadCode.connectServer();
129
+ case 31:
130
+ conn = _context.sent;
131
+ console.log('✅ 连接服务器完成');
132
+ console.log('开始上传');
133
+ _context.next = 36;
134
+ return uploadCode.serverUpload();
135
+ case 36:
136
+ console.log('✅ 上传完成');
137
+ console.log('开始解压');
138
+ _context.next = 40;
139
+ return uploadCode.serverUnpack();
140
+ case 40:
141
+ if (!res.is_release) {
142
+ _context.next = 45;
143
+ break;
144
+ }
145
+ releaseInstance = new Release({
146
+ project: res.project,
147
+ env: res.env,
148
+ version: version,
149
+ conn: conn
150
+ });
151
+ console.log('开始发布');
152
+ _context.next = 45;
153
+ return releaseInstance.release();
154
+ case 45:
155
+ _context.next = 47;
156
+ return uploadCode.disconnectServer();
157
+ case 47:
158
+ _context.next = 49;
159
+ return $(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["git pull --no-edit"])));
160
+ case 49:
161
+ _context.next = 51;
162
+ return $(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["git push --follow-tags"])));
163
+ case 51:
164
+ console.log('✅ 成功后推送到git');
165
+ _context.next = 61;
166
+ break;
167
+ case 54:
168
+ _context.prev = 54;
169
+ _context.t0 = _context["catch"](19);
170
+ console.log(_context.t0, '执行出错 请排查重试');
171
+ _context.next = 59;
172
+ return $(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["git reset HEAD~1"])));
173
+ case 59:
174
+ _context.next = 61;
175
+ return $(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["git tag -d v", ""])), uploadCode.currentVersion);
176
+ case 61:
177
+ uploadCode.deleteLocalZip();
178
+ case 62:
179
+ case "end":
180
+ return _context.stop();
181
+ }
182
+ }, _callee, null, [[19, 54]]);
183
+ }));
184
+ return _init.apply(this, arguments);
185
+ }
186
+ export default init;
187
+
188
+ /**
189
+ *
190
+ * 上传
191
+ * 1. 选择项目 环境等.
192
+ * 2. 打包
193
+ * 3. 打包完成后生成dist文件压缩包
194
+ * 4. 重命名为当前版本号
195
+ * 5. 上传到服务器,并解压. 上传完成
196
+ *
197
+ *
198
+ *
199
+ * 服务器目录结构:
200
+ *
201
+ * project: 所有前端项目
202
+ *
203
+ * my_pisel_h5: 某个项目文件夹
204
+ *
205
+ * master: 当前线上环境指向的代码包
206
+ *
207
+ * v1.0.0: 某个版本
208
+ *
209
+ *
210
+ * 部署, 此部分可界面化.
211
+ * 1. 将master备份, 把对应版本的代码合并到master内.
212
+ * 2. 重启当前服务
213
+ *
214
+ *
215
+ * 回滚指定版本
216
+ *
217
+ * 1. 将master内文件清空并将某个版本的包解压到master内
218
+ * 2. 重启服务
219
+ *
220
+ * node端需要提供以下接口
221
+ *
222
+ * 1. 获取每个项目的所有版本包名称.
223
+ * 2. 通过 项目 + 版本包名称 将对应的包更新至maser 实现发布
224
+ * 3. 将操作记录写成日志存储.
225
+ */
@@ -0,0 +1,401 @@
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
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
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
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
+ 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); } }
6
+ 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); }); }; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
+ import archiver from 'archiver';
13
+ import path from 'path';
14
+ import { outPathMap } from "../constants/index.js";
15
+ import { connectServer as _connectServer, getGitCurrentBranch, getServerConfig, isWorkingTreeClean, serverUnpack as _serverUnpack, serverUpload as _serverUpload } from "../utils/index.js";
16
+
17
+ /**
18
+ * @Title: 上传代码至服务器类
19
+ * @Describe:
20
+ * @Author: Zsj
21
+ */
22
+ var UploadCode = /*#__PURE__*/function () {
23
+ function UploadCode(props) {
24
+ _classCallCheck(this, UploadCode);
25
+ var project = props.project,
26
+ env = props.env,
27
+ version = props.version,
28
+ changelog = props.changelog,
29
+ is_release = props.is_release;
30
+ this.projectName = project.fileName;
31
+ this.projectRelativePath = project.path;
32
+ this.env = env;
33
+ this.version = version;
34
+ this.changelog = changelog;
35
+ this.is_release = is_release;
36
+ this.currentVersion = '';
37
+ this.projectAbsolutePath = '';
38
+ this.conn = null;
39
+ this.serverConfig = null;
40
+ this.outPath = outPathMap[this.projectName][this.env];
41
+ }
42
+
43
+ /**
44
+ * @Title: 设置服务器连接配置
45
+ * @Describe:
46
+ * @Author: Zsj
47
+ */
48
+ _createClass(UploadCode, [{
49
+ key: "setConfig",
50
+ value: function setConfig(serverConfig) {
51
+ this.serverConfig = serverConfig;
52
+ return this.serverConfig;
53
+ }
54
+
55
+ /**
56
+ * @Title: 发布前检查环境和参数是否正确
57
+ * @Describe:
58
+ * @Author: Zsj
59
+ */
60
+ }, {
61
+ key: "check",
62
+ value: function () {
63
+ var _check = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
64
+ var serverConfigMap, serverConfig;
65
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
66
+ while (1) switch (_context.prev = _context.next) {
67
+ case 0:
68
+ _context.next = 2;
69
+ return getServerConfig();
70
+ case 2:
71
+ serverConfigMap = _context.sent;
72
+ if (serverConfigMap) {
73
+ _context.next = 6;
74
+ break;
75
+ }
76
+ console.log('未找到发布脚本!');
77
+ return _context.abrupt("return", false);
78
+ case 6:
79
+ cd(this.projectRelativePath);
80
+
81
+ // const path = await $`pwd`;
82
+
83
+ // windows 下有问题
84
+ // this.projectAbsolutePath = path.stdout.replace('\n','');
85
+
86
+ this.projectAbsolutePath = process.cwd();
87
+ _context.next = 10;
88
+ return isWorkingTreeClean();
89
+ case 10:
90
+ if (_context.sent) {
91
+ _context.next = 13;
92
+ break;
93
+ }
94
+ console.log('工作区不干净, 请先提交代码');
95
+ return _context.abrupt("return", false);
96
+ case 13:
97
+ serverConfig = this.setConfig(serverConfigMap[this.env]);
98
+ if (this.env === 'prod') {
99
+ serverConfig.privateKey = fs.readFileSync(path.join(process.env.HOME, '.ssh', 'id_rsa'));
100
+ }
101
+
102
+ // 选择release默认用国内cn服务器
103
+ if (this.env === 'release') {
104
+ serverConfig = this.setConfig(serverConfigMap.cn[this.env]);
105
+ }
106
+ if (serverConfig) {
107
+ _context.next = 19;
108
+ break;
109
+ }
110
+ console.log('您当前没有权限!');
111
+ return _context.abrupt("return", false);
112
+ case 19:
113
+ _context.t0 = console;
114
+ _context.next = 22;
115
+ return getGitCurrentBranch();
116
+ case 22:
117
+ _context.t1 = _context.sent;
118
+ _context.t0.log.call(_context.t0, '当前主项目分支', _context.t1);
119
+ return _context.abrupt("return", true);
120
+ case 25:
121
+ case "end":
122
+ return _context.stop();
123
+ }
124
+ }, _callee, this);
125
+ }));
126
+ function check() {
127
+ return _check.apply(this, arguments);
128
+ }
129
+ return check;
130
+ }()
131
+ /**
132
+ * @Title: 更新项目中version 并加入changelog
133
+ * @Describe:
134
+ * @Author: Zsj
135
+ */
136
+ }, {
137
+ key: "updateVersion",
138
+ value: function () {
139
+ var _updateVersion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
140
+ var _yield$fs$readJson, version, _yield$fs$readJson2, _version;
141
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
142
+ while (1) switch (_context2.prev = _context2.next) {
143
+ case 0:
144
+ if (!(this.env === 'prod')) {
145
+ _context2.next = 8;
146
+ break;
147
+ }
148
+ _context2.next = 3;
149
+ return $(_templateObject || (_templateObject = _taggedTemplateLiteral(["npm version ", " -m \"%s ", "\""])), this.version, this.changelog);
150
+ case 3:
151
+ _context2.next = 5;
152
+ return fs.readJson('./package.json');
153
+ case 5:
154
+ _yield$fs$readJson = _context2.sent;
155
+ version = _yield$fs$readJson.version;
156
+ this.currentVersion = version;
157
+ case 8:
158
+ if (!(this.env !== 'prod')) {
159
+ _context2.next = 20;
160
+ break;
161
+ }
162
+ _context2.next = 11;
163
+ return $(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["npm version ", " --no-git-tag-version"])), this.version);
164
+ case 11:
165
+ _context2.next = 13;
166
+ return $(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["git add package.json"])));
167
+ case 13:
168
+ _context2.next = 15;
169
+ return fs.readJson('./package.json');
170
+ case 15:
171
+ _yield$fs$readJson2 = _context2.sent;
172
+ _version = _yield$fs$readJson2.version;
173
+ this.currentVersion = _version;
174
+ _context2.next = 20;
175
+ return $(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["git commit -m \"chore: ", " ", "\""])), this.currentVersion, this.changelog);
176
+ case 20:
177
+ return _context2.abrupt("return", this.currentVersion);
178
+ case 21:
179
+ case "end":
180
+ return _context2.stop();
181
+ }
182
+ }, _callee2, this);
183
+ }));
184
+ function updateVersion() {
185
+ return _updateVersion.apply(this, arguments);
186
+ }
187
+ return updateVersion;
188
+ }()
189
+ /**
190
+ * @Title: 根据env执行打包
191
+ * @Describe:
192
+ * @Author: Zsj
193
+ */
194
+ }, {
195
+ key: "build",
196
+ value: function () {
197
+ var _build = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
198
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
199
+ while (1) switch (_context3.prev = _context3.next) {
200
+ case 0:
201
+ _context3.next = 2;
202
+ return $(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["npm run build:", ""])), this.env);
203
+ case 2:
204
+ case "end":
205
+ return _context3.stop();
206
+ }
207
+ }, _callee3, this);
208
+ }));
209
+ function build() {
210
+ return _build.apply(this, arguments);
211
+ }
212
+ return build;
213
+ }()
214
+ /**
215
+ * @Title: 压缩dist文件为zip
216
+ * @Describe:
217
+ * @Author: Zsj
218
+ */
219
+ }, {
220
+ key: "compress",
221
+ value: function () {
222
+ var _compress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
223
+ var _this = this;
224
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
225
+ while (1) switch (_context4.prev = _context4.next) {
226
+ case 0:
227
+ return _context4.abrupt("return", new Promise(function (resolve, reject) {
228
+ var __dirname = process.cwd();
229
+ var zipFile = path.resolve(__dirname, "".concat(_this.currentVersion, ".zip"));
230
+ var originFilePath = path.resolve(__dirname, 'dist');
231
+ var output = fs.createWriteStream(zipFile);
232
+ var archive = archiver('zip', {
233
+ zlib: {
234
+ level: 9
235
+ } // 设置压缩级别
236
+ });
237
+
238
+ archive.on('error', function (err) {
239
+ reject(err);
240
+ });
241
+ output.on('close', function () {
242
+ resolve(true);
243
+ });
244
+ archive.pipe(output);
245
+ archive.directory(originFilePath, '/dist'); //将srcPath路径对应的内容添加到zip包中/dist路径
246
+
247
+ archive.finalize();
248
+ }));
249
+ case 1:
250
+ case "end":
251
+ return _context4.stop();
252
+ }
253
+ }, _callee4);
254
+ }));
255
+ function compress() {
256
+ return _compress.apply(this, arguments);
257
+ }
258
+ return compress;
259
+ }()
260
+ /**
261
+ * @Title: 连接服务器
262
+ * @Describe:
263
+ * @Author: Zsj
264
+ */
265
+ }, {
266
+ key: "connectServer",
267
+ value: function () {
268
+ var _connectServer2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
269
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
270
+ while (1) switch (_context5.prev = _context5.next) {
271
+ case 0:
272
+ if (this.serverConfig) {
273
+ _context5.next = 3;
274
+ break;
275
+ }
276
+ console.log('未找到发布配置!');
277
+ return _context5.abrupt("return", null);
278
+ case 3:
279
+ _context5.next = 5;
280
+ return _connectServer(this.serverConfig);
281
+ case 5:
282
+ this.conn = _context5.sent;
283
+ return _context5.abrupt("return", this.conn);
284
+ case 7:
285
+ case "end":
286
+ return _context5.stop();
287
+ }
288
+ }, _callee5, this);
289
+ }));
290
+ function connectServer() {
291
+ return _connectServer2.apply(this, arguments);
292
+ }
293
+ return connectServer;
294
+ }()
295
+ /**
296
+ * @Title: 本地zip文件上传到服务器
297
+ * @Describe:
298
+ * @Author: Zsj
299
+ */
300
+ }, {
301
+ key: "serverUpload",
302
+ value: function () {
303
+ var _serverUpload2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
304
+ var localPath, remotePath;
305
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
306
+ while (1) switch (_context6.prev = _context6.next) {
307
+ case 0:
308
+ localPath = path.resolve(this.projectAbsolutePath, "".concat(this.currentVersion, ".zip"));
309
+ remotePath = "".concat(this.outPath, "/").concat(this.currentVersion, ".zip");
310
+ _context6.next = 4;
311
+ return _serverUpload(this.conn, {
312
+ localPath: localPath,
313
+ remotePath: remotePath
314
+ });
315
+ case 4:
316
+ return _context6.abrupt("return", _context6.sent);
317
+ case 5:
318
+ case "end":
319
+ return _context6.stop();
320
+ }
321
+ }, _callee6, this);
322
+ }));
323
+ function serverUpload() {
324
+ return _serverUpload2.apply(this, arguments);
325
+ }
326
+ return serverUpload;
327
+ }()
328
+ /**
329
+ * @Title: 服务器中解压文件
330
+ * @Describe:
331
+ * @Author: Zsj
332
+ */
333
+ }, {
334
+ key: "serverUnpack",
335
+ value: function () {
336
+ var _serverUnpack2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
337
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
338
+ while (1) switch (_context7.prev = _context7.next) {
339
+ case 0:
340
+ _context7.next = 2;
341
+ return _serverUnpack(this.conn, {
342
+ path: this.outPath,
343
+ fileName: "".concat(this.currentVersion),
344
+ fullFileName: "".concat(this.currentVersion, ".zip"),
345
+ changelog: this.changelog
346
+ });
347
+ case 2:
348
+ return _context7.abrupt("return", _context7.sent);
349
+ case 3:
350
+ case "end":
351
+ return _context7.stop();
352
+ }
353
+ }, _callee7, this);
354
+ }));
355
+ function serverUnpack() {
356
+ return _serverUnpack2.apply(this, arguments);
357
+ }
358
+ return serverUnpack;
359
+ }()
360
+ /**
361
+ * @Title: 删除本地zip文件
362
+ * @Describe:
363
+ * @Author: Zsj
364
+ */
365
+ }, {
366
+ key: "deleteLocalZip",
367
+ value: function deleteLocalZip() {
368
+ return $(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["rm -rf ", ".zip"])), this.currentVersion);
369
+ }
370
+
371
+ /**
372
+ * @Title: 断开服务连接
373
+ * @Describe:
374
+ * @Author: Zsj
375
+ */
376
+ }, {
377
+ key: "disconnectServer",
378
+ value: function () {
379
+ var _disconnectServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
380
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
381
+ while (1) switch (_context8.prev = _context8.next) {
382
+ case 0:
383
+ _context8.next = 2;
384
+ return this.conn.end();
385
+ case 2:
386
+ return _context8.abrupt("return", _context8.sent);
387
+ case 3:
388
+ case "end":
389
+ return _context8.stop();
390
+ }
391
+ }, _callee8, this);
392
+ }));
393
+ function disconnectServer() {
394
+ return _disconnectServer.apply(this, arguments);
395
+ }
396
+ return disconnectServer;
397
+ }()
398
+ }]);
399
+ return UploadCode;
400
+ }();
401
+ export default UploadCode;