@teams-max/mwsp 1.0.2 → 2.0.1

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.
Files changed (96) hide show
  1. package/bin/mwsp.js +2 -31
  2. package/es/cli/build.d.ts +0 -1
  3. package/es/cli/build.js +69 -61
  4. package/es/cli/cli.js +4 -12
  5. package/es/cli/start.d.ts +0 -1
  6. package/es/cli/start.js +48 -26
  7. package/es/index.d.ts +2 -0
  8. package/es/index.js +3 -1
  9. package/es/utils/chalk/LICENSE +9 -0
  10. package/es/utils/chalk/index.d.ts +416 -0
  11. package/es/utils/chalk/index.js +1719 -0
  12. package/es/utils/chalk/package.json +6 -0
  13. package/es/{cli/update.js → utils/changelog.js} +41 -34
  14. package/es/utils/cross-spawn/package.json +7 -0
  15. package/es/{internal → utils}/datetimeFormat.js +1 -3
  16. package/es/utils/defineConfig.js +20 -0
  17. package/es/{internal → utils}/exec.js +3 -2
  18. package/{lib/internal → es/utils}/execa/index.d.ts +41 -11
  19. package/es/utils/execa/package.json +11 -0
  20. package/es/utils/getPackages.js +9 -0
  21. package/es/{cli/dev.js → utils/git.js} +88 -36
  22. package/es/{internal/utils.js → utils/index.js} +270 -70
  23. package/es/utils/isNextVersion.js +3 -0
  24. package/{lib/internal → es/utils}/merge-stream/index.d.ts +3 -1
  25. package/es/utils/merge-stream/package.json +7 -0
  26. package/es/utils/parseDoc.js +33 -0
  27. package/es/utils/yargs-parser/index.d.ts +114 -0
  28. package/es/utils/yargs-parser/index.js +919 -0
  29. package/es/utils/yargs-parser/package.json +7 -0
  30. package/lib/cli/build.d.ts +0 -1
  31. package/lib/cli/build.js +54 -50
  32. package/lib/cli/cli.js +0 -8
  33. package/lib/cli/start.d.ts +0 -1
  34. package/lib/cli/start.js +25 -30
  35. package/lib/index.d.ts +2 -0
  36. package/lib/index.js +3 -0
  37. package/lib/utils/chalk/LICENSE +9 -0
  38. package/lib/utils/chalk/index.d.ts +416 -0
  39. package/lib/utils/chalk/index.js +1538 -0
  40. package/lib/utils/chalk/package.json +6 -0
  41. package/lib/utils/changelog.js +21 -0
  42. package/lib/{internal → utils}/cross-spawn/index.js +9 -3
  43. package/lib/utils/cross-spawn/package.json +7 -0
  44. package/lib/{internal → utils}/datetimeFormat.js +14 -30
  45. package/lib/utils/defineConfig.js +26 -0
  46. package/lib/utils/exec.js +23 -0
  47. package/{es/internal → lib/utils}/execa/index.d.ts +41 -11
  48. package/lib/{internal → utils}/execa/index.js +76 -18
  49. package/lib/utils/execa/package.json +11 -0
  50. package/lib/utils/getPackages.js +8 -0
  51. package/lib/utils/git.js +31 -0
  52. package/lib/utils/index.js +183 -0
  53. package/lib/utils/isNextVersion.js +4 -0
  54. package/{es/internal → lib/utils}/merge-stream/index.d.ts +3 -1
  55. package/lib/{internal → utils}/merge-stream/index.js +1 -1
  56. package/lib/utils/merge-stream/package.json +7 -0
  57. package/lib/utils/parseDoc.js +30 -0
  58. package/lib/utils/yargs-parser/index.d.ts +114 -0
  59. package/lib/utils/yargs-parser/index.js +919 -0
  60. package/lib/utils/yargs-parser/package.json +7 -0
  61. package/package.json +7 -14
  62. package/es/cli/dev.d.ts +0 -1
  63. package/es/cli/update.d.ts +0 -2
  64. package/es/internal/buildNotify.d.ts +0 -10
  65. package/es/internal/buildNotify.js +0 -123
  66. package/es/internal/cross-spawn/package.json +0 -1
  67. package/es/internal/datetimeFormat.d.ts +0 -9
  68. package/es/internal/exec.d.ts +0 -1
  69. package/es/internal/execa/package.json +0 -1
  70. package/es/internal/merge-stream/package.json +0 -1
  71. package/es/internal/utils.d.ts +0 -14
  72. package/lib/cli/dev.d.ts +0 -1
  73. package/lib/cli/dev.js +0 -62
  74. package/lib/cli/update.d.ts +0 -2
  75. package/lib/cli/update.js +0 -50
  76. package/lib/internal/buildNotify.d.ts +0 -10
  77. package/lib/internal/buildNotify.js +0 -112
  78. package/lib/internal/cross-spawn/package.json +0 -1
  79. package/lib/internal/datetimeFormat.d.ts +0 -9
  80. package/lib/internal/exec.d.ts +0 -1
  81. package/lib/internal/exec.js +0 -60
  82. package/lib/internal/execa/package.json +0 -1
  83. package/lib/internal/merge-stream/package.json +0 -1
  84. package/lib/internal/utils.d.ts +0 -14
  85. package/lib/internal/utils.js +0 -100
  86. /package/es/{internal → utils}/cross-spawn/LICENSE +0 -0
  87. /package/es/{internal → utils}/cross-spawn/index.d.ts +0 -0
  88. /package/es/{internal → utils}/cross-spawn/index.js +0 -0
  89. /package/es/{internal → utils}/execa/LICENSE +0 -0
  90. /package/es/{internal → utils}/execa/index.js +0 -0
  91. /package/es/{internal → utils}/merge-stream/LICENSE +0 -0
  92. /package/es/{internal → utils}/merge-stream/index.js +0 -0
  93. /package/lib/{internal → utils}/cross-spawn/LICENSE +0 -0
  94. /package/lib/{internal → utils}/cross-spawn/index.d.ts +0 -0
  95. /package/lib/{internal → utils}/execa/LICENSE +0 -0
  96. /package/lib/{internal → utils}/merge-stream/LICENSE +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "yargs-parser",
3
+ "license": "ISC",
4
+ "author": "Ben Coe <ben@npmjs.com>",
5
+ "main": "index.js",
6
+ "types": "index.d.ts"
7
+ }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@teams-max/mwsp",
3
- "version": "1.0.2",
3
+ "version": "2.0.1",
4
4
  "description": "@teams-max/mwsp",
5
5
  "homepage": "https://gitlab.daikuan.qihoo.net/efficacy-fe/teams-max/-/tree/master/packages/mwsp",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://gitlab.daikuan.qihoo.net/efficacy-fe/teams-max"
9
9
  },
10
+ "license": "ISC",
10
11
  "main": "lib/index.js",
11
12
  "types": "lib/index.d.ts",
12
13
  "bin": {
@@ -22,23 +23,15 @@
22
23
  "build:deps": "max-scripts bundleDeps",
23
24
  "dev": "max-scripts father dev"
24
25
  },
26
+ "dependencies": {
27
+ "inquirer": "7.3.3",
28
+ "v8-compile-cache": "2.3.0"
29
+ },
25
30
  "publishConfig": {
26
31
  "access": "public"
27
32
  },
28
- "license": "ISC",
29
- "dependencies": {
30
- "@umijs/utils": "^4.0.0",
31
- "crypto-js": "^4.1.1",
32
- "esno": "^0.16.3",
33
- "umi-request": "^1.4.0",
34
- "v8-compile-cache": "2.3.0",
35
- "zx": "^4"
36
- },
37
33
  "authors": [
38
34
  "zhangxiaoyang <zhangxiaoyang-jk@360shuke.com> (https://v.src.corp.qihoo.net/j-zhangxiaoyang-jk)",
39
35
  "liuxiangdong <liuxiangdong1-jk@360shuke.com> (https://v.src.corp.qihoo.net/j-liuxiangdong1-jk)"
40
- ],
41
- "devDependencies": {
42
- "@types/crypto-js": "^4.1.1"
43
- }
36
+ ]
44
37
  }
package/es/cli/dev.d.ts DELETED
@@ -1 +0,0 @@
1
- export default function start(): Promise<void>;
@@ -1,2 +0,0 @@
1
- import 'zx/globals';
2
- export default function update(): Promise<void>;
@@ -1,10 +0,0 @@
1
- import 'zx/globals';
2
- declare type EnvType = 'production' | 'UAT' | 'TEST' | 'development' | 'stage';
3
- declare type StatusType = 'doing' | 'success' | 'fail';
4
- export default function ({ args, appList, environment, buildStatus }: {
5
- args: Record<string, string>;
6
- appList: string[];
7
- environment: EnvType[];
8
- buildStatus?: StatusType;
9
- }): Promise<void>;
10
- export {};
@@ -1,123 +0,0 @@
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;
3
- 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; }
4
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
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
- // 应用部署推送通知
8
- import { extend } from 'umi-request';
9
- import CryptoJS from 'crypto-js';
10
- import 'zx/globals';
11
- import datetimeFormat from "./datetimeFormat";
12
- // if (!extend || !CryptoJS) return;
13
-
14
- function base64Url(str) {
15
- return CryptoJS.enc.Base64.stringify(str).replace(/\+/g, '-').replace(/\//g, '_');
16
- }
17
- function formatChangeLog(log) {
18
- if (!log) return '';
19
- var commits = log.split('\n').map(function (commit) {
20
- var splitIndex = commit.lastIndexOf(' ');
21
- return {
22
- message: commit.slice(0, splitIndex),
23
- id: commit.slice(splitIndex + 1)
24
- };
25
- });
26
- return commits.map(function (commit) {
27
- return "- ".concat(commit.message, " ").concat(commit.id);
28
- }).join('\n');
29
- }
30
- var statusTextMap = {
31
- doing: '正在构建项目',
32
- success: '项目构建成功',
33
- fail: '项目构建失败'
34
- };
35
- var request = extend({
36
- headers: {
37
- 'Content-Type': 'application/json'
38
- }
39
- });
40
- //teams test环境
41
- // const accessToken = '66be608e067b461e99eab18e5204b604d15dd93a6d0142a1af1f58f6bd05fd7c';
42
- // const secret = '97eeeb77388342a8bc78edb8aebe02c779b3ac56d21a4d739ca59f2ea99ed6ed';
43
- // const url = 'https://sit-im.360teams.com/api/qfin-api/rce-app/robot/send'
44
- //teams prod环境
45
- var accessToken = '5ab4ff650f3c47d7a4c7feae3ce5715ae1a36c81e34c4452af25b96a8669b165';
46
- var secret = '81d89e48be684b94ab9acd43b49657ea7f94506b23e2400894105ecc7779735e';
47
- var url = 'https://im.360teams.com/api/qfin-api/rce-app/robot/send';
48
- export default function (_x) {
49
- return _ref2.apply(this, arguments);
50
- }
51
- function _ref2() {
52
- _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
53
- var args, appList, environment, _ref$buildStatus, buildStatus, omitDevEnv, changeLog, branch, serverEnv, timestamp, msgId, str, sign, BUILD_USER, changeLogText, content;
54
- return _regeneratorRuntime().wrap(function _callee$(_context) {
55
- while (1) switch (_context.prev = _context.next) {
56
- case 0:
57
- args = _ref.args, appList = _ref.appList, environment = _ref.environment, _ref$buildStatus = _ref.buildStatus, buildStatus = _ref$buildStatus === void 0 ? 'doing' : _ref$buildStatus;
58
- $.verbose = false;
59
- omitDevEnv = environment.filter(function (item) {
60
- return item !== 'development';
61
- });
62
- changeLog = args.changeLog || args.CHANGELOG || args.change_log || args.CHANGE_LOG || '';
63
- branch = args.branch || args.BRANCH || '';
64
- serverEnv = args.opsEnv || args.OPSENV || args.ops_env || args.OPS_ENV || '';
65
- if (omitDevEnv.length) {
66
- _context.next = 8;
67
- break;
68
- }
69
- return _context.abrupt("return");
70
- case 8:
71
- timestamp = new Date().getTime();
72
- msgId = timestamp;
73
- str = timestamp + '\n' + secret;
74
- sign = encodeURIComponent(base64Url(CryptoJS.HmacSHA256(str, secret)));
75
- _context.t0 = args.buildUser || args.build_user || args.BUILD_USER;
76
- if (_context.t0) {
77
- _context.next = 17;
78
- break;
79
- }
80
- _context.next = 16;
81
- return $(_templateObject || (_templateObject = _taggedTemplateLiteral(["git config user.name"])));
82
- case 16:
83
- _context.t0 = _context.sent.stdout.trim();
84
- case 17:
85
- BUILD_USER = _context.t0;
86
- changeLogText = formatChangeLog(changeLog);
87
- content = "".concat(BUILD_USER, " ").concat(statusTextMap[buildStatus], ":\n");
88
- content += "APP: [".concat(appList.join(', '), "] \n");
89
- if (branch) {
90
- content += "BRANCH: ".concat(branch, " \n");
91
- }
92
- content += "ENV: [".concat(omitDevEnv.join(', '), "] \n");
93
- if (serverEnv) {
94
- content += "SERVER: ".concat(serverEnv, " \n");
95
- }
96
- content += "TIME: ".concat(datetimeFormat(timestamp, 'yyyy-MM-dd hh:mm:ss:S'), " \n");
97
- if (buildStatus === 'doing') {
98
- content += "LOG: ".concat(changeLogText ? '\n' : '');
99
- content += "".concat(changeLogText ? changeLogText : 'no change', "\n");
100
- }
101
- request.post("".concat(url, "?access_token=").concat(accessToken, "&timestamp=").concat(timestamp, "&sign=").concat(sign), {
102
- data: {
103
- msgId: msgId,
104
- msgtype: 'text',
105
- text: {
106
- content: content
107
- },
108
- at: {
109
- isAtAll: false,
110
- userIds: ['zhangxiaoyang-jk', 'liuxiangdong1-jk']
111
- }
112
- }
113
- });
114
- $.verbose = true;
115
- case 28:
116
- case "end":
117
- return _context.stop();
118
- }
119
- }, _callee);
120
- }));
121
- return _ref2.apply(this, arguments);
122
- }
123
- ;
@@ -1 +0,0 @@
1
- {"name":"cross-spawn","main":"index.js","author":"André Cruz <andre@moxy.studio>","license":"MIT","types":"index.d.ts"}
@@ -1,9 +0,0 @@
1
- /**
2
- * 日期时间格式化
3
- * @param {Date | String | Number} value 时间、类时间对象
4
- * @param {String} format 格式:yyyy-MM-dd hh:mm:ss:S
5
- * @param {Boolean} isCoerce 是否对类时间格式强制转换
6
- * @returns {String} 返回格式化后的值
7
- */
8
- declare function datetimeFormat(value: any, format: string, isCoerce?: boolean): string;
9
- export default datetimeFormat;
@@ -1 +0,0 @@
1
- export declare const exec: (command: any, args: any, opts: any) => Promise<unknown>;
@@ -1 +0,0 @@
1
- {"name":"execa","main":"index.js","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","types":"index.d.ts"}
@@ -1 +0,0 @@
1
- {"name":"merge-stream","main":"index.js","author":"Stephen Sugden <me@stephensugden.com>","license":"MIT","types":"index.d.ts"}
@@ -1,14 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import type { SpawnSyncOptions } from 'child_process';
4
- import 'zx/globals';
5
- export declare function assert(v: unknown, message: string): void;
6
- export declare function setExcludeFolder(opts: {
7
- cwd: string;
8
- pkg: string;
9
- dirName?: string;
10
- folders?: string[];
11
- }): void;
12
- export declare function spawnSync(cmd: string, opts: SpawnSyncOptions, status?: string): import("child_process").SpawnSyncReturns<string | Buffer>;
13
- export declare function toArray(v: unknown): any[];
14
- export declare function gitHeadReset(): Promise<void>;
package/lib/cli/dev.d.ts DELETED
@@ -1 +0,0 @@
1
- export default function start(): Promise<void>;
package/lib/cli/dev.js DELETED
@@ -1,62 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/cli/dev.ts
30
- var dev_exports = {};
31
- __export(dev_exports, {
32
- default: () => start
33
- });
34
- module.exports = __toCommonJS(dev_exports);
35
- var logger = __toESM(require("@umijs/utils/dist/logger"));
36
- var import_utils = require("../internal/utils");
37
- var import_path = require("path");
38
- var import_exec = require("../internal/exec");
39
- var execa = require("../internal/execa");
40
- var cwd = process.cwd();
41
- async function start() {
42
- const pkg = require((0, import_path.join)(cwd, "package.json"));
43
- process.env.MAX_APP_ENV = "development";
44
- process.env.BABEL_ENV = "development";
45
- process.env.MAX_APP_TYPE = "max";
46
- process.env.MAX_APP_KEY = pkg.appKey || "";
47
- const env = Object.create(process.env);
48
- logger.event("check pnpm version");
49
- const pnpmVersion = execa.sync("pnpm", ["--version"]).stdout;
50
- (0, import_utils.assert)(
51
- !pnpmVersion.includes("not found"),
52
- "pnpm: command not found please use npm install -g pnpm"
53
- );
54
- logger.info(`MAX_APP_ENV: ${env.MAX_APP_ENV} MAX_APP_KEY: ${env.MAX_APP_KEY} MAX_APP_TYPE: ${env.MAX_APP_TYPE}`);
55
- logger.event("max dev");
56
- await (0, import_exec.exec)("max", ["dev"], {
57
- env
58
- });
59
- logger.info(`Success MAX_APP_ENV: ${env.MAX_APP_ENV} MAX_APP_KEY: ${env.MAX_APP_KEY} MAX_APP_TYPE: ${env.MAX_APP_TYPE}`);
60
- }
61
- // Annotate the CommonJS export names for ESM import in node:
62
- 0 && (module.exports = {});
@@ -1,2 +0,0 @@
1
- import 'zx/globals';
2
- export default function update(): Promise<void>;
package/lib/cli/update.js DELETED
@@ -1,50 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/cli/update.ts
30
- var update_exports = {};
31
- __export(update_exports, {
32
- default: () => update
33
- });
34
- module.exports = __toCommonJS(update_exports);
35
- var logger = __toESM(require("@umijs/utils/dist/logger"));
36
- var import_utils = require("../internal/utils");
37
- var import_globals = require("zx/globals");
38
- async function update() {
39
- logger.event("check pnpm version");
40
- const pnpmVersion = (await $`pnpm --version`).stdout.trim();
41
- (0, import_utils.assert)(
42
- !pnpmVersion.includes("not found"),
43
- "pnpm: command not found please use npm install -g pnpm"
44
- );
45
- logger.event("update @teams-max/*");
46
- await $`pnpm up "@teams-max/*"`;
47
- logger.info(`Success update @teams-max/*`);
48
- }
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {});
@@ -1,10 +0,0 @@
1
- import 'zx/globals';
2
- declare type EnvType = 'production' | 'UAT' | 'TEST' | 'development' | 'stage';
3
- declare type StatusType = 'doing' | 'success' | 'fail';
4
- export default function ({ args, appList, environment, buildStatus }: {
5
- args: Record<string, string>;
6
- appList: string[];
7
- environment: EnvType[];
8
- buildStatus?: StatusType;
9
- }): Promise<void>;
10
- export {};
@@ -1,112 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/internal/buildNotify.ts
30
- var buildNotify_exports = {};
31
- __export(buildNotify_exports, {
32
- default: () => buildNotify_default
33
- });
34
- module.exports = __toCommonJS(buildNotify_exports);
35
- var import_umi_request = require("umi-request");
36
- var import_crypto_js = __toESM(require("crypto-js"));
37
- var import_globals = require("zx/globals");
38
- var import_datetimeFormat = __toESM(require("./datetimeFormat"));
39
- function base64Url(str) {
40
- return import_crypto_js.default.enc.Base64.stringify(str).replace(/\+/g, "-").replace(/\//g, "_");
41
- }
42
- function formatChangeLog(log) {
43
- if (!log)
44
- return "";
45
- const commits = log.split("\n").map((commit) => {
46
- const splitIndex = commit.lastIndexOf(" ");
47
- return {
48
- message: commit.slice(0, splitIndex),
49
- id: commit.slice(splitIndex + 1)
50
- };
51
- });
52
- return commits.map((commit) => `- ${commit.message} ${commit.id}`).join("\n");
53
- }
54
- var statusTextMap = { doing: "\u6B63\u5728\u6784\u5EFA\u9879\u76EE", success: "\u9879\u76EE\u6784\u5EFA\u6210\u529F", fail: "\u9879\u76EE\u6784\u5EFA\u5931\u8D25" };
55
- var request = (0, import_umi_request.extend)({
56
- headers: {
57
- "Content-Type": "application/json"
58
- }
59
- });
60
- var accessToken = "5ab4ff650f3c47d7a4c7feae3ce5715ae1a36c81e34c4452af25b96a8669b165";
61
- var secret = "81d89e48be684b94ab9acd43b49657ea7f94506b23e2400894105ecc7779735e";
62
- var url = "https://im.360teams.com/api/qfin-api/rce-app/robot/send";
63
- async function buildNotify_default({ args, appList, environment, buildStatus = "doing" }) {
64
- $.verbose = false;
65
- const omitDevEnv = environment.filter((item) => item !== "development");
66
- const changeLog = args.changeLog || args.CHANGELOG || args.change_log || args.CHANGE_LOG || "";
67
- const branch = args.branch || args.BRANCH || "";
68
- const serverEnv = args.opsEnv || args.OPSENV || args.ops_env || args.OPS_ENV || "";
69
- if (!omitDevEnv.length)
70
- return;
71
- const timestamp = new Date().getTime();
72
- const msgId = timestamp;
73
- const str = timestamp + "\n" + secret;
74
- const sign = encodeURIComponent(base64Url(import_crypto_js.default.HmacSHA256(str, secret)));
75
- let BUILD_USER = args.buildUser || args.build_user || args.BUILD_USER || (await $`git config user.name`).stdout.trim();
76
- const changeLogText = formatChangeLog(changeLog);
77
- let content = `${BUILD_USER} ${statusTextMap[buildStatus]}:
78
- `;
79
- content += `APP: [${appList.join(", ")}]
80
- `;
81
- if (branch) {
82
- content += `BRANCH: ${branch}
83
- `;
84
- }
85
- content += `ENV: [${omitDevEnv.join(", ")}]
86
- `;
87
- if (serverEnv) {
88
- content += `SERVER: ${serverEnv}
89
- `;
90
- }
91
- content += `TIME: ${(0, import_datetimeFormat.default)(timestamp, "yyyy-MM-dd hh:mm:ss:S")}
92
- `;
93
- if (buildStatus === "doing") {
94
- content += `LOG: ${changeLogText ? "\n" : ""}`;
95
- content += `${changeLogText ? changeLogText : "no change"}
96
- `;
97
- }
98
- request.post(`${url}?access_token=${accessToken}&timestamp=${timestamp}&sign=${sign}`, {
99
- data: {
100
- msgId,
101
- msgtype: "text",
102
- text: { content },
103
- at: {
104
- isAtAll: false,
105
- userIds: ["zhangxiaoyang-jk", "liuxiangdong1-jk"]
106
- }
107
- }
108
- });
109
- $.verbose = true;
110
- }
111
- // Annotate the CommonJS export names for ESM import in node:
112
- 0 && (module.exports = {});
@@ -1 +0,0 @@
1
- {"name":"cross-spawn","main":"index.js","author":"André Cruz <andre@moxy.studio>","license":"MIT","types":"index.d.ts"}
@@ -1,9 +0,0 @@
1
- /**
2
- * 日期时间格式化
3
- * @param {Date | String | Number} value 时间、类时间对象
4
- * @param {String} format 格式:yyyy-MM-dd hh:mm:ss:S
5
- * @param {Boolean} isCoerce 是否对类时间格式强制转换
6
- * @returns {String} 返回格式化后的值
7
- */
8
- declare function datetimeFormat(value: any, format: string, isCoerce?: boolean): string;
9
- export default datetimeFormat;
@@ -1 +0,0 @@
1
- export declare const exec: (command: any, args: any, opts: any) => Promise<unknown>;
@@ -1,60 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/internal/exec.ts
30
- var exec_exports = {};
31
- __export(exec_exports, {
32
- exec: () => exec
33
- });
34
- module.exports = __toCommonJS(exec_exports);
35
- var import_cross_spawn = __toESM(require("@umijs/utils/compiled/cross-spawn"));
36
- var exec = (command, args, opts) => {
37
- return new Promise((resolve, reject) => {
38
- const child = (0, import_cross_spawn.default)(command, args, {
39
- shell: true,
40
- stdio: "inherit",
41
- env: process.env,
42
- ...opts
43
- });
44
- child.once("error", (err) => {
45
- console.log(err);
46
- reject(err);
47
- });
48
- child.once("close", (code) => {
49
- if (code === 1) {
50
- process.exit(1);
51
- } else {
52
- resolve();
53
- }
54
- });
55
- });
56
- };
57
- // Annotate the CommonJS export names for ESM import in node:
58
- 0 && (module.exports = {
59
- exec
60
- });
@@ -1 +0,0 @@
1
- {"name":"execa","main":"index.js","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","types":"index.d.ts"}
@@ -1 +0,0 @@
1
- {"name":"merge-stream","main":"index.js","author":"Stephen Sugden <me@stephensugden.com>","license":"MIT","types":"index.d.ts"}
@@ -1,14 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import type { SpawnSyncOptions } from 'child_process';
4
- import 'zx/globals';
5
- export declare function assert(v: unknown, message: string): void;
6
- export declare function setExcludeFolder(opts: {
7
- cwd: string;
8
- pkg: string;
9
- dirName?: string;
10
- folders?: string[];
11
- }): void;
12
- export declare function spawnSync(cmd: string, opts: SpawnSyncOptions, status?: string): import("child_process").SpawnSyncReturns<string | Buffer>;
13
- export declare function toArray(v: unknown): any[];
14
- export declare function gitHeadReset(): Promise<void>;