@farris/cli 1.0.6 → 1.0.7

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 +11 -8
  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,13 +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}`);
106
- // 提交变更集
107
- // return childProcess.exec('git', ['push']);
107
+
108
108
  const branch = childProcess.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
109
- console.log(`executing git push origin ${branch}`);
110
- const url = `https://project_4166_bot:8sTE2mjQyAycz13EPJAA@git.iec.io/webadp/farris-ide.git/`
111
- return childProcess.exec("git", ["push", url]);
112
- // git push https://myusername:${PROJECT_ACCESS_TOKEN}@gitlab.mydomain.com/mygroup/myproject.git
109
+ console.log(`executing git push ${branch}`);
110
+ // 提交变更集
111
+ if (projectUrl) {
112
+ return childProcess.exec("git", ["push", projectUrl]);
113
+ } else {
114
+ return childProcess.exec('git', ['push']);
115
+ }
113
116
  })
114
117
  }
115
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farris/cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Farris command line interface",
5
5
  "main": "index.js",
6
6
  "scripts": {