@farris/cli 1.0.22 → 1.0.23
Sign up to get free protection for your applications and to get access to all the features.
- package/ci/cli.js +20 -15
- package/package.json +1 -1
package/ci/cli.js
CHANGED
@@ -234,10 +234,15 @@ 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
|
-
|
241
|
+
// 向git缓冲区中添加变更
|
242
|
+
childProcess.execSync('git', ['add', '.']);
|
243
|
+
// // 提交变更记录
|
244
|
+
childProcess.execSync('git', ['commit', '-m', `Update MonoWorkspace version to v${packageConfig.version}`]);
|
245
|
+
console.log(`Update MonoWorkspace version to v${packageConfig.version}`);
|
241
246
|
monoWorkspace.version = packageConfig.version;
|
242
247
|
}
|
243
248
|
|
@@ -253,7 +258,7 @@ function builderVersionChangeMessage(prefix, updatedVersions, suffix = '') {
|
|
253
258
|
return `${versionMessage} ${suffix}`;
|
254
259
|
}
|
255
260
|
|
256
|
-
function
|
261
|
+
function commitVersionChanges(updatedVersions) {
|
257
262
|
const commitMessage = builderVersionChangeMessage('Update', updatedVersions, '. [skip ci]');
|
258
263
|
|
259
264
|
if (commitMessage) {
|
@@ -263,15 +268,17 @@ function commitChanges(updatedVersions, commitUrl) {
|
|
263
268
|
childProcess.execSync('git', ['commit', '-m', `${commitMessage}`]);
|
264
269
|
|
265
270
|
console.log(commitMessage);
|
271
|
+
}
|
272
|
+
}
|
266
273
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
274
|
+
function pushCommits(commitUrl) {
|
275
|
+
const branch = childProcess.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
276
|
+
console.log(`executing git push ${branch}`);
|
277
|
+
// 提交变更集
|
278
|
+
if (commitUrl) {
|
279
|
+
return childProcess.exec("git", ["push", commitUrl]);
|
280
|
+
} else {
|
281
|
+
return childProcess.exec('git', ['push']);
|
275
282
|
}
|
276
283
|
}
|
277
284
|
|
@@ -379,9 +386,6 @@ function publish(commitUrl, updateVersionType) {
|
|
379
386
|
chain = chain.then(monoWorkspace => {
|
380
387
|
const changedProjects = monoWorkspace.changedProjects;
|
381
388
|
const prereleasePromise = changedProjects.map(projectInfo => updateProjectVersion(projectInfo, updateVersionType));
|
382
|
-
if (changedProjects) {
|
383
|
-
|
384
|
-
}
|
385
389
|
return Promise.all(prereleasePromise)
|
386
390
|
.then((results) => {
|
387
391
|
results.reduce((workspace, updateResult) => {
|
@@ -389,9 +393,10 @@ function publish(commitUrl, updateVersionType) {
|
|
389
393
|
Object.assign(workspace.updateResult, updateResult);
|
390
394
|
return workspace;
|
391
395
|
}, monoWorkspace);
|
392
|
-
updateMonoWorkspaceVersion(monoWorkspace, updateVersionType);
|
393
396
|
const updatedVersions = monoWorkspace.updateResult;
|
394
|
-
|
397
|
+
commitVersionChanges(updatedVersions, commitUrl);
|
398
|
+
updateMonoWorkspaceVersion(monoWorkspace, updateVersionType);
|
399
|
+
pushCommits(commitUrl);
|
395
400
|
return Promise.resolve(monoWorkspace);
|
396
401
|
});
|
397
402
|
});
|