@farris/cli 1.0.5 → 1.0.8

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 +12 -7
  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])
@@ -101,13 +102,17 @@ function updateProjectPrereleaseVersion(projectPath) {
101
102
  // 向git缓冲区中添加变更
102
103
  childProcess.execSync('git', ['add', '.']);
103
104
  // 提交变更记录
104
- childProcess.execSync('git', ['commit', '-m', `update ${packageConfig.name} prerelease version to ${updatedVersion}`]);
105
+ childProcess.execSync('git', ['commit', '-m', `update ${packageConfig.name} prerelease version to ${updatedVersion}. [skip ci]`]);
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
- return childProcess.exec("git", ["push", 'origin', branch]);
109
+ console.log(`executing git push ${branch}`);
110
+ // 提交变更集
111
+ if (projectUrl) {
112
+ return childProcess.exec("git", ["push", '-o', 'ci.skip', projectUrl]);
113
+ } else {
114
+ return childProcess.exec('git', ['push', '-o', 'ci.skip']);
115
+ }
111
116
  })
112
117
  }
113
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farris/cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.8",
4
4
  "description": "Farris command line interface",
5
5
  "main": "index.js",
6
6
  "scripts": {