@farris/cli 1.0.2 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/ci/cli.js +21 -1
- package/package.json +25 -25
package/README.md
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
# farris-cli
|
2
|
-
|
1
|
+
# farris-cli
|
2
|
+
|
package/ci/cli.js
CHANGED
@@ -10,6 +10,17 @@ const yargs = require('yargs/yargs');
|
|
10
10
|
const cli = yargs(process.argv.slice(2), process.cwd())
|
11
11
|
|
12
12
|
cli
|
13
|
+
.command(
|
14
|
+
'check',
|
15
|
+
'check file changes from last commit.',
|
16
|
+
(yargs) => {
|
17
|
+
return yargs;
|
18
|
+
},
|
19
|
+
(argv) => {
|
20
|
+
const project = argv.project;
|
21
|
+
checkProjectChanges(project);
|
22
|
+
}
|
23
|
+
)
|
13
24
|
.command(
|
14
25
|
'prerelease',
|
15
26
|
'Update package prerelease version when package has changed.',
|
@@ -62,6 +73,11 @@ function checkProjectChanges(projectPath) {
|
|
62
73
|
const changedFiles = returnValue.stdout.split("\n").filter(Boolean);
|
63
74
|
// 根据文件个数确定是否存在变更
|
64
75
|
const hasChanges = changedFiles.length > 0;
|
76
|
+
if (hasChanges) {
|
77
|
+
console.log(`${projectPath} has changed.`)
|
78
|
+
} else {
|
79
|
+
console.log(`Did not detect any changes from ${projectPath} sence last commit.`)
|
80
|
+
}
|
65
81
|
// 返回检测结果
|
66
82
|
return hasChanges;
|
67
83
|
});
|
@@ -86,8 +102,12 @@ function updateProjectPrereleaseVersion(projectPath) {
|
|
86
102
|
childProcess.execSync('git', ['add', '.']);
|
87
103
|
// 提交变更记录
|
88
104
|
childProcess.execSync('git', ['commit', '-m', `update ${packageConfig.name} prerelease version to ${updatedVersion}`]);
|
105
|
+
console.log(`update ${packageConfig.name} prerelease version to ${updatedVersion}`);
|
89
106
|
// 提交变更集
|
90
|
-
return childProcess.exec('git', ['push']);
|
107
|
+
// return childProcess.exec('git', ['push']);
|
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]);
|
91
111
|
})
|
92
112
|
}
|
93
113
|
|
package/package.json
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
{
|
2
|
-
"name": "@farris/cli",
|
3
|
-
"version": "1.0.
|
4
|
-
"description": "Farris command line interface",
|
5
|
-
"main": "index.js",
|
6
|
-
"scripts": {
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
-
},
|
9
|
-
"repository": {
|
10
|
-
"type": "git",
|
11
|
-
"url": "https://git.iec.io/webadp/farris-cli.git"
|
12
|
-
},
|
13
|
-
"keywords": [
|
14
|
-
"Farris",
|
15
|
-
"CLI"
|
16
|
-
],
|
17
|
-
"bin": {
|
18
|
-
"farris": "ci/cli.js"
|
19
|
-
},
|
20
|
-
"author": "Sagi Chen",
|
21
|
-
"license": "ISC",
|
22
|
-
"dependencies": {
|
23
|
-
"lerna": "^4.0.0"
|
24
|
-
}
|
25
|
-
}
|
1
|
+
{
|
2
|
+
"name": "@farris/cli",
|
3
|
+
"version": "1.0.5",
|
4
|
+
"description": "Farris command line interface",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "https://git.iec.io/webadp/farris-cli.git"
|
12
|
+
},
|
13
|
+
"keywords": [
|
14
|
+
"Farris",
|
15
|
+
"CLI"
|
16
|
+
],
|
17
|
+
"bin": {
|
18
|
+
"farris": "ci/cli.js"
|
19
|
+
},
|
20
|
+
"author": "Sagi Chen",
|
21
|
+
"license": "ISC",
|
22
|
+
"dependencies": {
|
23
|
+
"lerna": "^4.0.0"
|
24
|
+
}
|
25
|
+
}
|