@pisell/common 0.0.21-bata → 1.0.2

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 (247) hide show
  1. package/.fatherrc.ts +7 -0
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +1 -38
  4. package/es/bin/pisell.js +0 -0
  5. package/es/index.d.ts +2 -4
  6. package/es/index.js +1 -4
  7. package/es/script/utils/index.js +1 -1
  8. package/lib/index.d.ts +2 -4
  9. package/lib/index.js +8 -5
  10. package/lib/script/deploy.js +0 -2
  11. package/lib/script/release/index.js +0 -2
  12. package/lib/script/release/release.js +0 -2
  13. package/lib/script/uploadCode/index.js +0 -2
  14. package/lib/script/uploadCode/uploadCode.js +0 -2
  15. package/lib/script/utils/index.js +1 -1
  16. package/package.json +23 -74
  17. package/src/bin/pisell.js +3 -0
  18. package/src/index.ts +1 -0
  19. package/src/script/constants/index.js +14 -0
  20. package/src/script/deploy.js +29 -0
  21. package/src/script/index.js +45 -0
  22. package/src/script/package.json +4 -0
  23. package/src/script/release/index.js +119 -0
  24. package/src/script/release/release.js +84 -0
  25. package/src/script/uploadCode/index.js +244 -0
  26. package/src/script/uploadCode/uploadCode.js +217 -0
  27. package/src/script/utils/index.js +275 -0
  28. package/tsconfig.json +14 -0
  29. package/LICENSE +0 -21
  30. package/es/business-components/colorInput/index.d.ts +0 -21
  31. package/es/business-components/colorInput/index.js +0 -43
  32. package/es/business-components/colorInput/index.less +0 -10
  33. package/es/business-components/index.d.ts +0 -11
  34. package/es/business-components/index.js +0 -7
  35. package/es/business-components/rechargeOption/index.d.ts +0 -36
  36. package/es/business-components/rechargeOption/index.js +0 -132
  37. package/es/business-components/rechargeOption/index.less +0 -0
  38. package/es/business-components/selectTag/index.d.ts +0 -25
  39. package/es/business-components/selectTag/index.js +0 -179
  40. package/es/business-components/selectTag/index.less +0 -22
  41. package/es/business-components/sortModal/index.d.ts +0 -30
  42. package/es/business-components/sortModal/index.js +0 -85
  43. package/es/business-components/sortModal/index.less +0 -29
  44. package/es/business-components/statistics/index.d.ts +0 -12
  45. package/es/business-components/statistics/index.js +0 -38
  46. package/es/business-components/statistics/index.less +0 -64
  47. package/es/business-components/tagModal/index.d.ts +0 -17
  48. package/es/business-components/tagModal/index.js +0 -58
  49. package/es/business-hooks/index.d.ts +0 -2
  50. package/es/business-hooks/index.js +0 -2
  51. package/es/business-hooks/useModal/index.d.ts +0 -31
  52. package/es/business-hooks/useModal/index.js +0 -91
  53. package/es/business-hooks/useModal/index.less +0 -0
  54. package/es/business-hooks/useTagModal/index.d.ts +0 -17
  55. package/es/business-hooks/useTagModal/index.js +0 -47
  56. package/es/components/ColorPicker/index.d.ts +0 -22
  57. package/es/components/ColorPicker/index.js +0 -51
  58. package/es/components/ColorPicker/index.less +0 -17
  59. package/es/components/DragSort/index.js +0 -68
  60. package/es/components/EditorPreview/index.js +0 -14
  61. package/es/components/EditorPreview/index.less +0 -81
  62. package/es/components/Iconfont/index.d.ts +0 -6
  63. package/es/components/Iconfont/index.js +0 -29
  64. package/es/components/Iconfont/index.less +0 -0
  65. package/es/components/agreement/Detail/index.js +0 -77
  66. package/es/components/agreement/Detail/serve.d.ts +0 -1
  67. package/es/components/agreement/Detail/serve.js +0 -6
  68. package/es/components/agreement/index.d.ts +0 -11
  69. package/es/components/agreement/index.js +0 -45
  70. package/es/components/agreement/index.less +0 -20
  71. package/es/components/avatar/index.d.ts +0 -13
  72. package/es/components/avatar/index.js +0 -25
  73. package/es/components/button/index.js +0 -36
  74. package/es/components/card/index.js +0 -16
  75. package/es/components/card/index.less +0 -9
  76. package/es/components/checkbox/index.js +0 -43
  77. package/es/components/configProvider/index.d.ts +0 -113
  78. package/es/components/configProvider/index.js +0 -114
  79. package/es/components/datePicker/index.js +0 -17
  80. package/es/components/index.js +0 -16
  81. package/es/components/input/index.js +0 -97
  82. package/es/components/inputNumber/index.js +0 -17
  83. package/es/components/pagination/index.d.ts +0 -10
  84. package/es/components/pagination/index.js +0 -18
  85. package/es/components/radio/index.js +0 -28
  86. package/es/components/select/index.js +0 -17
  87. package/es/components/switch/index.d.ts +0 -10
  88. package/es/components/switch/index.js +0 -18
  89. package/es/config/index.js +0 -18
  90. package/es/config/request.d.ts +0 -7
  91. package/es/config/request.js +0 -67
  92. package/es/config/utils.d.ts +0 -0
  93. package/es/config/utils.js +0 -0
  94. package/es/hooks/index.d.ts +0 -8
  95. package/es/hooks/index.js +0 -8
  96. package/es/hooks/useCountDown/index.d.ts +0 -10
  97. package/es/hooks/useCountDown/index.js +0 -48
  98. package/es/hooks/useDocumentScroll/index.d.ts +0 -8
  99. package/es/hooks/useDocumentScroll/index.js +0 -41
  100. package/es/hooks/useDocumentScroll/index.less +0 -0
  101. package/es/hooks/useMousemove/index.d.ts +0 -8
  102. package/es/hooks/useMousemove/index.js +0 -61
  103. package/es/hooks/useResponsive/index.d.ts +0 -2
  104. package/es/hooks/useResponsive/index.js +0 -29
  105. package/es/hooks/useResponsive/index.less +0 -0
  106. package/es/hooks/useSize/index.d.ts +0 -2
  107. package/es/hooks/useSize/index.js +0 -27
  108. package/es/hooks/useSize/index.less +0 -0
  109. package/es/hooks/useStateMulti/index.d.ts +0 -2
  110. package/es/hooks/useStateMulti/index.js +0 -29
  111. package/es/hooks/useStateWithCb/index.d.ts +0 -2
  112. package/es/hooks/useStateWithCb/index.js +0 -42
  113. package/es/hooks/useTable/index.d.ts +0 -12
  114. package/es/hooks/useTable/index.js +0 -74
  115. package/es/hooks/useTable/index.less +0 -0
  116. package/es/hooks/useTableModal/index.d.ts +0 -12
  117. package/es/hooks/useTableModal/index.js +0 -25
  118. package/es/hooks/useTableModal/index.less +0 -0
  119. package/es/hooks/useUrlState/index.d.ts +0 -2
  120. package/es/hooks/useUrlState/index.js +0 -56
  121. package/es/hooks/useWebSocket/index.d.ts +0 -13
  122. package/es/hooks/useWebSocket/index.js +0 -121
  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/utils/index.d.ts +0 -3
  132. package/es/utils/index.js +0 -3
  133. package/es/utils/otherUtils.d.ts +0 -8
  134. package/es/utils/otherUtils.js +0 -12
  135. package/es/utils/storage.d.ts +0 -30
  136. package/es/utils/storage.js +0 -70
  137. package/es/utils/typeUtils.d.ts +0 -42
  138. package/es/utils/typeUtils.js +0 -86
  139. package/lib/business-components/colorInput/index.d.ts +0 -21
  140. package/lib/business-components/colorInput/index.js +0 -70
  141. package/lib/business-components/colorInput/index.less +0 -10
  142. package/lib/business-components/index.d.ts +0 -11
  143. package/lib/business-components/index.js +0 -54
  144. package/lib/business-components/rechargeOption/index.d.ts +0 -36
  145. package/lib/business-components/rechargeOption/index.js +0 -112
  146. package/lib/business-components/rechargeOption/index.less +0 -0
  147. package/lib/business-components/selectTag/index.d.ts +0 -25
  148. package/lib/business-components/selectTag/index.js +0 -181
  149. package/lib/business-components/selectTag/index.less +0 -22
  150. package/lib/business-components/sortModal/index.d.ts +0 -30
  151. package/lib/business-components/sortModal/index.js +0 -100
  152. package/lib/business-components/sortModal/index.less +0 -29
  153. package/lib/business-components/statistics/index.d.ts +0 -12
  154. package/lib/business-components/statistics/index.js +0 -63
  155. package/lib/business-components/statistics/index.less +0 -64
  156. package/lib/business-components/tagModal/index.d.ts +0 -17
  157. package/lib/business-components/tagModal/index.js +0 -66
  158. package/lib/business-hooks/index.d.ts +0 -2
  159. package/lib/business-hooks/index.js +0 -42
  160. package/lib/business-hooks/useModal/index.d.ts +0 -31
  161. package/lib/business-hooks/useModal/index.js +0 -68
  162. package/lib/business-hooks/useModal/index.less +0 -0
  163. package/lib/business-hooks/useTagModal/index.d.ts +0 -17
  164. package/lib/business-hooks/useTagModal/index.js +0 -61
  165. package/lib/components/ColorPicker/index.d.ts +0 -22
  166. package/lib/components/ColorPicker/index.js +0 -80
  167. package/lib/components/ColorPicker/index.less +0 -17
  168. package/lib/components/DragSort/index.js +0 -101
  169. package/lib/components/EditorPreview/index.js +0 -37
  170. package/lib/components/EditorPreview/index.less +0 -81
  171. package/lib/components/Iconfont/index.d.ts +0 -6
  172. package/lib/components/Iconfont/index.js +0 -48
  173. package/lib/components/Iconfont/index.less +0 -0
  174. package/lib/components/agreement/Detail/index.js +0 -86
  175. package/lib/components/agreement/Detail/serve.d.ts +0 -1
  176. package/lib/components/agreement/Detail/serve.js +0 -30
  177. package/lib/components/agreement/index.d.ts +0 -11
  178. package/lib/components/agreement/index.js +0 -82
  179. package/lib/components/agreement/index.less +0 -20
  180. package/lib/components/avatar/index.d.ts +0 -13
  181. package/lib/components/avatar/index.js +0 -42
  182. package/lib/components/button/index.js +0 -36
  183. package/lib/components/card/index.js +0 -42
  184. package/lib/components/card/index.less +0 -9
  185. package/lib/components/checkbox/index.js +0 -36
  186. package/lib/components/configProvider/index.d.ts +0 -113
  187. package/lib/components/configProvider/index.js +0 -159
  188. package/lib/components/datePicker/index.js +0 -31
  189. package/lib/components/index.js +0 -83
  190. package/lib/components/input/index.js +0 -53
  191. package/lib/components/inputNumber/index.js +0 -31
  192. package/lib/components/pagination/index.d.ts +0 -10
  193. package/lib/components/pagination/index.js +0 -42
  194. package/lib/components/radio/index.js +0 -36
  195. package/lib/components/select/index.js +0 -36
  196. package/lib/components/switch/index.d.ts +0 -10
  197. package/lib/components/switch/index.js +0 -42
  198. package/lib/config/index.js +0 -39
  199. package/lib/config/request.d.ts +0 -7
  200. package/lib/config/request.js +0 -76
  201. package/lib/config/utils.d.ts +0 -0
  202. package/lib/config/utils.js +0 -0
  203. package/lib/hooks/index.d.ts +0 -8
  204. package/lib/hooks/index.js +0 -57
  205. package/lib/hooks/useCountDown/index.d.ts +0 -10
  206. package/lib/hooks/useCountDown/index.js +0 -57
  207. package/lib/hooks/useDocumentScroll/index.d.ts +0 -8
  208. package/lib/hooks/useDocumentScroll/index.js +0 -54
  209. package/lib/hooks/useDocumentScroll/index.less +0 -0
  210. package/lib/hooks/useMousemove/index.d.ts +0 -8
  211. package/lib/hooks/useMousemove/index.js +0 -70
  212. package/lib/hooks/useResponsive/index.d.ts +0 -2
  213. package/lib/hooks/useResponsive/index.js +0 -47
  214. package/lib/hooks/useResponsive/index.less +0 -0
  215. package/lib/hooks/useSize/index.d.ts +0 -2
  216. package/lib/hooks/useSize/index.js +0 -45
  217. package/lib/hooks/useSize/index.less +0 -0
  218. package/lib/hooks/useStateMulti/index.d.ts +0 -2
  219. package/lib/hooks/useStateMulti/index.js +0 -43
  220. package/lib/hooks/useStateWithCb/index.d.ts +0 -2
  221. package/lib/hooks/useStateWithCb/index.js +0 -53
  222. package/lib/hooks/useTable/index.d.ts +0 -12
  223. package/lib/hooks/useTable/index.js +0 -75
  224. package/lib/hooks/useTable/index.less +0 -0
  225. package/lib/hooks/useTableModal/index.d.ts +0 -12
  226. package/lib/hooks/useTableModal/index.js +0 -43
  227. package/lib/hooks/useTableModal/index.less +0 -0
  228. package/lib/hooks/useUrlState/index.d.ts +0 -2
  229. package/lib/hooks/useUrlState/index.js +0 -59
  230. package/lib/hooks/useWebSocket/index.d.ts +0 -13
  231. package/lib/hooks/useWebSocket/index.js +0 -91
  232. package/lib/locales/en-US.d.ts +0 -11
  233. package/lib/locales/en-US.js +0 -36
  234. package/lib/locales/index.d.ts +0 -1
  235. package/lib/locales/index.js +0 -59
  236. package/lib/locales/zh-CN.d.ts +0 -11
  237. package/lib/locales/zh-CN.js +0 -36
  238. package/lib/locales/zh-TW.d.ts +0 -11
  239. package/lib/locales/zh-TW.js +0 -36
  240. package/lib/utils/index.d.ts +0 -3
  241. package/lib/utils/index.js +0 -21
  242. package/lib/utils/otherUtils.d.ts +0 -8
  243. package/lib/utils/otherUtils.js +0 -31
  244. package/lib/utils/storage.d.ts +0 -30
  245. package/lib/utils/storage.js +0 -63
  246. package/lib/utils/typeUtils.d.ts +0 -42
  247. package/lib/utils/typeUtils.js +0 -75
package/.fatherrc.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'father';
2
+
3
+ export default defineConfig({
4
+ // more father config: https://github.com/umijs/father/blob/master/docs/config.md
5
+ esm: { output: 'es' },
6
+ cjs: { output: 'lib' },
7
+ });
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # @pisell/common
2
+
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @pisell/utils@1.0.2
9
+
10
+ ## 1.0.1
11
+
12
+ ### Patch Changes
13
+
14
+ - 测试更新包
package/README.md CHANGED
@@ -1,40 +1,3 @@
1
1
  # @pisell/common
2
2
 
3
- [![NPM version](https://img.shields.io/npm/v/@pisell/common.svg?style=flat)](https://npmjs.org/package/@pisell/common)
4
- [![NPM downloads](http://img.shields.io/npm/dm/@pisell/common.svg?style=flat)](https://npmjs.org/package/@pisell/common)
5
-
6
- pisell
7
-
8
- ## Usage
9
-
10
- TODO
11
-
12
- ## Options
13
-
14
- TODO
15
-
16
- ## Development
17
-
18
- ```bash
19
- # install dependencies
20
- $ cnpm install
21
-
22
- # develop library by docs demo
23
- $ cnpm start
24
-
25
- # build library source code
26
- $ cnpm run build
27
-
28
- # build library source code in watch mode
29
- $ cnpm run build:watch
30
-
31
- # build docs
32
- $ cnpm run docs:build
33
-
34
- # check your project for potential problems
35
- $ cnpm run doctor
36
- ```
37
-
38
- ## LICENSE
39
-
40
- MIT
3
+ pisell使用的通用组件库
package/es/bin/pisell.js CHANGED
File without changes
package/es/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- export * from './business-components';
2
- export * from './business-hooks';
3
- export * from './components';
4
- export * from './hooks';
1
+ declare const _default: {};
2
+ export default _default;
package/es/index.js CHANGED
@@ -1,4 +1 @@
1
- export * from "./business-components";
2
- export * from "./business-hooks";
3
- export * from "./components";
4
- export * from "./hooks";
1
+ export default {};
@@ -83,7 +83,7 @@ var getServerConfig = /*#__PURE__*/function () {
83
83
  break;
84
84
  }
85
85
  _context3.next = 3;
86
- return fs.readJson('../../lm_config.json');
86
+ return fs.readJson('../../../lm_config.json');
87
87
  case 3:
88
88
  return _context3.abrupt("return", _context3.sent);
89
89
  case 4:
package/lib/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- export * from './business-components';
2
- export * from './business-hooks';
3
- export * from './components';
4
- export * from './hooks';
1
+ declare const _default: {};
2
+ export default _default;
package/lib/index.js CHANGED
@@ -2,6 +2,10 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
5
9
  var __copyProps = (to, from, except, desc) => {
6
10
  if (from && typeof from === "object" || typeof from === "function") {
7
11
  for (let key of __getOwnPropNames(from))
@@ -10,13 +14,12 @@ var __copyProps = (to, from, except, desc) => {
10
14
  }
11
15
  return to;
12
16
  };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
18
 
16
19
  // src/index.ts
17
20
  var src_exports = {};
21
+ __export(src_exports, {
22
+ default: () => src_default
23
+ });
18
24
  module.exports = __toCommonJS(src_exports);
19
- __reExport(src_exports, require("./business-components"), module.exports);
20
- __reExport(src_exports, require("./business-hooks"), module.exports);
21
- __reExport(src_exports, require("./components"), module.exports);
22
- __reExport(src_exports, require("./hooks"), module.exports);
25
+ var src_default = {};
@@ -57,5 +57,3 @@ var deploy = async () => {
57
57
  return actions[res.action]();
58
58
  };
59
59
  var deploy_default = deploy;
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {});
@@ -112,5 +112,3 @@ async function init() {
112
112
  }
113
113
  }
114
114
  var release_default = init;
115
- // Annotate the CommonJS export names for ESM import in node:
116
- 0 && (module.exports = {});
@@ -85,5 +85,3 @@ var Release = class {
85
85
  }
86
86
  };
87
87
  var release_default = Release;
88
- // Annotate the CommonJS export names for ESM import in node:
89
- 0 && (module.exports = {});
@@ -198,5 +198,3 @@ async function init() {
198
198
  uploadCode.deleteLocalZip();
199
199
  }
200
200
  var uploadCode_default = init;
201
- // Annotate the CommonJS export names for ESM import in node:
202
- 0 && (module.exports = {});
@@ -204,5 +204,3 @@ var UploadCode = class {
204
204
  }
205
205
  };
206
206
  var uploadCode_default = UploadCode;
207
- // Annotate the CommonJS export names for ESM import in node:
208
- 0 && (module.exports = {});
@@ -57,7 +57,7 @@ var getGitCurrentBranch = async () => {
57
57
  var monorepoProjectNameArr = ["admin"];
58
58
  var getServerConfig = async (project) => {
59
59
  if (monorepoProjectNameArr.includes(project)) {
60
- return await fs.readJson("../../lm_config.json");
60
+ return await fs.readJson("../../../lm_config.json");
61
61
  }
62
62
  return await fs.readJson("../lm_config.json");
63
63
  };
package/package.json CHANGED
@@ -1,8 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/common",
3
- "version": "0.0.21-bata",
4
- "description": "A collection of reusable UI components for web development",
5
- "license": "MIT",
3
+ "version": "1.0.2",
6
4
  "sideEffects": [
7
5
  "*.less"
8
6
  ],
@@ -13,32 +11,16 @@
13
11
  "bin": {
14
12
  "pisell": "es/bin/pisell.js"
15
13
  },
16
- "files": [
17
- "es",
18
- "lib",
19
- "package.json",
20
- "README.md"
21
- ],
22
- "scripts": {
23
- "build": "father build",
24
- "build:watch": "father dev",
25
- "dev": "dumi dev",
26
- "docs:build": "dumi build",
27
- "doctor": "father doctor",
28
- "lint": "npm run lint:es && npm run lint:css",
29
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
30
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
31
- "prepare": "husky install && dumi setup",
32
- "prepublishOnly": "father doctor && npm run build",
33
- "release": "npm run build && np --no-cleanup --any-branch --yolo --tag",
34
- "release:beta": "npm run build && np --no-cleanup --any-branch --yolo --tag=beta",
35
- "release:next": "npm run build && np --no-cleanup --any-branch --yolo --tag=next",
36
- "start": "npm run dev"
14
+ "dependencies": {
15
+ "zx": "^7.2.2",
16
+ "inquirer": "^9.2.6",
17
+ "archiver": "^5.3.1",
18
+ "dotenv": "^16.0.3",
19
+ "ssh2": "^1.13.0",
20
+ "@pisell/utils": "1.0.2"
37
21
  },
38
- "commitlint": {
39
- "extends": [
40
- "@commitlint/config-conventional"
41
- ]
22
+ "devDependencies": {
23
+ "father": "^4.1.6"
42
24
  },
43
25
  "lint-staged": {
44
26
  "*.{md,json}": [
@@ -57,52 +39,19 @@
57
39
  "prettier --parser=typescript --write"
58
40
  ]
59
41
  },
60
- "dependencies": {
61
- "antd5": "npm:antd@^5.5.0",
62
- "archiver": "^5.3.1",
63
- "array-move": "^3.0.1",
64
- "dotenv": "^16.0.3",
65
- "inquirer": "^9.2.6",
66
- "react-beautiful-dnd": "^13.1.0",
67
- "react-color": "^2.19.3",
68
- "ssh2": "^1.13.0",
69
- "zx": "^7.2.2"
70
- },
71
- "devDependencies": {
72
- "@ant-design/icons": "^4.8.0",
73
- "@commitlint/cli": "^17.1.2",
74
- "@commitlint/config-conventional": "^17.1.0",
75
- "@types/react": "^18.0.0",
76
- "@types/react-dom": "^18.0.0",
77
- "@umijs/fabric": "^2.0.0",
78
- "@umijs/lint": "^4.0.0",
79
- "ahooks": "^2.10.0",
80
- "classnames": "^2.3.1",
81
- "dumi": "^2.0.2",
82
- "eslint": "^8.23.0",
83
- "father": "^4.1.0",
84
- "husky": "^8.0.1",
85
- "lint-staged": "^13.0.3",
86
- "np": "^7.7.0",
87
- "prettier": "^2.7.1",
88
- "prettier-plugin-organize-imports": "^3.0.0",
89
- "prettier-plugin-packagejson": "^2.2.18",
90
- "react": "^17.0.0",
91
- "react-dom": "^17.0.0",
92
- "stylelint": "^14.9.1",
93
- "typescript": "^4.9.5",
94
- "umi": "^3.3.9"
95
- },
96
- "peerDependencies": {
97
- "@ant-design/icons": "^4.8.0",
98
- "ahooks": "^2.10.0",
99
- "classnames": "^2.3.1",
100
- "react": ">=17.0",
101
- "react-dom": ">=17.0",
102
- "umi": "^3.3.9"
103
- },
104
42
  "publishConfig": {
105
43
  "access": "public"
106
44
  },
107
- "authors": []
108
- }
45
+ "scripts": {
46
+ "build": "father build",
47
+ "dev": "father dev",
48
+ "docs:build": "dumi build",
49
+ "doctor": "father doctor",
50
+ "lint": "npm run lint:es && npm run lint:css",
51
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
52
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
53
+ "lowcode:build": "build-scripts build --config ./build.lowcode.js",
54
+ "lowcode:dev": "build-scripts start --config ./build.lowcode.js",
55
+ "start": "npm run dev"
56
+ }
57
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import('../../es/script/index.js');
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export default {};
@@ -0,0 +1,14 @@
1
+ const outPathMap = {
2
+ my_pisel_shop: {
3
+ prod: '../data/release/project/mypisel_shop',
4
+ release: '../data/release/project/my_pisel_shop',
5
+ pre: '../data/release/project/my_pisel_shop',
6
+ },
7
+ admin: {
8
+ prod: '../data/release/project/pisell_v2',
9
+ release: '../data/release/project/pisell_v2',
10
+ pre: '../data/release/project/pisell_v2',
11
+ },
12
+ };
13
+
14
+ export { outPathMap };
@@ -0,0 +1,29 @@
1
+ import inquirer from 'inquirer';
2
+ import release from './release/index.js';
3
+ import uploadCode from './uploadCode/index.js';
4
+
5
+ const actions = {
6
+ uploadCode: uploadCode,
7
+ release: release,
8
+ };
9
+
10
+ const inquirerResult = () => {
11
+ return inquirer.prompt([
12
+ {
13
+ type: 'list',
14
+ message: '请选择功能',
15
+ name: 'action',
16
+ choices: [
17
+ { value: 'uploadCode', name: '上传代码' },
18
+ { value: 'release', name: '发布代码' },
19
+ ],
20
+ },
21
+ ]);
22
+ };
23
+
24
+ const deploy = async () => {
25
+ let res = await inquirerResult();
26
+ return actions[res.action]();
27
+ };
28
+
29
+ export default deploy;
@@ -0,0 +1,45 @@
1
+ import { fileURLToPath } from 'url';
2
+ import deploy from './deploy.js';
3
+ import { loadJSON } from './utils/index.js';
4
+
5
+ const args = process.argv.slice(2);
6
+
7
+ const isVersion = (v) => {
8
+ return ['-v', '--version', '-V'].includes(v);
9
+ };
10
+
11
+ const isHelp = (v) => {
12
+ return ['-h', '--help', '-H'].includes(v);
13
+ };
14
+
15
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
16
+
17
+ (() => {
18
+ try {
19
+ const params = args.slice(1);
20
+ switch (true) {
21
+ case args[0] === 'deploy':
22
+ deploy(...params);
23
+ break;
24
+ case isVersion(args[0]):
25
+ console.log(
26
+ `@pisell/common@${
27
+ loadJSON(path.join(__dirname, '../../package.json')).version
28
+ }`,
29
+ );
30
+ break;
31
+ case isHelp(args[0]):
32
+ console.log('pisell -h --help -H [全部命令]');
33
+
34
+ console.log('pisell -v --version -V [显示版本]');
35
+
36
+ console.log('pisell deploy [上传代码|发布代码]');
37
+ break;
38
+ default:
39
+ break;
40
+ }
41
+ } catch (e) {
42
+ console.error(e.stack);
43
+ process.exit(1);
44
+ }
45
+ })();
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "script",
3
+ "type": "module"
4
+ }
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env zx
2
+ import inquirer from 'inquirer';
3
+ import {
4
+ getCurrentProjectName,
5
+ getServerConfig,
6
+ versionSort,
7
+ } from '../utils/index.js';
8
+ import Release from './release.js';
9
+
10
+ const selectProject = () => {
11
+ return inquirer.prompt([
12
+ // {
13
+ // type: "list",
14
+ // message: "请选择项目",
15
+ // name: "project",
16
+ // choices: [
17
+ // {
18
+ // value: {
19
+ // fileName: "my_pisel_shop",
20
+ // path:"./",
21
+ // },
22
+ // name: "my_pisel_shop"
23
+ // },
24
+ // ],
25
+ // },
26
+ {
27
+ type: 'list',
28
+ message: '请选择发布环境',
29
+ name: 'env',
30
+ choices: ['release', 'pre', 'prod'],
31
+ },
32
+ ]);
33
+ };
34
+
35
+ /**
36
+ * @Title: 选择器函数
37
+ * @Describe:
38
+ * @Author: Wzw
39
+ */
40
+ const inquirerResult = (versionList) => {
41
+ return inquirer.prompt([
42
+ {
43
+ type: 'list',
44
+ message: '请选择发布版本号',
45
+ name: 'version',
46
+ default: versionList,
47
+ choices: versionList,
48
+ },
49
+ {
50
+ type: 'confirm',
51
+ message: '确认发布',
52
+ name: 'is_release',
53
+ default: true,
54
+ },
55
+ ]);
56
+ };
57
+
58
+ // 版本选择时过滤的文件夹
59
+ const ignoreName = ['master', '.git', 'pre-master'];
60
+
61
+ /**
62
+ * @Title: 获取所选项目的版本号列表
63
+ * @Describe:
64
+ * @Author: Zsj
65
+ */
66
+ const getVersionList = async ({ env, project }) => {
67
+ const config = await getServerConfig(project.fileName);
68
+
69
+ let host = config[env].host;
70
+ if (env === 'release') {
71
+ host = config.cn[env].host;
72
+ }
73
+ let projectName = project.fileName;
74
+ if (projectName === 'my_pisel_shop' && env === 'prod') {
75
+ projectName = 'mypisel_shop';
76
+ }
77
+ // 域名
78
+ const versionList = await fetch(
79
+ `http://${host}:3600/version?projectName=${projectName}`,
80
+ ).then((res) => res.json());
81
+
82
+ return versionSort(versionList.filter((item) => !ignoreName.includes(item)));
83
+ };
84
+
85
+ async function init() {
86
+ /** 选择项目 */
87
+ let projectAndEnv = await selectProject();
88
+
89
+ /** 之前选择项目模式改为获取当前主项目 */
90
+ projectAndEnv.project = {
91
+ path: './',
92
+ fileName: getCurrentProjectName(),
93
+ };
94
+
95
+ /** 通过项目和环境查询对应版本号 */
96
+ const versionList = await getVersionList(projectAndEnv);
97
+
98
+ const res = await inquirerResult(versionList);
99
+
100
+ const releaseInstance = new Release({ ...res, ...projectAndEnv });
101
+
102
+ try {
103
+ /** 设置连接服务器配置 */
104
+ await releaseInstance.setConfig();
105
+
106
+ /** 连接服务器 */
107
+ await releaseInstance.connectServer();
108
+
109
+ /** 发布 */
110
+ await releaseInstance.release();
111
+
112
+ /** 断开 */
113
+ await releaseInstance.disconnectServer();
114
+ } catch (error) {
115
+ console.log(error);
116
+ }
117
+ }
118
+
119
+ export default init;
@@ -0,0 +1,84 @@
1
+ import { outPathMap } from '../constants/index.js';
2
+ import {
3
+ connectServer,
4
+ getServerConfig,
5
+ releaseProject,
6
+ } from '../utils/index.js';
7
+
8
+ /**
9
+ * @Title: 执行发布类
10
+ * @Describe:
11
+ * @Author: Zsj
12
+ */
13
+ class Release {
14
+ constructor(props) {
15
+ const { project, env, version, conn } = props;
16
+ this.projectName = project.fileName;
17
+ this.env = env;
18
+ this.version = version;
19
+
20
+ this.conn = conn;
21
+ this.outPath = outPathMap[this.projectName][this.env];
22
+ }
23
+
24
+ /**
25
+ * @Title: 设置连接服务器配置
26
+ * @Describe:
27
+ * @Author: Zsj
28
+ */
29
+ async setConfig() {
30
+ const serverConfigMap = await getServerConfig(this.projectName);
31
+
32
+ let serverConfig = serverConfigMap[this.env];
33
+
34
+ // 选择release默认用国内cn服务器
35
+ if (this.env === 'release') {
36
+ serverConfig = serverConfigMap.cn[this.env];
37
+ }
38
+
39
+ if (this.env === 'prod') {
40
+ serverConfig.privateKey = fs.readFileSync(
41
+ path.join(process.env.HOME, '.ssh', 'id_rsa'),
42
+ );
43
+ }
44
+
45
+ this.serverConfig = serverConfig;
46
+ }
47
+
48
+ /**
49
+ * @Title: 连接服务器
50
+ * @Describe:
51
+ * @Author: Zsj
52
+ */
53
+ async connectServer() {
54
+ if (!this.serverConfig) {
55
+ console.log('未找到发布配置!');
56
+ return null;
57
+ }
58
+ this.conn = await connectServer(this.serverConfig);
59
+ return this.conn;
60
+ }
61
+
62
+ /**
63
+ * @Title: 执行发布操作
64
+ * @Describe:
65
+ * @Author: Zsj
66
+ */
67
+ async release() {
68
+ return await releaseProject(this.conn, {
69
+ path: this.outPath,
70
+ fileName: `${this.version}`,
71
+ });
72
+ }
73
+
74
+ /**
75
+ * @Title: 断开服务连接
76
+ * @Describe:
77
+ * @Author: Zsj
78
+ */
79
+ async disconnectServer() {
80
+ return await this.conn.end();
81
+ }
82
+ }
83
+
84
+ export default Release;