@farris/cli 1.0.22 → 1.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.
- package/ci/cli.js +28 -12
- package/package.json +1 -1
package/ci/cli.js
CHANGED
@@ -218,7 +218,7 @@ function updateProjectVersion(projectInfo, updateVersionType) {
|
|
218
218
|
})
|
219
219
|
}
|
220
220
|
|
221
|
-
function updateMonoWorkspaceVersion(monoWorkspace, updateVersionType) {
|
221
|
+
function updateMonoWorkspaceVersion(monoWorkspace, updateVersionType, commitUrl) {
|
222
222
|
let npmCommandArray = [];
|
223
223
|
switch (updateVersionType) {
|
224
224
|
case 'prerelease':
|
@@ -234,11 +234,25 @@ function updateMonoWorkspaceVersion(monoWorkspace, updateVersionType) {
|
|
234
234
|
npmCommandArray = ['version', 'major'];
|
235
235
|
break;
|
236
236
|
}
|
237
|
+
console.log(`executing npm version --${updateVersionType} in root directory.`)
|
237
238
|
childProcess.execSync('npm', npmCommandArray);
|
238
239
|
const packageJsonFilePath = `./package.json`;
|
239
240
|
const packageConfig = JSON.parse(fs.readFileSync(packageJsonFilePath, 'utf-8'));
|
240
|
-
console.log(`update MonoWorkspace version to v${packageConfig.version}`);
|
241
241
|
monoWorkspace.version = packageConfig.version;
|
242
|
+
// 向git缓冲区中添加变更
|
243
|
+
childProcess.execSync('git', ['add', '.']);
|
244
|
+
// // 提交变更记录
|
245
|
+
childProcess.execSync('git', ['commit', '-m', `Update MonoWorkspace version to v${packageConfig.version}. [skip ci]`]);
|
246
|
+
console.log(`Update MonoWorkspace version to v${packageConfig.version}`);
|
247
|
+
const branch = childProcess.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
248
|
+
// 提交变更集
|
249
|
+
if (commitUrl) {
|
250
|
+
console.log(`executing git push ${branch} to ${commitUrl}`);
|
251
|
+
return childProcess.exec("git", ["push", commitUrl]);
|
252
|
+
} else {
|
253
|
+
console.log(`executing git push ${branch}`);
|
254
|
+
return childProcess.exec('git', ['push']);
|
255
|
+
}
|
242
256
|
}
|
243
257
|
|
244
258
|
function builderVersionChangeMessage(prefix, updatedVersions, suffix = '') {
|
@@ -253,8 +267,8 @@ function builderVersionChangeMessage(prefix, updatedVersions, suffix = '') {
|
|
253
267
|
return `${versionMessage} ${suffix}`;
|
254
268
|
}
|
255
269
|
|
256
|
-
function
|
257
|
-
const commitMessage = builderVersionChangeMessage('Update', updatedVersions, '
|
270
|
+
function commitVersionChanges(updatedVersions, commitUrl) {
|
271
|
+
const commitMessage = builderVersionChangeMessage('Update', updatedVersions, ' [skip ci]');
|
258
272
|
|
259
273
|
if (commitMessage) {
|
260
274
|
// 向git缓冲区中添加变更
|
@@ -265,11 +279,13 @@ function commitChanges(updatedVersions, commitUrl) {
|
|
265
279
|
console.log(commitMessage);
|
266
280
|
|
267
281
|
const branch = childProcess.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
268
|
-
|
282
|
+
|
269
283
|
// 提交变更集
|
270
284
|
if (commitUrl) {
|
285
|
+
console.log(`executing git push ${branch} to ${commitUrl}`);
|
271
286
|
return childProcess.exec("git", ["push", commitUrl]);
|
272
287
|
} else {
|
288
|
+
console.log(`executing git push ${branch}`);
|
273
289
|
return childProcess.exec('git', ['push']);
|
274
290
|
}
|
275
291
|
}
|
@@ -278,7 +294,6 @@ function commitChanges(updatedVersions, commitUrl) {
|
|
278
294
|
function buildWorkspace(workspace) {
|
279
295
|
console.log(`executing lerna run build --scope=${workspace.packageName}`)
|
280
296
|
return childProcess.exec('lerna', ['run', 'build', `--scope=${workspace.packageName}`]);
|
281
|
-
// lerna run build --scope=@farris/ide-framework
|
282
297
|
}
|
283
298
|
|
284
299
|
function addTagToMonoWorkspace(monoWorkspace, commitUrl) {
|
@@ -379,9 +394,6 @@ function publish(commitUrl, updateVersionType) {
|
|
379
394
|
chain = chain.then(monoWorkspace => {
|
380
395
|
const changedProjects = monoWorkspace.changedProjects;
|
381
396
|
const prereleasePromise = changedProjects.map(projectInfo => updateProjectVersion(projectInfo, updateVersionType));
|
382
|
-
if (changedProjects) {
|
383
|
-
|
384
|
-
}
|
385
397
|
return Promise.all(prereleasePromise)
|
386
398
|
.then((results) => {
|
387
399
|
results.reduce((workspace, updateResult) => {
|
@@ -389,10 +401,14 @@ function publish(commitUrl, updateVersionType) {
|
|
389
401
|
Object.assign(workspace.updateResult, updateResult);
|
390
402
|
return workspace;
|
391
403
|
}, monoWorkspace);
|
392
|
-
updateMonoWorkspaceVersion(monoWorkspace, updateVersionType);
|
393
404
|
const updatedVersions = monoWorkspace.updateResult;
|
394
|
-
|
395
|
-
|
405
|
+
return commitVersionChanges(updatedVersions, commitUrl)
|
406
|
+
.then((result) => {
|
407
|
+
return updateMonoWorkspaceVersion(monoWorkspace, updateVersionType, commitUrl);
|
408
|
+
})
|
409
|
+
.then((reulst) => {
|
410
|
+
return Promise.resolve(monoWorkspace);
|
411
|
+
});
|
396
412
|
});
|
397
413
|
});
|
398
414
|
// 5. 编译所有Angular工作区
|