@farris/cli 1.0.22 → 1.0.23

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.
Files changed (2) hide show
  1. package/ci/cli.js +20 -15
  2. 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
- console.log(`update MonoWorkspace version to v${packageConfig.version}`);
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 commitChanges(updatedVersions, commitUrl) {
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
- const branch = childProcess.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
268
- console.log(`executing git push ${branch}`);
269
- // 提交变更集
270
- if (commitUrl) {
271
- return childProcess.exec("git", ["push", commitUrl]);
272
- } else {
273
- return childProcess.exec('git', ['push']);
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
- commitChanges(updatedVersions, commitUrl);
397
+ commitVersionChanges(updatedVersions, commitUrl);
398
+ updateMonoWorkspaceVersion(monoWorkspace, updateVersionType);
399
+ pushCommits(commitUrl);
395
400
  return Promise.resolve(monoWorkspace);
396
401
  });
397
402
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farris/cli",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "Farris command line interface",
5
5
  "main": "index.js",
6
6
  "scripts": {