@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.
- package/ci/cli.js +11 -8
- 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
|
110
|
-
|
111
|
-
|
112
|
-
|
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
|
|