@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
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import * as dotenv from 'dotenv';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import ssh2 from 'ssh2';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @Title: 项目工作区是否干净
|
|
7
|
+
* @Describe:
|
|
8
|
+
* @Author: Zsj
|
|
9
|
+
* @returns {Promise<boolean>}
|
|
10
|
+
*/
|
|
11
|
+
const isWorkingTreeClean = async () => {
|
|
12
|
+
const v = await $`git status --porcelain`;
|
|
13
|
+
return v.stdout === '';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 获取当前分支
|
|
18
|
+
* @returns {Promise<*>}
|
|
19
|
+
*/
|
|
20
|
+
const getGitCurrentBranch = async () => {
|
|
21
|
+
const v = await $`git symbolic-ref --short HEAD`;
|
|
22
|
+
return v.stdout;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* monorepo项目名称
|
|
27
|
+
* @type {string[]}
|
|
28
|
+
*/
|
|
29
|
+
const monorepoProjectNameArr = ['admin'];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @Title: 获取本地lm_config.json配置信息
|
|
33
|
+
* @Describe:·
|
|
34
|
+
* @Author: Zsj
|
|
35
|
+
*/
|
|
36
|
+
const getServerConfig = async (project) => {
|
|
37
|
+
if (monorepoProjectNameArr.includes(project)) {
|
|
38
|
+
return await fs.readJson('../../../lm_config.json');
|
|
39
|
+
}
|
|
40
|
+
return await fs.readJson('../lm_config.json');
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @Title: 连接服务器
|
|
45
|
+
* @Describe:
|
|
46
|
+
* @Author: Zsj
|
|
47
|
+
*/
|
|
48
|
+
const connectServer = (config) => {
|
|
49
|
+
const conn = new ssh2.Client();
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
conn
|
|
52
|
+
.on('ready', () => {
|
|
53
|
+
resolve(conn);
|
|
54
|
+
})
|
|
55
|
+
.on('error', (err) => {
|
|
56
|
+
console.log(err, 'connect error');
|
|
57
|
+
reject();
|
|
58
|
+
})
|
|
59
|
+
.connect(config);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @Title: 文件上传至服务器
|
|
65
|
+
* @Describe:
|
|
66
|
+
* @Author: Zsj
|
|
67
|
+
*/
|
|
68
|
+
const serverUpload = (conn, { localPath, remotePath }) => {
|
|
69
|
+
if (!conn) return Promise.reject('未连接服务器');
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
conn.sftp((err, sftp) => {
|
|
72
|
+
if (err) {
|
|
73
|
+
console.log(err);
|
|
74
|
+
reject(err);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
sftp.fastPut(
|
|
78
|
+
localPath,
|
|
79
|
+
remotePath,
|
|
80
|
+
{
|
|
81
|
+
step: (total, nb, fsize) => {
|
|
82
|
+
console.table([
|
|
83
|
+
{
|
|
84
|
+
标题: '当前已上传',
|
|
85
|
+
值: `${((total / fsize) * 100).toFixed(2)}%`,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
标题: '每次上传',
|
|
89
|
+
值: `${(nb / 1024 / 1024).toFixed(2)}M`,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
标题: '总大小',
|
|
93
|
+
值: `${(fsize / 1024 / 1024).toFixed(2)}M`,
|
|
94
|
+
},
|
|
95
|
+
]);
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
(err) => {
|
|
99
|
+
if (err) {
|
|
100
|
+
console.log(err);
|
|
101
|
+
reject(err);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
console.log('上传成功');
|
|
105
|
+
resolve(conn);
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @Title: 服务器中解压文件
|
|
114
|
+
* @Describe:
|
|
115
|
+
* @Author: Zsj
|
|
116
|
+
*/
|
|
117
|
+
const serverUnpack = (conn, { path, fileName, fullFileName, changelog }) => {
|
|
118
|
+
if (!conn) return Promise.reject('未连接服务器');
|
|
119
|
+
// 文件全名
|
|
120
|
+
return new Promise((resolve, reject) => {
|
|
121
|
+
conn.shell((err, stream) => {
|
|
122
|
+
if (err) {
|
|
123
|
+
console.log(err);
|
|
124
|
+
reject(err);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
stream
|
|
128
|
+
.end(
|
|
129
|
+
`
|
|
130
|
+
cd ${path}
|
|
131
|
+
unzip ${fullFileName} -d ${fileName} && mv ${fileName}/dist/* ${fileName}/ && rmdir ${fileName}/dist
|
|
132
|
+
rm -rf ${fullFileName}
|
|
133
|
+
echo "${changelog}" > ./${fileName}/changelog.md
|
|
134
|
+
sh deleteOldVersion.sh
|
|
135
|
+
exit
|
|
136
|
+
`,
|
|
137
|
+
// 打开到path
|
|
138
|
+
// 解压 1.0.0.zip 文件到 1.0.0 移动dist中内容到 1.0.0内 删除dist
|
|
139
|
+
// 删除1.0.0.zip
|
|
140
|
+
// 写入changelog到changelog.md
|
|
141
|
+
// 执行deleteOldVersion脚本 删除过早版本
|
|
142
|
+
)
|
|
143
|
+
.on('data', (data) => {
|
|
144
|
+
console.log(data.toString());
|
|
145
|
+
})
|
|
146
|
+
.on('close', () => {
|
|
147
|
+
console.log('✅上传完成');
|
|
148
|
+
resolve();
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @Title: 选择名称进行发布操作
|
|
156
|
+
* @Describe:
|
|
157
|
+
* @Author: Zsj
|
|
158
|
+
*/
|
|
159
|
+
const releaseProject = (conn, { path, fileName }) => {
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
conn.shell((err, stream) => {
|
|
162
|
+
if (err) {
|
|
163
|
+
console.log(err);
|
|
164
|
+
reject(err);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
stream
|
|
168
|
+
.end(
|
|
169
|
+
`
|
|
170
|
+
cd ${path}
|
|
171
|
+
cp -R -f pre-master next-master
|
|
172
|
+
rm -rf pre-master
|
|
173
|
+
\\cp -R -f ${fileName}/* next-master
|
|
174
|
+
cp -R -f ${fileName} pre-master
|
|
175
|
+
rm -rf master
|
|
176
|
+
cp -R next-master master
|
|
177
|
+
rm -rf next-master
|
|
178
|
+
exit
|
|
179
|
+
`,
|
|
180
|
+
// 打开到path
|
|
181
|
+
// 复制pre-master到next-master
|
|
182
|
+
// 删除pre-master
|
|
183
|
+
// 复制1.0.0到next-master
|
|
184
|
+
// 复制1.0.0到pre-master
|
|
185
|
+
// 删除master
|
|
186
|
+
// 复制next-master到master
|
|
187
|
+
// 删除next-master
|
|
188
|
+
)
|
|
189
|
+
.on('data', (data) => {
|
|
190
|
+
console.log(data.toString());
|
|
191
|
+
})
|
|
192
|
+
.on('close', () => {
|
|
193
|
+
console.log('✅发布完成');
|
|
194
|
+
resolve();
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @Title: version进行版本号排序
|
|
202
|
+
* @Describe:
|
|
203
|
+
* @Author: Zsj
|
|
204
|
+
*/
|
|
205
|
+
const versionSort = (versionList) => {
|
|
206
|
+
return versionList.sort((a, b) => {
|
|
207
|
+
const aParts = a.split('.');
|
|
208
|
+
const bParts = b.split('.');
|
|
209
|
+
for (let i = 0; i < aParts.length && i < bParts.length; i++) {
|
|
210
|
+
const aNum = parseInt(aParts[i]);
|
|
211
|
+
const bNum = parseInt(bParts[i]);
|
|
212
|
+
if (aNum !== bNum) {
|
|
213
|
+
return bNum - aNum;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return bParts.length - aParts.length;
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 获取当前主项目名称
|
|
222
|
+
* @returns {*}
|
|
223
|
+
*/
|
|
224
|
+
const getCurrentProjectName = () => {
|
|
225
|
+
return loadJSON(path.join(process.cwd(), './package.json')).name;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const loadJSON = (path) => JSON.parse(fs.readFileSync(path));
|
|
229
|
+
|
|
230
|
+
const getCurrentUserName = async () => {
|
|
231
|
+
const { stdout } = await $`git config user.name`;
|
|
232
|
+
return stdout;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const createFeishuMessageContent = (contentArr) => {
|
|
236
|
+
return JSON.stringify(
|
|
237
|
+
contentArr.map((item) => {
|
|
238
|
+
return [
|
|
239
|
+
{ tag: 'text', text: `${item.key}: ` },
|
|
240
|
+
{ tag: 'text', text: `${item.value}` },
|
|
241
|
+
];
|
|
242
|
+
}),
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const sendWebhook = async ({ title, content }) => {
|
|
247
|
+
const contentStr = createFeishuMessageContent(content);
|
|
248
|
+
if (!dotenv.config()?.parsed?.WEBHOOK) return;
|
|
249
|
+
const response = await fetch(dotenv.config()?.parsed?.WEBHOOK, {
|
|
250
|
+
headers: {
|
|
251
|
+
'Content-Type': 'application/json',
|
|
252
|
+
},
|
|
253
|
+
method: 'POST',
|
|
254
|
+
body: JSON.stringify({
|
|
255
|
+
msg_type: 'post',
|
|
256
|
+
content: `{"post":{"zh_cn":{"title":"${title}","content":${contentStr}}}}`,
|
|
257
|
+
}),
|
|
258
|
+
});
|
|
259
|
+
return await response.json();
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export {
|
|
263
|
+
isWorkingTreeClean,
|
|
264
|
+
getServerConfig,
|
|
265
|
+
connectServer,
|
|
266
|
+
serverUpload,
|
|
267
|
+
serverUnpack,
|
|
268
|
+
versionSort,
|
|
269
|
+
releaseProject,
|
|
270
|
+
getGitCurrentBranch,
|
|
271
|
+
getCurrentProjectName,
|
|
272
|
+
loadJSON,
|
|
273
|
+
getCurrentUserName,
|
|
274
|
+
sendWebhook,
|
|
275
|
+
};
|
package/tsconfig.json
ADDED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './index.less';
|
|
3
|
-
export interface ColorInputProps {
|
|
4
|
-
/**
|
|
5
|
-
* @description 颜色值
|
|
6
|
-
* @default ""
|
|
7
|
-
*/
|
|
8
|
-
value: string;
|
|
9
|
-
/**
|
|
10
|
-
* @description 当颜色值改变触发
|
|
11
|
-
* @default () => void
|
|
12
|
-
*/
|
|
13
|
-
onChange: (val: string) => void;
|
|
14
|
-
/**
|
|
15
|
-
* @description 色块大小
|
|
16
|
-
* @default 30
|
|
17
|
-
*/
|
|
18
|
-
colorBlockSize?: number;
|
|
19
|
-
}
|
|
20
|
-
declare const ColorInput: React.FC<ColorInputProps>;
|
|
21
|
-
export default ColorInput;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Input } from 'antd5';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ColorPicker } from "../../components";
|
|
4
|
-
import "./index.less";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
var prefix = 'pisell-';
|
|
8
|
-
var ColorInput = function ColorInput(props) {
|
|
9
|
-
var _props$value = props.value,
|
|
10
|
-
value = _props$value === void 0 ? '' : _props$value,
|
|
11
|
-
_onChange = props.onChange,
|
|
12
|
-
_props$colorBlockSize = props.colorBlockSize,
|
|
13
|
-
colorBlockSize = _props$colorBlockSize === void 0 ? 30 : _props$colorBlockSize;
|
|
14
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
15
|
-
className: "".concat(prefix, "color-input-wrap"),
|
|
16
|
-
children: [/*#__PURE__*/_jsx(ColorPicker, {
|
|
17
|
-
onChange: _onChange,
|
|
18
|
-
value: value,
|
|
19
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
20
|
-
style: {
|
|
21
|
-
backgroundColor: value,
|
|
22
|
-
width: colorBlockSize,
|
|
23
|
-
height: colorBlockSize
|
|
24
|
-
},
|
|
25
|
-
className: "".concat(prefix, "color-block")
|
|
26
|
-
})
|
|
27
|
-
}), /*#__PURE__*/_jsx(Input, {
|
|
28
|
-
value: value.replace('#', ''),
|
|
29
|
-
prefix: '#',
|
|
30
|
-
style: {
|
|
31
|
-
width: 120
|
|
32
|
-
},
|
|
33
|
-
onChange: function onChange(e) {
|
|
34
|
-
var reg = /^([0-9a-fA-F]{0,6})$/;
|
|
35
|
-
if (!reg.test(e.target.value)) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
_onChange("#".concat(e.target.value));
|
|
39
|
-
}
|
|
40
|
-
})]
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
export default ColorInput;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default as ColorInput } from './colorInput';
|
|
2
|
-
export type { ColorInputProps } from './colorInput';
|
|
3
|
-
export { default as RechargeOption } from './rechargeOption';
|
|
4
|
-
export type { RechargeOptionProps } from './rechargeOption';
|
|
5
|
-
export { default as SelectTag } from './selectTag';
|
|
6
|
-
export type { SelectTagProps } from './selectTag';
|
|
7
|
-
export { default as SortModal } from './sortModal';
|
|
8
|
-
export type { SortModalProps } from './sortModal';
|
|
9
|
-
export { default as Statistics } from './statistics';
|
|
10
|
-
export { default as TagModal } from './tagModal';
|
|
11
|
-
export type { TagModalProps } from './tagModal';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// export { default as Address } from './address';
|
|
2
|
-
export { default as ColorInput } from "./colorInput";
|
|
3
|
-
export { default as RechargeOption } from "./rechargeOption";
|
|
4
|
-
export { default as SelectTag } from "./selectTag";
|
|
5
|
-
export { default as SortModal } from "./sortModal";
|
|
6
|
-
export { default as Statistics } from "./statistics";
|
|
7
|
-
export { default as TagModal } from "./tagModal";
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { ColProps } from 'antd5/lib/col';
|
|
2
|
-
import type { FormItemProps } from 'antd5/lib/form/FormItem';
|
|
3
|
-
import type { FormListFieldData, FormListProps } from 'antd5/lib/form/FormList';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import type { SortModalProps } from '../sortModal';
|
|
6
|
-
import type { FormInstance } from 'antd5/es/form/hooks/useForm';
|
|
7
|
-
export interface RechargeOptionProps {
|
|
8
|
-
name: FormListProps['name'];
|
|
9
|
-
/** 是否展示编辑按钮 */
|
|
10
|
-
isShowEditButton?: boolean;
|
|
11
|
-
/** 添加按钮文案 */
|
|
12
|
-
addBtnText?: string;
|
|
13
|
-
/** 编辑按钮文案 */
|
|
14
|
-
editBtnText?: string;
|
|
15
|
-
/** 列配置 */
|
|
16
|
-
columnOption: {
|
|
17
|
-
label: string;
|
|
18
|
-
span: ColProps['span'];
|
|
19
|
-
field: string;
|
|
20
|
-
rules: FormItemProps['rules'];
|
|
21
|
-
}[];
|
|
22
|
-
/** 编辑按钮事件 */
|
|
23
|
-
onEditClick?: (bundle: FormListFieldData) => void;
|
|
24
|
-
rechargeOptionRef?: React.MutableRefObject<{
|
|
25
|
-
openSortModal: () => void;
|
|
26
|
-
} | undefined>;
|
|
27
|
-
sortModalProps?: Partial<Omit<SortModalProps<Record<string, any>>, 'ref'>>;
|
|
28
|
-
form: FormInstance;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 类充值选项组件
|
|
32
|
-
* @param props
|
|
33
|
-
* @constructor
|
|
34
|
-
*/
|
|
35
|
-
declare const RechargeOption: React.FC<RechargeOptionProps>;
|
|
36
|
-
export default RechargeOption;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
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); }
|
|
7
|
-
import { DeleteOutlined } from '@ant-design/icons';
|
|
8
|
-
import { Button, Col, Form, Input, Row } from 'antd5';
|
|
9
|
-
import React, { useCallback, useImperativeHandle, useMemo, useRef } from 'react';
|
|
10
|
-
import { getUniqueId, isFunction } from "../../utils";
|
|
11
|
-
import { getText } from "../../locales";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
|
-
/**
|
|
16
|
-
* 类充值选项组件
|
|
17
|
-
* @param props
|
|
18
|
-
* @constructor
|
|
19
|
-
*/
|
|
20
|
-
var RechargeOption = function RechargeOption(props) {
|
|
21
|
-
var name = props.name,
|
|
22
|
-
_props$isShowEditButt = props.isShowEditButton,
|
|
23
|
-
isShowEditButton = _props$isShowEditButt === void 0 ? false : _props$isShowEditButt,
|
|
24
|
-
columnOption = props.columnOption,
|
|
25
|
-
addBtnText = props.addBtnText,
|
|
26
|
-
editBtnText = props.editBtnText,
|
|
27
|
-
onEditClick = props.onEditClick,
|
|
28
|
-
rechargeOptionRef = props.rechargeOptionRef;
|
|
29
|
-
var sortModalRef = useRef(null);
|
|
30
|
-
var genDefaultData = useCallback(function (others) {
|
|
31
|
-
return columnOption.reduce(function (acc, cur) {
|
|
32
|
-
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, cur.field, ''));
|
|
33
|
-
}, _objectSpread({
|
|
34
|
-
key: getUniqueId()
|
|
35
|
-
}, others));
|
|
36
|
-
}, [columnOption]);
|
|
37
|
-
var initValue = useMemo(function () {
|
|
38
|
-
return genDefaultData({
|
|
39
|
-
id: 0
|
|
40
|
-
});
|
|
41
|
-
}, [columnOption]);
|
|
42
|
-
useImperativeHandle(rechargeOptionRef, function () {
|
|
43
|
-
return {
|
|
44
|
-
openSortModal: function openSortModal() {
|
|
45
|
-
var _sortModalRef$current;
|
|
46
|
-
(_sortModalRef$current = sortModalRef.current) === null || _sortModalRef$current === void 0 ? void 0 : _sortModalRef$current.showModal();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// const handleSortModalOk = useCallback(
|
|
52
|
-
// (list: any[]) => {
|
|
53
|
-
// form.setFieldsValue({
|
|
54
|
-
// [name as string]: list,
|
|
55
|
-
// });
|
|
56
|
-
// sortModalRef.current?.hideModal();
|
|
57
|
-
// },
|
|
58
|
-
// [name]
|
|
59
|
-
// );
|
|
60
|
-
|
|
61
|
-
return /*#__PURE__*/_jsx("div", {
|
|
62
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
63
|
-
children: [/*#__PURE__*/_jsx(Row, {
|
|
64
|
-
gutter: 10,
|
|
65
|
-
style: {
|
|
66
|
-
marginBottom: '10px'
|
|
67
|
-
},
|
|
68
|
-
children: columnOption.map(function (item) {
|
|
69
|
-
return /*#__PURE__*/_jsx(Col, {
|
|
70
|
-
span: item.span,
|
|
71
|
-
children: item.label
|
|
72
|
-
}, item.label);
|
|
73
|
-
})
|
|
74
|
-
}), /*#__PURE__*/_jsx(Form.List, {
|
|
75
|
-
name: name,
|
|
76
|
-
initialValue: [initValue],
|
|
77
|
-
children: function children(fields, _ref) {
|
|
78
|
-
var add = _ref.add,
|
|
79
|
-
remove = _ref.remove;
|
|
80
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
81
|
-
children: [fields.map(function (bundle, i) {
|
|
82
|
-
return /*#__PURE__*/_jsx(Form.Item, {
|
|
83
|
-
noStyle: true,
|
|
84
|
-
children: /*#__PURE__*/_jsxs(Row, {
|
|
85
|
-
gutter: 10,
|
|
86
|
-
children: [columnOption.map(function (item) {
|
|
87
|
-
return /*#__PURE__*/_jsx(Col, {
|
|
88
|
-
span: item.span,
|
|
89
|
-
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
90
|
-
name: [bundle.name, item.field],
|
|
91
|
-
rules: item.rules,
|
|
92
|
-
children: /*#__PURE__*/_jsx(Input, {
|
|
93
|
-
style: {
|
|
94
|
-
width: '100%'
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
})
|
|
98
|
-
}, item.label);
|
|
99
|
-
}), isShowEditButton && /*#__PURE__*/_jsx(Col, {
|
|
100
|
-
span: 3,
|
|
101
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
102
|
-
onClick: function onClick() {
|
|
103
|
-
isFunction(onEditClick) && onEditClick(bundle);
|
|
104
|
-
},
|
|
105
|
-
children: editBtnText || getText('pisell-design.recharge.option.button.edit')
|
|
106
|
-
})
|
|
107
|
-
}), /*#__PURE__*/_jsx(Col, {
|
|
108
|
-
span: 2,
|
|
109
|
-
children: i !== 0 && /*#__PURE__*/_jsx(Button, {
|
|
110
|
-
icon: /*#__PURE__*/_jsx(DeleteOutlined, {}),
|
|
111
|
-
onClick: function onClick() {
|
|
112
|
-
remove(bundle.name);
|
|
113
|
-
}
|
|
114
|
-
})
|
|
115
|
-
})]
|
|
116
|
-
})
|
|
117
|
-
}, bundle.key);
|
|
118
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
119
|
-
onClick: function onClick() {
|
|
120
|
-
add(genDefaultData({
|
|
121
|
-
id: fields.length + 1
|
|
122
|
-
}));
|
|
123
|
-
},
|
|
124
|
-
children: addBtnText || getText('pisell-design.recharge.option.button.add')
|
|
125
|
-
})]
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
})]
|
|
129
|
-
})
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
export default RechargeOption;
|
|
File without changes
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { SelectProps } from 'antd5';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import './index.less';
|
|
4
|
-
declare type BaseValue = string | number;
|
|
5
|
-
declare type ColorValue = {
|
|
6
|
-
color: string;
|
|
7
|
-
value: BaseValue;
|
|
8
|
-
label: string;
|
|
9
|
-
};
|
|
10
|
-
declare type Value = BaseValue | ColorValue;
|
|
11
|
-
export interface SelectTagProps<T> extends Omit<SelectProps, 'options'> {
|
|
12
|
-
selectTagRef?: React.MutableRefObject<{
|
|
13
|
-
showModal: () => void;
|
|
14
|
-
hideModal: () => void;
|
|
15
|
-
}>;
|
|
16
|
-
value?: T[];
|
|
17
|
-
onChange?: (value: T[]) => void;
|
|
18
|
-
isColorSelect?: boolean;
|
|
19
|
-
options: {
|
|
20
|
-
value: BaseValue;
|
|
21
|
-
label: string;
|
|
22
|
-
}[];
|
|
23
|
-
}
|
|
24
|
-
declare const SelectTag: <T extends Value>(props: SelectTagProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export default SelectTag;
|