@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.
- package/.fatherrc.ts +7 -0
- package/CHANGELOG.md +14 -0
- package/README.md +1 -38
- package/es/bin/pisell.js +0 -0
- package/es/index.d.ts +2 -4
- package/es/index.js +1 -4
- package/es/script/utils/index.js +1 -1
- package/lib/index.d.ts +2 -4
- package/lib/index.js +8 -5
- package/lib/script/deploy.js +0 -2
- package/lib/script/release/index.js +0 -2
- package/lib/script/release/release.js +0 -2
- package/lib/script/uploadCode/index.js +0 -2
- package/lib/script/uploadCode/uploadCode.js +0 -2
- package/lib/script/utils/index.js +1 -1
- package/package.json +23 -74
- package/src/bin/pisell.js +3 -0
- package/src/index.ts +1 -0
- package/src/script/constants/index.js +14 -0
- package/src/script/deploy.js +29 -0
- package/src/script/index.js +45 -0
- package/src/script/package.json +4 -0
- package/src/script/release/index.js +119 -0
- package/src/script/release/release.js +84 -0
- package/src/script/uploadCode/index.js +244 -0
- package/src/script/uploadCode/uploadCode.js +217 -0
- package/src/script/utils/index.js +275 -0
- package/tsconfig.json +14 -0
- package/LICENSE +0 -21
- package/es/business-components/colorInput/index.d.ts +0 -21
- package/es/business-components/colorInput/index.js +0 -43
- package/es/business-components/colorInput/index.less +0 -10
- package/es/business-components/index.d.ts +0 -11
- package/es/business-components/index.js +0 -7
- package/es/business-components/rechargeOption/index.d.ts +0 -36
- package/es/business-components/rechargeOption/index.js +0 -132
- package/es/business-components/rechargeOption/index.less +0 -0
- package/es/business-components/selectTag/index.d.ts +0 -25
- package/es/business-components/selectTag/index.js +0 -179
- package/es/business-components/selectTag/index.less +0 -22
- package/es/business-components/sortModal/index.d.ts +0 -30
- package/es/business-components/sortModal/index.js +0 -85
- package/es/business-components/sortModal/index.less +0 -29
- package/es/business-components/statistics/index.d.ts +0 -12
- package/es/business-components/statistics/index.js +0 -38
- package/es/business-components/statistics/index.less +0 -64
- package/es/business-components/tagModal/index.d.ts +0 -17
- package/es/business-components/tagModal/index.js +0 -58
- package/es/business-hooks/index.d.ts +0 -2
- package/es/business-hooks/index.js +0 -2
- package/es/business-hooks/useModal/index.d.ts +0 -31
- package/es/business-hooks/useModal/index.js +0 -91
- package/es/business-hooks/useModal/index.less +0 -0
- package/es/business-hooks/useTagModal/index.d.ts +0 -17
- package/es/business-hooks/useTagModal/index.js +0 -47
- package/es/components/ColorPicker/index.d.ts +0 -22
- package/es/components/ColorPicker/index.js +0 -51
- package/es/components/ColorPicker/index.less +0 -17
- package/es/components/DragSort/index.js +0 -68
- package/es/components/EditorPreview/index.js +0 -14
- package/es/components/EditorPreview/index.less +0 -81
- package/es/components/Iconfont/index.d.ts +0 -6
- package/es/components/Iconfont/index.js +0 -29
- package/es/components/Iconfont/index.less +0 -0
- package/es/components/agreement/Detail/index.js +0 -77
- package/es/components/agreement/Detail/serve.d.ts +0 -1
- package/es/components/agreement/Detail/serve.js +0 -6
- package/es/components/agreement/index.d.ts +0 -11
- package/es/components/agreement/index.js +0 -45
- package/es/components/agreement/index.less +0 -20
- package/es/components/avatar/index.d.ts +0 -13
- package/es/components/avatar/index.js +0 -25
- package/es/components/button/index.js +0 -36
- package/es/components/card/index.js +0 -16
- package/es/components/card/index.less +0 -9
- package/es/components/checkbox/index.js +0 -43
- package/es/components/configProvider/index.d.ts +0 -113
- package/es/components/configProvider/index.js +0 -114
- package/es/components/datePicker/index.js +0 -17
- package/es/components/index.js +0 -16
- package/es/components/input/index.js +0 -97
- package/es/components/inputNumber/index.js +0 -17
- package/es/components/pagination/index.d.ts +0 -10
- package/es/components/pagination/index.js +0 -18
- package/es/components/radio/index.js +0 -28
- package/es/components/select/index.js +0 -17
- package/es/components/switch/index.d.ts +0 -10
- package/es/components/switch/index.js +0 -18
- package/es/config/index.js +0 -18
- package/es/config/request.d.ts +0 -7
- package/es/config/request.js +0 -67
- package/es/config/utils.d.ts +0 -0
- package/es/config/utils.js +0 -0
- package/es/hooks/index.d.ts +0 -8
- package/es/hooks/index.js +0 -8
- package/es/hooks/useCountDown/index.d.ts +0 -10
- package/es/hooks/useCountDown/index.js +0 -48
- package/es/hooks/useDocumentScroll/index.d.ts +0 -8
- package/es/hooks/useDocumentScroll/index.js +0 -41
- package/es/hooks/useDocumentScroll/index.less +0 -0
- package/es/hooks/useMousemove/index.d.ts +0 -8
- package/es/hooks/useMousemove/index.js +0 -61
- package/es/hooks/useResponsive/index.d.ts +0 -2
- package/es/hooks/useResponsive/index.js +0 -29
- package/es/hooks/useResponsive/index.less +0 -0
- package/es/hooks/useSize/index.d.ts +0 -2
- package/es/hooks/useSize/index.js +0 -27
- package/es/hooks/useSize/index.less +0 -0
- package/es/hooks/useStateMulti/index.d.ts +0 -2
- package/es/hooks/useStateMulti/index.js +0 -29
- package/es/hooks/useStateWithCb/index.d.ts +0 -2
- package/es/hooks/useStateWithCb/index.js +0 -42
- package/es/hooks/useTable/index.d.ts +0 -12
- package/es/hooks/useTable/index.js +0 -74
- package/es/hooks/useTable/index.less +0 -0
- package/es/hooks/useTableModal/index.d.ts +0 -12
- package/es/hooks/useTableModal/index.js +0 -25
- package/es/hooks/useTableModal/index.less +0 -0
- package/es/hooks/useUrlState/index.d.ts +0 -2
- package/es/hooks/useUrlState/index.js +0 -56
- package/es/hooks/useWebSocket/index.d.ts +0 -13
- package/es/hooks/useWebSocket/index.js +0 -121
- package/es/locales/en-US.d.ts +0 -11
- package/es/locales/en-US.js +0 -10
- package/es/locales/index.d.ts +0 -1
- package/es/locales/index.js +0 -23
- package/es/locales/zh-CN.d.ts +0 -11
- package/es/locales/zh-CN.js +0 -10
- package/es/locales/zh-TW.d.ts +0 -11
- package/es/locales/zh-TW.js +0 -10
- package/es/utils/index.d.ts +0 -3
- package/es/utils/index.js +0 -3
- package/es/utils/otherUtils.d.ts +0 -8
- package/es/utils/otherUtils.js +0 -12
- package/es/utils/storage.d.ts +0 -30
- package/es/utils/storage.js +0 -70
- package/es/utils/typeUtils.d.ts +0 -42
- package/es/utils/typeUtils.js +0 -86
- package/lib/business-components/colorInput/index.d.ts +0 -21
- package/lib/business-components/colorInput/index.js +0 -70
- package/lib/business-components/colorInput/index.less +0 -10
- package/lib/business-components/index.d.ts +0 -11
- package/lib/business-components/index.js +0 -54
- package/lib/business-components/rechargeOption/index.d.ts +0 -36
- package/lib/business-components/rechargeOption/index.js +0 -112
- package/lib/business-components/rechargeOption/index.less +0 -0
- package/lib/business-components/selectTag/index.d.ts +0 -25
- package/lib/business-components/selectTag/index.js +0 -181
- package/lib/business-components/selectTag/index.less +0 -22
- package/lib/business-components/sortModal/index.d.ts +0 -30
- package/lib/business-components/sortModal/index.js +0 -100
- package/lib/business-components/sortModal/index.less +0 -29
- package/lib/business-components/statistics/index.d.ts +0 -12
- package/lib/business-components/statistics/index.js +0 -63
- package/lib/business-components/statistics/index.less +0 -64
- package/lib/business-components/tagModal/index.d.ts +0 -17
- package/lib/business-components/tagModal/index.js +0 -66
- package/lib/business-hooks/index.d.ts +0 -2
- package/lib/business-hooks/index.js +0 -42
- package/lib/business-hooks/useModal/index.d.ts +0 -31
- package/lib/business-hooks/useModal/index.js +0 -68
- package/lib/business-hooks/useModal/index.less +0 -0
- package/lib/business-hooks/useTagModal/index.d.ts +0 -17
- package/lib/business-hooks/useTagModal/index.js +0 -61
- package/lib/components/ColorPicker/index.d.ts +0 -22
- package/lib/components/ColorPicker/index.js +0 -80
- package/lib/components/ColorPicker/index.less +0 -17
- package/lib/components/DragSort/index.js +0 -101
- package/lib/components/EditorPreview/index.js +0 -37
- package/lib/components/EditorPreview/index.less +0 -81
- package/lib/components/Iconfont/index.d.ts +0 -6
- package/lib/components/Iconfont/index.js +0 -48
- package/lib/components/Iconfont/index.less +0 -0
- package/lib/components/agreement/Detail/index.js +0 -86
- package/lib/components/agreement/Detail/serve.d.ts +0 -1
- package/lib/components/agreement/Detail/serve.js +0 -30
- package/lib/components/agreement/index.d.ts +0 -11
- package/lib/components/agreement/index.js +0 -82
- package/lib/components/agreement/index.less +0 -20
- package/lib/components/avatar/index.d.ts +0 -13
- package/lib/components/avatar/index.js +0 -42
- package/lib/components/button/index.js +0 -36
- package/lib/components/card/index.js +0 -42
- package/lib/components/card/index.less +0 -9
- package/lib/components/checkbox/index.js +0 -36
- package/lib/components/configProvider/index.d.ts +0 -113
- package/lib/components/configProvider/index.js +0 -159
- package/lib/components/datePicker/index.js +0 -31
- package/lib/components/index.js +0 -83
- package/lib/components/input/index.js +0 -53
- package/lib/components/inputNumber/index.js +0 -31
- package/lib/components/pagination/index.d.ts +0 -10
- package/lib/components/pagination/index.js +0 -42
- package/lib/components/radio/index.js +0 -36
- package/lib/components/select/index.js +0 -36
- package/lib/components/switch/index.d.ts +0 -10
- package/lib/components/switch/index.js +0 -42
- package/lib/config/index.js +0 -39
- package/lib/config/request.d.ts +0 -7
- package/lib/config/request.js +0 -76
- package/lib/config/utils.d.ts +0 -0
- package/lib/config/utils.js +0 -0
- package/lib/hooks/index.d.ts +0 -8
- package/lib/hooks/index.js +0 -57
- package/lib/hooks/useCountDown/index.d.ts +0 -10
- package/lib/hooks/useCountDown/index.js +0 -57
- package/lib/hooks/useDocumentScroll/index.d.ts +0 -8
- package/lib/hooks/useDocumentScroll/index.js +0 -54
- package/lib/hooks/useDocumentScroll/index.less +0 -0
- package/lib/hooks/useMousemove/index.d.ts +0 -8
- package/lib/hooks/useMousemove/index.js +0 -70
- package/lib/hooks/useResponsive/index.d.ts +0 -2
- package/lib/hooks/useResponsive/index.js +0 -47
- package/lib/hooks/useResponsive/index.less +0 -0
- package/lib/hooks/useSize/index.d.ts +0 -2
- package/lib/hooks/useSize/index.js +0 -45
- package/lib/hooks/useSize/index.less +0 -0
- package/lib/hooks/useStateMulti/index.d.ts +0 -2
- package/lib/hooks/useStateMulti/index.js +0 -43
- package/lib/hooks/useStateWithCb/index.d.ts +0 -2
- package/lib/hooks/useStateWithCb/index.js +0 -53
- package/lib/hooks/useTable/index.d.ts +0 -12
- package/lib/hooks/useTable/index.js +0 -75
- package/lib/hooks/useTable/index.less +0 -0
- package/lib/hooks/useTableModal/index.d.ts +0 -12
- package/lib/hooks/useTableModal/index.js +0 -43
- package/lib/hooks/useTableModal/index.less +0 -0
- package/lib/hooks/useUrlState/index.d.ts +0 -2
- package/lib/hooks/useUrlState/index.js +0 -59
- package/lib/hooks/useWebSocket/index.d.ts +0 -13
- package/lib/hooks/useWebSocket/index.js +0 -91
- package/lib/locales/en-US.d.ts +0 -11
- package/lib/locales/en-US.js +0 -36
- package/lib/locales/index.d.ts +0 -1
- package/lib/locales/index.js +0 -59
- package/lib/locales/zh-CN.d.ts +0 -11
- package/lib/locales/zh-CN.js +0 -36
- package/lib/locales/zh-TW.d.ts +0 -11
- package/lib/locales/zh-TW.js +0 -36
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/index.js +0 -21
- package/lib/utils/otherUtils.d.ts +0 -8
- package/lib/utils/otherUtils.js +0 -31
- package/lib/utils/storage.d.ts +0 -30
- package/lib/utils/storage.js +0 -63
- package/lib/utils/typeUtils.d.ts +0 -42
- package/lib/utils/typeUtils.js +0 -75
package/.fatherrc.ts
ADDED
package/CHANGELOG.md
ADDED
package/README.md
CHANGED
|
@@ -1,40 +1,3 @@
|
|
|
1
1
|
# @pisell/common
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](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
package/es/index.js
CHANGED
package/es/script/utils/index.js
CHANGED
package/lib/index.d.ts
CHANGED
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
|
-
|
|
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 = {};
|
package/lib/script/deploy.js
CHANGED
|
@@ -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("
|
|
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": "
|
|
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
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
"
|
|
39
|
-
"
|
|
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
|
-
"
|
|
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
|
+
}
|
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,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;
|