@farris/cli 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/ci/cli.js +14 -1
- package/package.json +1 -1
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,8 +73,10 @@ function checkProjectChanges(projectPath) {
|
|
62
73
|
const changedFiles = returnValue.stdout.split("\n").filter(Boolean);
|
63
74
|
// 根据文件个数确定是否存在变更
|
64
75
|
const hasChanges = changedFiles.length > 0;
|
65
|
-
if(hasChanges){
|
76
|
+
if (hasChanges) {
|
66
77
|
console.log(`${projectPath} has changed.`)
|
78
|
+
} else {
|
79
|
+
console.log(`Did not detect any changes from ${projectPath} sence last commit.`)
|
67
80
|
}
|
68
81
|
// 返回检测结果
|
69
82
|
return hasChanges;
|