@pisell/common 0.0.23 → 0.0.25
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.
|
@@ -69,6 +69,15 @@ var inquirerResult = function inquirerResult() {
|
|
|
69
69
|
function init() {
|
|
70
70
|
return _init.apply(this, arguments);
|
|
71
71
|
}
|
|
72
|
+
/*******
|
|
73
|
+
* @title: 版本号更新
|
|
74
|
+
* @description:
|
|
75
|
+
* @param {*} params
|
|
76
|
+
* @param {*} env
|
|
77
|
+
* @return {*}
|
|
78
|
+
* @Author: chensheng.gu
|
|
79
|
+
* @Date: 2023-11-02 15:56
|
|
80
|
+
*/
|
|
72
81
|
function _init() {
|
|
73
82
|
_init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
74
83
|
var res, uploadCode, version, currentUserName, result, conn, releaseInstance;
|
|
@@ -213,6 +222,12 @@ function _init() {
|
|
|
213
222
|
});
|
|
214
223
|
case 70:
|
|
215
224
|
_context.next = 72;
|
|
225
|
+
return updateVersion({
|
|
226
|
+
version: version,
|
|
227
|
+
changelog: res.changelog
|
|
228
|
+
}, res.env);
|
|
229
|
+
case 72:
|
|
230
|
+
_context.next = 74;
|
|
216
231
|
return sendWebhook({
|
|
217
232
|
title: "".concat(res.project.fileName, " ").concat(res.env, "\u73AF\u5883").concat(res.is_release ? '上传并发布' : '上传', "\u6210\u529F"),
|
|
218
233
|
content: [{
|
|
@@ -226,9 +241,9 @@ function _init() {
|
|
|
226
241
|
value: version || ''
|
|
227
242
|
}]
|
|
228
243
|
});
|
|
229
|
-
case
|
|
244
|
+
case 74:
|
|
230
245
|
uploadCode.deleteLocalZip();
|
|
231
|
-
case
|
|
246
|
+
case 75:
|
|
232
247
|
case "end":
|
|
233
248
|
return _context.stop();
|
|
234
249
|
}
|
|
@@ -236,6 +251,41 @@ function _init() {
|
|
|
236
251
|
}));
|
|
237
252
|
return _init.apply(this, arguments);
|
|
238
253
|
}
|
|
254
|
+
function updateVersion(_x, _x2) {
|
|
255
|
+
return _updateVersion.apply(this, arguments);
|
|
256
|
+
}
|
|
257
|
+
function _updateVersion() {
|
|
258
|
+
_updateVersion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, env) {
|
|
259
|
+
var host;
|
|
260
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
261
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
262
|
+
case 0:
|
|
263
|
+
host = {
|
|
264
|
+
release: 'https://dev.pisellapi.com',
|
|
265
|
+
pre: 'https://pre.pisellapi.com',
|
|
266
|
+
prod: 'https://pisellapi.com'
|
|
267
|
+
};
|
|
268
|
+
fetch(host[env] + '/core/management-version', {
|
|
269
|
+
method: 'POST',
|
|
270
|
+
headers: {
|
|
271
|
+
'Content-Type': 'application/json'
|
|
272
|
+
},
|
|
273
|
+
body: JSON.stringify(params)
|
|
274
|
+
}).then(function (response) {
|
|
275
|
+
if (response.status === 200) {
|
|
276
|
+
console.log('✅版本号上传成功!');
|
|
277
|
+
}
|
|
278
|
+
}).catch(function (error) {
|
|
279
|
+
console.log('错误:', error);
|
|
280
|
+
});
|
|
281
|
+
case 2:
|
|
282
|
+
case "end":
|
|
283
|
+
return _context2.stop();
|
|
284
|
+
}
|
|
285
|
+
}, _callee2);
|
|
286
|
+
}));
|
|
287
|
+
return _updateVersion.apply(this, arguments);
|
|
288
|
+
}
|
|
239
289
|
export default init;
|
|
240
290
|
|
|
241
291
|
/**
|
package/es/script/utils/index.js
CHANGED
|
@@ -327,7 +327,9 @@ var checkPkgVersion = /*#__PURE__*/function () {
|
|
|
327
327
|
while (1) switch (_context6.prev = _context6.next) {
|
|
328
328
|
case 0:
|
|
329
329
|
_context6.next = 2;
|
|
330
|
-
return npmCheck(
|
|
330
|
+
return npmCheck({
|
|
331
|
+
skipUnused: true
|
|
332
|
+
});
|
|
331
333
|
case 2:
|
|
332
334
|
currentState = _context6.sent;
|
|
333
335
|
pkgs = currentState.get('packages');
|
|
@@ -178,6 +178,13 @@ async function init() {
|
|
|
178
178
|
]
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
+
await updateVersion(
|
|
182
|
+
{
|
|
183
|
+
version,
|
|
184
|
+
changelog: res.changelog
|
|
185
|
+
},
|
|
186
|
+
res.env
|
|
187
|
+
);
|
|
181
188
|
await (0, import_utils.sendWebhook)({
|
|
182
189
|
title: `${res.project.fileName} ${res.env}环境${res.is_release ? "上传并发布" : "上传"}成功`,
|
|
183
190
|
content: [
|
|
@@ -197,6 +204,26 @@ async function init() {
|
|
|
197
204
|
});
|
|
198
205
|
uploadCode.deleteLocalZip();
|
|
199
206
|
}
|
|
207
|
+
async function updateVersion(params, env) {
|
|
208
|
+
const host = {
|
|
209
|
+
release: "https://dev.pisellapi.com",
|
|
210
|
+
pre: "https://pre.pisellapi.com",
|
|
211
|
+
prod: "https://pisellapi.com"
|
|
212
|
+
};
|
|
213
|
+
fetch(host[env] + "/core/management-version", {
|
|
214
|
+
method: "POST",
|
|
215
|
+
headers: {
|
|
216
|
+
"Content-Type": "application/json"
|
|
217
|
+
},
|
|
218
|
+
body: JSON.stringify(params)
|
|
219
|
+
}).then((response) => {
|
|
220
|
+
if (response.status === 200) {
|
|
221
|
+
console.log("✅版本号上传成功!");
|
|
222
|
+
}
|
|
223
|
+
}).catch((error) => {
|
|
224
|
+
console.log("错误:", error);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
200
227
|
var uploadCode_default = init;
|
|
201
228
|
// Annotate the CommonJS export names for ESM import in node:
|
|
202
229
|
0 && (module.exports = {});
|
|
@@ -235,7 +235,7 @@ var sendWebhook = async ({ title, content }) => {
|
|
|
235
235
|
return await response.json();
|
|
236
236
|
};
|
|
237
237
|
var checkPkgVersion = async (checkPackages) => {
|
|
238
|
-
const currentState = await (0, import_npm_check.default)();
|
|
238
|
+
const currentState = await (0, import_npm_check.default)({ skipUnused: true });
|
|
239
239
|
const pkgs = currentState.get("packages");
|
|
240
240
|
const wrongPkg = pkgs.filter((item) => {
|
|
241
241
|
return checkPackages.includes(item.moduleName) && item.mismatch;
|