@farris/cli 1.0.4 → 1.0.7

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 +11 -3
  2. package/package.json +1 -1
package/ci/cli.js CHANGED
@@ -29,12 +29,13 @@ cli
29
29
  },
30
30
  (argv) => {
31
31
  const project = argv.project;
32
+ const url = argv.url;
32
33
  let chain = Promise.resolve();
33
34
 
34
35
  chain = chain.then(() => checkProjectChanges(project));
35
36
  chain = chain.then((hasChanged) => {
36
37
  if (hasChanged) {
37
- return updateProjectPrereleaseVersion(project)
38
+ return updateProjectPrereleaseVersion(project, url)
38
39
  }
39
40
  });
40
41
  }
@@ -88,7 +89,7 @@ function checkProjectChanges(projectPath) {
88
89
  * @param {string} projectPath 目标工程路径
89
90
  * @returns 更新后的版本
90
91
  */
91
- function updateProjectPrereleaseVersion(projectPath) {
92
+ function updateProjectPrereleaseVersion(projectPath, projectUrl) {
92
93
  return childProcess
93
94
  // 使用 npm version prerelease 更新指定工程的预发布版本
94
95
  .exec('npm', ['version', 'prerelease', '--preid=beta', '--prefix', projectPath])
@@ -103,8 +104,15 @@ function updateProjectPrereleaseVersion(projectPath) {
103
104
  // 提交变更记录
104
105
  childProcess.execSync('git', ['commit', '-m', `update ${packageConfig.name} prerelease version to ${updatedVersion}`]);
105
106
  console.log(`update ${packageConfig.name} prerelease version to ${updatedVersion}`);
107
+
108
+ const branch = childProcess.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
109
+ console.log(`executing git push ${branch}`);
106
110
  // 提交变更集
107
- return childProcess.exec('git', ['push']);
111
+ if (projectUrl) {
112
+ return childProcess.exec("git", ["push", projectUrl]);
113
+ } else {
114
+ return childProcess.exec('git', ['push']);
115
+ }
108
116
  })
109
117
  }
110
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farris/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "description": "Farris command line interface",
5
5
  "main": "index.js",
6
6
  "scripts": {