@pisell/common 0.0.19 → 1.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 (279) hide show
  1. package/.fatherrc.ts +7 -0
  2. package/CHANGELOG.md +7 -0
  3. package/README.md +1 -38
  4. package/{lib/components → es}/button/index.d.ts +5 -4
  5. package/es/button/index.d.ts.map +1 -0
  6. package/es/button/index.js +33 -0
  7. package/{es/components → lib}/button/index.d.ts +5 -4
  8. package/lib/button/index.d.ts.map +1 -0
  9. package/lib/{components/avatar → button}/index.js +14 -11
  10. package/package.json +20 -77
  11. package/src/button/index.md +17 -0
  12. package/src/button/index.tsx +38 -0
  13. package/tsconfig.json +14 -0
  14. package/LICENSE +0 -21
  15. package/es/bin/pisell.js +0 -2
  16. package/es/business-components/colorInput/index.d.ts +0 -21
  17. package/es/business-components/colorInput/index.js +0 -43
  18. package/es/business-components/colorInput/index.less +0 -10
  19. package/es/business-components/index.d.ts +0 -11
  20. package/es/business-components/index.js +0 -7
  21. package/es/business-components/rechargeOption/index.d.ts +0 -36
  22. package/es/business-components/rechargeOption/index.js +0 -132
  23. package/es/business-components/rechargeOption/index.less +0 -0
  24. package/es/business-components/selectTag/index.d.ts +0 -25
  25. package/es/business-components/selectTag/index.js +0 -179
  26. package/es/business-components/selectTag/index.less +0 -22
  27. package/es/business-components/sortModal/index.d.ts +0 -30
  28. package/es/business-components/sortModal/index.js +0 -85
  29. package/es/business-components/sortModal/index.less +0 -29
  30. package/es/business-components/statistics/index.d.ts +0 -12
  31. package/es/business-components/statistics/index.js +0 -38
  32. package/es/business-components/statistics/index.less +0 -64
  33. package/es/business-components/tagModal/index.d.ts +0 -17
  34. package/es/business-components/tagModal/index.js +0 -58
  35. package/es/business-hooks/index.d.ts +0 -2
  36. package/es/business-hooks/index.js +0 -2
  37. package/es/business-hooks/useModal/index.d.ts +0 -31
  38. package/es/business-hooks/useModal/index.js +0 -91
  39. package/es/business-hooks/useModal/index.less +0 -0
  40. package/es/business-hooks/useTagModal/index.d.ts +0 -17
  41. package/es/business-hooks/useTagModal/index.js +0 -47
  42. package/es/components/ColorPicker/index.d.ts +0 -22
  43. package/es/components/ColorPicker/index.js +0 -51
  44. package/es/components/ColorPicker/index.less +0 -17
  45. package/es/components/DragSort/index.d.ts +0 -2
  46. package/es/components/DragSort/index.js +0 -68
  47. package/es/components/EditorPreview/index.d.ts +0 -5
  48. package/es/components/EditorPreview/index.js +0 -14
  49. package/es/components/EditorPreview/index.less +0 -81
  50. package/es/components/Iconfont/index.d.ts +0 -6
  51. package/es/components/Iconfont/index.js +0 -29
  52. package/es/components/Iconfont/index.less +0 -0
  53. package/es/components/agreement/Detail/index.d.ts +0 -3
  54. package/es/components/agreement/Detail/index.js +0 -77
  55. package/es/components/agreement/Detail/serve.d.ts +0 -1
  56. package/es/components/agreement/Detail/serve.js +0 -6
  57. package/es/components/agreement/index.d.ts +0 -11
  58. package/es/components/agreement/index.js +0 -45
  59. package/es/components/agreement/index.less +0 -20
  60. package/es/components/avatar/index.d.ts +0 -13
  61. package/es/components/avatar/index.js +0 -25
  62. package/es/components/button/index.js +0 -36
  63. package/es/components/card/index.d.ts +0 -5
  64. package/es/components/card/index.js +0 -16
  65. package/es/components/card/index.less +0 -9
  66. package/es/components/checkbox/index.d.ts +0 -20
  67. package/es/components/checkbox/index.js +0 -43
  68. package/es/components/configProvider/index.d.ts +0 -113
  69. package/es/components/configProvider/index.js +0 -114
  70. package/es/components/datePicker/index.d.ts +0 -9
  71. package/es/components/datePicker/index.js +0 -17
  72. package/es/components/index.d.ts +0 -30
  73. package/es/components/index.js +0 -16
  74. package/es/components/input/index.d.ts +0 -35
  75. package/es/components/input/index.js +0 -97
  76. package/es/components/inputNumber/index.d.ts +0 -9
  77. package/es/components/inputNumber/index.js +0 -17
  78. package/es/components/pagination/index.d.ts +0 -10
  79. package/es/components/pagination/index.js +0 -18
  80. package/es/components/radio/index.d.ts +0 -13
  81. package/es/components/radio/index.js +0 -28
  82. package/es/components/select/index.d.ts +0 -9
  83. package/es/components/select/index.js +0 -17
  84. package/es/components/switch/index.d.ts +0 -10
  85. package/es/components/switch/index.js +0 -18
  86. package/es/config/index.d.ts +0 -30
  87. package/es/config/index.js +0 -18
  88. package/es/config/request.d.ts +0 -7
  89. package/es/config/request.js +0 -67
  90. package/es/config/utils.d.ts +0 -0
  91. package/es/config/utils.js +0 -0
  92. package/es/hooks/index.d.ts +0 -8
  93. package/es/hooks/index.js +0 -8
  94. package/es/hooks/useCountDown/index.d.ts +0 -10
  95. package/es/hooks/useCountDown/index.js +0 -48
  96. package/es/hooks/useDocumentScroll/index.d.ts +0 -8
  97. package/es/hooks/useDocumentScroll/index.js +0 -41
  98. package/es/hooks/useDocumentScroll/index.less +0 -0
  99. package/es/hooks/useMousemove/index.d.ts +0 -8
  100. package/es/hooks/useMousemove/index.js +0 -61
  101. package/es/hooks/useResponsive/index.d.ts +0 -2
  102. package/es/hooks/useResponsive/index.js +0 -29
  103. package/es/hooks/useResponsive/index.less +0 -0
  104. package/es/hooks/useSize/index.d.ts +0 -2
  105. package/es/hooks/useSize/index.js +0 -27
  106. package/es/hooks/useSize/index.less +0 -0
  107. package/es/hooks/useStateMulti/index.d.ts +0 -2
  108. package/es/hooks/useStateMulti/index.js +0 -29
  109. package/es/hooks/useStateWithCb/index.d.ts +0 -2
  110. package/es/hooks/useStateWithCb/index.js +0 -42
  111. package/es/hooks/useTable/index.d.ts +0 -12
  112. package/es/hooks/useTable/index.js +0 -74
  113. package/es/hooks/useTable/index.less +0 -0
  114. package/es/hooks/useTableModal/index.d.ts +0 -12
  115. package/es/hooks/useTableModal/index.js +0 -25
  116. package/es/hooks/useTableModal/index.less +0 -0
  117. package/es/hooks/useUrlState/index.d.ts +0 -2
  118. package/es/hooks/useUrlState/index.js +0 -56
  119. package/es/hooks/useWebSocket/index.d.ts +0 -13
  120. package/es/hooks/useWebSocket/index.js +0 -121
  121. package/es/index.d.ts +0 -4
  122. package/es/index.js +0 -4
  123. package/es/locales/en-US.d.ts +0 -11
  124. package/es/locales/en-US.js +0 -10
  125. package/es/locales/index.d.ts +0 -1
  126. package/es/locales/index.js +0 -23
  127. package/es/locales/zh-CN.d.ts +0 -11
  128. package/es/locales/zh-CN.js +0 -10
  129. package/es/locales/zh-TW.d.ts +0 -11
  130. package/es/locales/zh-TW.js +0 -10
  131. package/es/script/constants/index.js +0 -8
  132. package/es/script/deploy.js +0 -47
  133. package/es/script/index.js +0 -40
  134. package/es/script/package.json +0 -4
  135. package/es/script/release/index.js +0 -161
  136. package/es/script/release/release.js +0 -163
  137. package/es/script/uploadCode/index.js +0 -278
  138. package/es/script/uploadCode/uploadCode.js +0 -401
  139. package/es/script/utils/index.js +0 -321
  140. package/es/utils/index.d.ts +0 -3
  141. package/es/utils/index.js +0 -3
  142. package/es/utils/otherUtils.d.ts +0 -8
  143. package/es/utils/otherUtils.js +0 -12
  144. package/es/utils/storage.d.ts +0 -30
  145. package/es/utils/storage.js +0 -70
  146. package/es/utils/typeUtils.d.ts +0 -42
  147. package/es/utils/typeUtils.js +0 -86
  148. package/lib/bin/pisell.js +0 -26
  149. package/lib/business-components/colorInput/index.d.ts +0 -21
  150. package/lib/business-components/colorInput/index.js +0 -70
  151. package/lib/business-components/colorInput/index.less +0 -10
  152. package/lib/business-components/index.d.ts +0 -11
  153. package/lib/business-components/index.js +0 -54
  154. package/lib/business-components/rechargeOption/index.d.ts +0 -36
  155. package/lib/business-components/rechargeOption/index.js +0 -112
  156. package/lib/business-components/rechargeOption/index.less +0 -0
  157. package/lib/business-components/selectTag/index.d.ts +0 -25
  158. package/lib/business-components/selectTag/index.js +0 -181
  159. package/lib/business-components/selectTag/index.less +0 -22
  160. package/lib/business-components/sortModal/index.d.ts +0 -30
  161. package/lib/business-components/sortModal/index.js +0 -100
  162. package/lib/business-components/sortModal/index.less +0 -29
  163. package/lib/business-components/statistics/index.d.ts +0 -12
  164. package/lib/business-components/statistics/index.js +0 -63
  165. package/lib/business-components/statistics/index.less +0 -64
  166. package/lib/business-components/tagModal/index.d.ts +0 -17
  167. package/lib/business-components/tagModal/index.js +0 -66
  168. package/lib/business-hooks/index.d.ts +0 -2
  169. package/lib/business-hooks/index.js +0 -42
  170. package/lib/business-hooks/useModal/index.d.ts +0 -31
  171. package/lib/business-hooks/useModal/index.js +0 -68
  172. package/lib/business-hooks/useModal/index.less +0 -0
  173. package/lib/business-hooks/useTagModal/index.d.ts +0 -17
  174. package/lib/business-hooks/useTagModal/index.js +0 -61
  175. package/lib/components/ColorPicker/index.d.ts +0 -22
  176. package/lib/components/ColorPicker/index.js +0 -80
  177. package/lib/components/ColorPicker/index.less +0 -17
  178. package/lib/components/DragSort/index.d.ts +0 -2
  179. package/lib/components/DragSort/index.js +0 -101
  180. package/lib/components/EditorPreview/index.d.ts +0 -5
  181. package/lib/components/EditorPreview/index.js +0 -37
  182. package/lib/components/EditorPreview/index.less +0 -81
  183. package/lib/components/Iconfont/index.d.ts +0 -6
  184. package/lib/components/Iconfont/index.js +0 -48
  185. package/lib/components/Iconfont/index.less +0 -0
  186. package/lib/components/agreement/Detail/index.d.ts +0 -3
  187. package/lib/components/agreement/Detail/index.js +0 -86
  188. package/lib/components/agreement/Detail/serve.d.ts +0 -1
  189. package/lib/components/agreement/Detail/serve.js +0 -30
  190. package/lib/components/agreement/index.d.ts +0 -11
  191. package/lib/components/agreement/index.js +0 -82
  192. package/lib/components/agreement/index.less +0 -20
  193. package/lib/components/avatar/index.d.ts +0 -13
  194. package/lib/components/button/index.js +0 -36
  195. package/lib/components/card/index.d.ts +0 -5
  196. package/lib/components/card/index.js +0 -42
  197. package/lib/components/card/index.less +0 -9
  198. package/lib/components/checkbox/index.d.ts +0 -20
  199. package/lib/components/checkbox/index.js +0 -36
  200. package/lib/components/configProvider/index.d.ts +0 -113
  201. package/lib/components/configProvider/index.js +0 -159
  202. package/lib/components/datePicker/index.d.ts +0 -9
  203. package/lib/components/datePicker/index.js +0 -31
  204. package/lib/components/index.d.ts +0 -30
  205. package/lib/components/index.js +0 -83
  206. package/lib/components/input/index.d.ts +0 -35
  207. package/lib/components/input/index.js +0 -53
  208. package/lib/components/inputNumber/index.d.ts +0 -9
  209. package/lib/components/inputNumber/index.js +0 -31
  210. package/lib/components/pagination/index.d.ts +0 -10
  211. package/lib/components/pagination/index.js +0 -42
  212. package/lib/components/radio/index.d.ts +0 -13
  213. package/lib/components/radio/index.js +0 -36
  214. package/lib/components/select/index.d.ts +0 -9
  215. package/lib/components/select/index.js +0 -36
  216. package/lib/components/switch/index.d.ts +0 -10
  217. package/lib/components/switch/index.js +0 -42
  218. package/lib/config/index.d.ts +0 -30
  219. package/lib/config/index.js +0 -39
  220. package/lib/config/request.d.ts +0 -7
  221. package/lib/config/request.js +0 -76
  222. package/lib/config/utils.d.ts +0 -0
  223. package/lib/config/utils.js +0 -0
  224. package/lib/hooks/index.d.ts +0 -8
  225. package/lib/hooks/index.js +0 -57
  226. package/lib/hooks/useCountDown/index.d.ts +0 -10
  227. package/lib/hooks/useCountDown/index.js +0 -57
  228. package/lib/hooks/useDocumentScroll/index.d.ts +0 -8
  229. package/lib/hooks/useDocumentScroll/index.js +0 -54
  230. package/lib/hooks/useDocumentScroll/index.less +0 -0
  231. package/lib/hooks/useMousemove/index.d.ts +0 -8
  232. package/lib/hooks/useMousemove/index.js +0 -70
  233. package/lib/hooks/useResponsive/index.d.ts +0 -2
  234. package/lib/hooks/useResponsive/index.js +0 -47
  235. package/lib/hooks/useResponsive/index.less +0 -0
  236. package/lib/hooks/useSize/index.d.ts +0 -2
  237. package/lib/hooks/useSize/index.js +0 -45
  238. package/lib/hooks/useSize/index.less +0 -0
  239. package/lib/hooks/useStateMulti/index.d.ts +0 -2
  240. package/lib/hooks/useStateMulti/index.js +0 -43
  241. package/lib/hooks/useStateWithCb/index.d.ts +0 -2
  242. package/lib/hooks/useStateWithCb/index.js +0 -53
  243. package/lib/hooks/useTable/index.d.ts +0 -12
  244. package/lib/hooks/useTable/index.js +0 -75
  245. package/lib/hooks/useTable/index.less +0 -0
  246. package/lib/hooks/useTableModal/index.d.ts +0 -12
  247. package/lib/hooks/useTableModal/index.js +0 -43
  248. package/lib/hooks/useTableModal/index.less +0 -0
  249. package/lib/hooks/useUrlState/index.d.ts +0 -2
  250. package/lib/hooks/useUrlState/index.js +0 -59
  251. package/lib/hooks/useWebSocket/index.d.ts +0 -13
  252. package/lib/hooks/useWebSocket/index.js +0 -91
  253. package/lib/index.d.ts +0 -4
  254. package/lib/index.js +0 -22
  255. package/lib/locales/en-US.d.ts +0 -11
  256. package/lib/locales/en-US.js +0 -36
  257. package/lib/locales/index.d.ts +0 -1
  258. package/lib/locales/index.js +0 -59
  259. package/lib/locales/zh-CN.d.ts +0 -11
  260. package/lib/locales/zh-CN.js +0 -36
  261. package/lib/locales/zh-TW.d.ts +0 -11
  262. package/lib/locales/zh-TW.js +0 -36
  263. package/lib/script/constants/index.js +0 -35
  264. package/lib/script/deploy.js +0 -61
  265. package/lib/script/index.js +0 -61
  266. package/lib/script/package.json +0 -4
  267. package/lib/script/release/index.js +0 -116
  268. package/lib/script/release/release.js +0 -89
  269. package/lib/script/uploadCode/index.js +0 -202
  270. package/lib/script/uploadCode/uploadCode.js +0 -208
  271. package/lib/script/utils/index.js +0 -248
  272. package/lib/utils/index.d.ts +0 -3
  273. package/lib/utils/index.js +0 -21
  274. package/lib/utils/otherUtils.d.ts +0 -8
  275. package/lib/utils/otherUtils.js +0 -31
  276. package/lib/utils/storage.d.ts +0 -30
  277. package/lib/utils/storage.js +0 -63
  278. package/lib/utils/typeUtils.d.ts +0 -42
  279. package/lib/utils/typeUtils.js +0 -75
@@ -1,401 +0,0 @@
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;