@pisell/common 1.0.43 → 3.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/CHANGELOG.md +5 -126
- package/es/script/aws/index.js +7 -7
- package/es/script/uploadCode/index.js +37 -34
- package/lib/script/aws/index.js +3 -3
- package/lib/script/uploadCode/index.js +3 -1
- package/package.json +2 -2
- package/src/script/aws/index.js +5 -5
- package/src/script/uploadCode/index.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,143 +1,22 @@
|
|
|
1
1
|
# @pisell/common
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 3.0.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- add57fee8: xzero 不上传 oss
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## 3.0.1
|
|
10
10
|
|
|
11
11
|
### Patch Changes
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
- @pisell/utils@1.0.43
|
|
15
|
-
|
|
16
|
-
## 1.0.41
|
|
17
|
-
|
|
18
|
-
### Patch Changes
|
|
19
|
-
|
|
20
|
-
- Updated dependencies [0267536f]
|
|
21
|
-
- @pisell/utils@1.0.42
|
|
22
|
-
|
|
23
|
-
## 1.0.40
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- Updated dependencies [f3ed6fa4]
|
|
28
|
-
- @pisell/utils@1.0.41
|
|
29
|
-
|
|
30
|
-
## 1.0.39
|
|
31
|
-
|
|
32
|
-
### Patch Changes
|
|
33
|
-
|
|
34
|
-
- Updated dependencies [b848ae9a]
|
|
35
|
-
- @pisell/utils@1.0.40
|
|
36
|
-
|
|
37
|
-
## 1.0.38
|
|
38
|
-
|
|
39
|
-
### Patch Changes
|
|
40
|
-
|
|
41
|
-
- Updated dependencies [8640a624]
|
|
42
|
-
- @pisell/utils@1.0.39
|
|
43
|
-
|
|
44
|
-
## 1.0.37
|
|
45
|
-
|
|
46
|
-
### Patch Changes
|
|
47
|
-
|
|
48
|
-
- Updated dependencies [27cdd90e]
|
|
49
|
-
- @pisell/utils@1.0.38
|
|
50
|
-
|
|
51
|
-
## 1.0.36
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- Updated dependencies [30136d51]
|
|
56
|
-
- @pisell/utils@1.0.37
|
|
57
|
-
|
|
58
|
-
## 1.0.35
|
|
59
|
-
|
|
60
|
-
### Patch Changes
|
|
61
|
-
|
|
62
|
-
- Updated dependencies [a694c37e]
|
|
63
|
-
- @pisell/utils@1.0.36
|
|
64
|
-
|
|
65
|
-
## 1.0.34
|
|
66
|
-
|
|
67
|
-
### Patch Changes
|
|
68
|
-
|
|
69
|
-
- Updated dependencies [11c9a831]
|
|
70
|
-
- @pisell/utils@1.0.35
|
|
71
|
-
|
|
72
|
-
## 1.0.33
|
|
73
|
-
|
|
74
|
-
### Patch Changes
|
|
75
|
-
|
|
76
|
-
- Updated dependencies [881303a5]
|
|
77
|
-
- @pisell/utils@1.0.34
|
|
78
|
-
|
|
79
|
-
## 1.0.32
|
|
80
|
-
|
|
81
|
-
### Patch Changes
|
|
82
|
-
|
|
83
|
-
- Updated dependencies [fb6b699f]
|
|
84
|
-
- @pisell/utils@1.0.33
|
|
85
|
-
|
|
86
|
-
## 1.0.31
|
|
87
|
-
|
|
88
|
-
### Patch Changes
|
|
89
|
-
|
|
90
|
-
- Updated dependencies [bf60f3ca]
|
|
91
|
-
- @pisell/utils@1.0.32
|
|
92
|
-
|
|
93
|
-
## 1.0.30
|
|
94
|
-
|
|
95
|
-
### Patch Changes
|
|
96
|
-
|
|
97
|
-
- Updated dependencies [f7f80d68]
|
|
98
|
-
- @pisell/utils@1.0.31
|
|
99
|
-
|
|
100
|
-
## 1.0.29
|
|
101
|
-
|
|
102
|
-
### Patch Changes
|
|
103
|
-
|
|
104
|
-
- Updated dependencies [d41cf764]
|
|
105
|
-
- @pisell/utils@1.0.30
|
|
106
|
-
|
|
107
|
-
## 1.0.28
|
|
108
|
-
|
|
109
|
-
### Patch Changes
|
|
110
|
-
|
|
111
|
-
- Updated dependencies [f10f984b]
|
|
112
|
-
- @pisell/utils@1.0.29
|
|
13
|
+
- f8847ef9a: s
|
|
113
14
|
|
|
114
15
|
## 1.0.27
|
|
115
16
|
|
|
116
17
|
### Patch Changes
|
|
117
18
|
|
|
118
|
-
-
|
|
119
|
-
- @pisell/utils@1.0.28
|
|
120
|
-
|
|
121
|
-
## 1.0.26
|
|
122
|
-
|
|
123
|
-
### Patch Changes
|
|
124
|
-
|
|
125
|
-
- Updated dependencies [a45e6cd5]
|
|
126
|
-
- @pisell/utils@1.0.27
|
|
127
|
-
|
|
128
|
-
## 1.0.25
|
|
129
|
-
|
|
130
|
-
### Patch Changes
|
|
131
|
-
|
|
132
|
-
- Updated dependencies [961d44f7]
|
|
133
|
-
- @pisell/utils@1.0.26
|
|
134
|
-
|
|
135
|
-
## 1.0.24
|
|
136
|
-
|
|
137
|
-
### Patch Changes
|
|
138
|
-
|
|
139
|
-
- Updated dependencies [10083f21]
|
|
140
|
-
- @pisell/utils@1.0.25
|
|
19
|
+
- 7b7637320: s
|
|
141
20
|
|
|
142
21
|
## 1.0.26
|
|
143
22
|
|
package/es/script/aws/index.js
CHANGED
|
@@ -23,14 +23,14 @@ var bucketName = '';
|
|
|
23
23
|
* @Date: 2023-11-24 14:05
|
|
24
24
|
*/
|
|
25
25
|
var init = /*#__PURE__*/function () {
|
|
26
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
26
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(directory) {
|
|
27
27
|
var serverConfig, awsConfig;
|
|
28
28
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29
29
|
while (1) switch (_context.prev = _context.next) {
|
|
30
30
|
case 0:
|
|
31
31
|
_context.prev = 0;
|
|
32
32
|
_context.next = 3;
|
|
33
|
-
return getServerConfig(
|
|
33
|
+
return getServerConfig(directory);
|
|
34
34
|
case 3:
|
|
35
35
|
serverConfig = _context.sent;
|
|
36
36
|
// aws配置
|
|
@@ -68,7 +68,7 @@ var init = /*#__PURE__*/function () {
|
|
|
68
68
|
}
|
|
69
69
|
}, _callee, null, [[0, 16]]);
|
|
70
70
|
}));
|
|
71
|
-
return function init() {
|
|
71
|
+
return function init(_x) {
|
|
72
72
|
return _ref.apply(this, arguments);
|
|
73
73
|
};
|
|
74
74
|
}();
|
|
@@ -113,7 +113,7 @@ var uploadFile = /*#__PURE__*/function () {
|
|
|
113
113
|
}
|
|
114
114
|
}, _callee2, null, [[4, 12]]);
|
|
115
115
|
}));
|
|
116
|
-
return function uploadFile(
|
|
116
|
+
return function uploadFile(_x2, _x3, _x4) {
|
|
117
117
|
return _ref2.apply(this, arguments);
|
|
118
118
|
};
|
|
119
119
|
}();
|
|
@@ -182,7 +182,7 @@ export var uploadFolderContents = /*#__PURE__*/function () {
|
|
|
182
182
|
}
|
|
183
183
|
}, _callee3);
|
|
184
184
|
}));
|
|
185
|
-
return function uploadFolderContents(
|
|
185
|
+
return function uploadFolderContents(_x5) {
|
|
186
186
|
return _ref3.apply(this, arguments);
|
|
187
187
|
};
|
|
188
188
|
}();
|
|
@@ -203,7 +203,7 @@ export var uploadStaticToOSS = /*#__PURE__*/function () {
|
|
|
203
203
|
case 0:
|
|
204
204
|
folderPath = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : path.resolve(__dirname, 'dist');
|
|
205
205
|
_context4.next = 3;
|
|
206
|
-
return init();
|
|
206
|
+
return init(directory);
|
|
207
207
|
case 3:
|
|
208
208
|
return _context4.abrupt("return", uploadFolderContents(directory, folderPath));
|
|
209
209
|
case 4:
|
|
@@ -212,7 +212,7 @@ export var uploadStaticToOSS = /*#__PURE__*/function () {
|
|
|
212
212
|
}
|
|
213
213
|
}, _callee4);
|
|
214
214
|
}));
|
|
215
|
-
return function uploadStaticToOSS(
|
|
215
|
+
return function uploadStaticToOSS(_x6) {
|
|
216
216
|
return _ref4.apply(this, arguments);
|
|
217
217
|
};
|
|
218
218
|
}();
|
|
@@ -163,7 +163,7 @@ function _init() {
|
|
|
163
163
|
console.log('使用本地/dist');
|
|
164
164
|
case 35:
|
|
165
165
|
if (!(res.env === 'prod')) {
|
|
166
|
-
_context.next =
|
|
166
|
+
_context.next = 42;
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
_fileName = res.project.fileName;
|
|
@@ -173,32 +173,35 @@ function _init() {
|
|
|
173
173
|
if (_fileName === 'admin') {
|
|
174
174
|
_fileName = 'my_pisell_v2';
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
if (!(_fileName !== 'xzero')) {
|
|
177
|
+
_context.next = 42;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
_context.next = 42;
|
|
178
181
|
return uploadStaticToOSS(_fileName);
|
|
179
|
-
case
|
|
182
|
+
case 42:
|
|
180
183
|
console.log('开始压缩');
|
|
181
|
-
_context.next =
|
|
184
|
+
_context.next = 45;
|
|
182
185
|
return uploadCode.compress();
|
|
183
|
-
case
|
|
186
|
+
case 45:
|
|
184
187
|
console.log('✅ 压缩完成');
|
|
185
188
|
console.log('开始连接服务器');
|
|
186
|
-
_context.next =
|
|
189
|
+
_context.next = 49;
|
|
187
190
|
return uploadCode.connectServer();
|
|
188
|
-
case
|
|
191
|
+
case 49:
|
|
189
192
|
conn = _context.sent;
|
|
190
193
|
console.log('✅ 连接服务器完成');
|
|
191
194
|
console.log('开始上传');
|
|
192
|
-
_context.next =
|
|
195
|
+
_context.next = 54;
|
|
193
196
|
return uploadCode.serverUpload();
|
|
194
|
-
case
|
|
197
|
+
case 54:
|
|
195
198
|
console.log('✅ 上传完成');
|
|
196
199
|
console.log('开始解压');
|
|
197
|
-
_context.next =
|
|
200
|
+
_context.next = 58;
|
|
198
201
|
return uploadCode.serverUnpack();
|
|
199
|
-
case
|
|
202
|
+
case 58:
|
|
200
203
|
if (!res.is_release) {
|
|
201
|
-
_context.next =
|
|
204
|
+
_context.next = 63;
|
|
202
205
|
break;
|
|
203
206
|
}
|
|
204
207
|
releaseInstance = new Release({
|
|
@@ -208,32 +211,32 @@ function _init() {
|
|
|
208
211
|
conn: conn
|
|
209
212
|
});
|
|
210
213
|
console.log('开始发布');
|
|
211
|
-
_context.next =
|
|
214
|
+
_context.next = 63;
|
|
212
215
|
return releaseInstance.release();
|
|
213
|
-
case
|
|
214
|
-
_context.next =
|
|
216
|
+
case 63:
|
|
217
|
+
_context.next = 65;
|
|
215
218
|
return uploadCode.disconnectServer();
|
|
216
|
-
case
|
|
217
|
-
_context.next =
|
|
219
|
+
case 65:
|
|
220
|
+
_context.next = 67;
|
|
218
221
|
return $(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["git pull --no-edit"])));
|
|
219
|
-
case
|
|
220
|
-
_context.next =
|
|
222
|
+
case 67:
|
|
223
|
+
_context.next = 69;
|
|
221
224
|
return $(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["git push --follow-tags"])));
|
|
222
|
-
case
|
|
225
|
+
case 69:
|
|
223
226
|
console.log('✅ 成功后推送到git');
|
|
224
|
-
_context.next =
|
|
227
|
+
_context.next = 81;
|
|
225
228
|
break;
|
|
226
|
-
case
|
|
227
|
-
_context.prev =
|
|
229
|
+
case 72:
|
|
230
|
+
_context.prev = 72;
|
|
228
231
|
_context.t0 = _context["catch"](26);
|
|
229
232
|
console.log(_context.t0, '执行出错 请排查重试');
|
|
230
|
-
_context.next =
|
|
233
|
+
_context.next = 77;
|
|
231
234
|
return $(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["git reset HEAD~1"])));
|
|
232
|
-
case
|
|
233
|
-
_context.next =
|
|
235
|
+
case 77:
|
|
236
|
+
_context.next = 79;
|
|
234
237
|
return $(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["git tag -d v", ""])), uploadCode.currentVersion);
|
|
235
|
-
case
|
|
236
|
-
_context.next =
|
|
238
|
+
case 79:
|
|
239
|
+
_context.next = 81;
|
|
237
240
|
return sendWebhook({
|
|
238
241
|
title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u5931\u8D25"),
|
|
239
242
|
content: [{
|
|
@@ -247,8 +250,8 @@ function _init() {
|
|
|
247
250
|
value: version || ''
|
|
248
251
|
}]
|
|
249
252
|
});
|
|
250
|
-
case
|
|
251
|
-
_context.next =
|
|
253
|
+
case 81:
|
|
254
|
+
_context.next = 83;
|
|
252
255
|
return sendWebhook({
|
|
253
256
|
title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u6210\u529F"),
|
|
254
257
|
content: [{
|
|
@@ -262,13 +265,13 @@ function _init() {
|
|
|
262
265
|
value: version || ''
|
|
263
266
|
}]
|
|
264
267
|
});
|
|
265
|
-
case 82:
|
|
266
|
-
uploadCode.deleteLocalZip();
|
|
267
268
|
case 83:
|
|
269
|
+
uploadCode.deleteLocalZip();
|
|
270
|
+
case 84:
|
|
268
271
|
case "end":
|
|
269
272
|
return _context.stop();
|
|
270
273
|
}
|
|
271
|
-
}, _callee, null, [[26,
|
|
274
|
+
}, _callee, null, [[26, 72]]);
|
|
272
275
|
}));
|
|
273
276
|
return _init.apply(this, arguments);
|
|
274
277
|
}
|
package/lib/script/aws/index.js
CHANGED
|
@@ -42,9 +42,9 @@ var filterFiles = ["index.html", "umi.server.js", "umi.server.d.ts"];
|
|
|
42
42
|
var __dirname = process.cwd();
|
|
43
43
|
var s3Client = null;
|
|
44
44
|
var bucketName = "";
|
|
45
|
-
var init = async () => {
|
|
45
|
+
var init = async (directory) => {
|
|
46
46
|
try {
|
|
47
|
-
const serverConfig = await (0, import_utils.getServerConfig)(
|
|
47
|
+
const serverConfig = await (0, import_utils.getServerConfig)(directory);
|
|
48
48
|
let awsConfig = serverConfig.aws;
|
|
49
49
|
if (awsConfig) {
|
|
50
50
|
bucketName = awsConfig.bucketName;
|
|
@@ -115,7 +115,7 @@ var uploadFolderContents = async (directory, folderPath = import_path.default.re
|
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
117
|
var uploadStaticToOSS = async (directory, folderPath = import_path.default.resolve(__dirname, "dist")) => {
|
|
118
|
-
await init();
|
|
118
|
+
await init(directory);
|
|
119
119
|
return uploadFolderContents(directory, folderPath);
|
|
120
120
|
};
|
|
121
121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -153,7 +153,9 @@ async function init() {
|
|
|
153
153
|
if (_fileName === "admin") {
|
|
154
154
|
_fileName = "my_pisell_v2";
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
if (_fileName !== "xzero") {
|
|
157
|
+
await (0, import_aws.uploadStaticToOSS)(_fileName);
|
|
158
|
+
}
|
|
157
159
|
}
|
|
158
160
|
console.log("开始压缩");
|
|
159
161
|
await uploadCode.compress();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.less"
|
|
6
6
|
],
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"archiver": "^5.3.1",
|
|
21
21
|
"dotenv": "^16.0.3",
|
|
22
22
|
"ssh2": "^1.13.0",
|
|
23
|
-
"@pisell/utils": "1.0.
|
|
23
|
+
"@pisell/utils": "1.0.42"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"father": "^4.1.6"
|
package/src/script/aws/index.js
CHANGED
|
@@ -15,10 +15,10 @@ let bucketName = '';
|
|
|
15
15
|
* @Author: zhiwei.Wang
|
|
16
16
|
* @Date: 2023-11-24 14:05
|
|
17
17
|
*/
|
|
18
|
-
const init = async () => {
|
|
18
|
+
const init = async (directory) => {
|
|
19
19
|
try {
|
|
20
20
|
// 读取本地config
|
|
21
|
-
const serverConfig = await getServerConfig(
|
|
21
|
+
const serverConfig = await getServerConfig(directory);
|
|
22
22
|
|
|
23
23
|
// aws配置
|
|
24
24
|
let awsConfig = serverConfig.aws;
|
|
@@ -84,7 +84,7 @@ const uploadFile = async (directory, fileKey, filePath) => {
|
|
|
84
84
|
*/
|
|
85
85
|
export const uploadFolderContents = async (
|
|
86
86
|
directory,
|
|
87
|
-
folderPath = path.resolve(__dirname, 'dist')
|
|
87
|
+
folderPath = path.resolve(__dirname, 'dist')
|
|
88
88
|
) => {
|
|
89
89
|
const files = fs.readdirSync(folderPath);
|
|
90
90
|
|
|
@@ -129,10 +129,10 @@ export const uploadFolderContents = async (
|
|
|
129
129
|
*/
|
|
130
130
|
export const uploadStaticToOSS = async (
|
|
131
131
|
directory,
|
|
132
|
-
folderPath = path.resolve(__dirname, 'dist')
|
|
132
|
+
folderPath = path.resolve(__dirname, 'dist')
|
|
133
133
|
) => {
|
|
134
134
|
// 初始化aws
|
|
135
|
-
await init();
|
|
135
|
+
await init(directory);
|
|
136
136
|
|
|
137
137
|
return uploadFolderContents(directory, folderPath);
|
|
138
138
|
};
|
|
@@ -146,8 +146,10 @@ async function init() {
|
|
|
146
146
|
if (_fileName === 'admin') {
|
|
147
147
|
_fileName = 'my_pisell_v2'
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
if (_fileName !== 'xzero') {
|
|
150
|
+
// 上传oss
|
|
151
|
+
await uploadStaticToOSS(_fileName);
|
|
152
|
+
}
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
console.log('开始压缩');
|