@farris/cli 1.0.23 → 1.0.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/ci/cli.js +21 -17
  2. 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':
@@ -238,12 +238,20 @@ function updateMonoWorkspaceVersion(monoWorkspace, updateVersionType) {
238
238
  childProcess.execSync('npm', npmCommandArray);
239
239
  const packageJsonFilePath = `./package.json`;
240
240
  const packageConfig = JSON.parse(fs.readFileSync(packageJsonFilePath, 'utf-8'));
241
+ monoWorkspace.version = packageConfig.version;
241
242
  // 向git缓冲区中添加变更
242
243
  childProcess.execSync('git', ['add', '.']);
243
244
  // // 提交变更记录
244
- childProcess.execSync('git', ['commit', '-m', `Update MonoWorkspace version to v${packageConfig.version}`]);
245
+ childProcess.execSync('git', ['commit', '-m', `Update MonoWorkspace version to v${packageConfig.version}. [skip ci]`]);
245
246
  console.log(`Update MonoWorkspace version to v${packageConfig.version}`);
246
- monoWorkspace.version = packageConfig.version;
247
+ const branch = childProcess.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
248
+ console.log(`executing git push ${branch}`);
249
+ // 提交变更集
250
+ if (commitUrl) {
251
+ childProcess.execSync("git", ["push", commitUrl]);
252
+ } else {
253
+ childProcess.execSync('git', ['push']);
254
+ }
247
255
  }
248
256
 
249
257
  function builderVersionChangeMessage(prefix, updatedVersions, suffix = '') {
@@ -258,7 +266,7 @@ function builderVersionChangeMessage(prefix, updatedVersions, suffix = '') {
258
266
  return `${versionMessage} ${suffix}`;
259
267
  }
260
268
 
261
- function commitVersionChanges(updatedVersions) {
269
+ function commitVersionChanges(updatedVersions, commitUrl) {
262
270
  const commitMessage = builderVersionChangeMessage('Update', updatedVersions, '. [skip ci]');
263
271
 
264
272
  if (commitMessage) {
@@ -268,24 +276,21 @@ function commitVersionChanges(updatedVersions) {
268
276
  childProcess.execSync('git', ['commit', '-m', `${commitMessage}`]);
269
277
 
270
278
  console.log(commitMessage);
271
- }
272
- }
273
279
 
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']);
280
+ const branch = childProcess.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
281
+ console.log(`executing git push ${branch}`);
282
+ // 提交变更集
283
+ if (commitUrl) {
284
+ childProcess.execSync("git", ["push", commitUrl]);
285
+ } else {
286
+ childProcess.execSync('git', ['push']);
287
+ }
282
288
  }
283
289
  }
284
290
 
285
291
  function buildWorkspace(workspace) {
286
292
  console.log(`executing lerna run build --scope=${workspace.packageName}`)
287
293
  return childProcess.exec('lerna', ['run', 'build', `--scope=${workspace.packageName}`]);
288
- // lerna run build --scope=@farris/ide-framework
289
294
  }
290
295
 
291
296
  function addTagToMonoWorkspace(monoWorkspace, commitUrl) {
@@ -395,8 +400,7 @@ function publish(commitUrl, updateVersionType) {
395
400
  }, monoWorkspace);
396
401
  const updatedVersions = monoWorkspace.updateResult;
397
402
  commitVersionChanges(updatedVersions, commitUrl);
398
- updateMonoWorkspaceVersion(monoWorkspace, updateVersionType);
399
- pushCommits(commitUrl);
403
+ updateMonoWorkspaceVersion(monoWorkspace, updateVersionType, commitUrl);
400
404
  return Promise.resolve(monoWorkspace);
401
405
  });
402
406
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farris/cli",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Farris command line interface",
5
5
  "main": "index.js",
6
6
  "scripts": {