@farris/cli 1.0.3 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/ci/cli.js +20 -2
  2. 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;
@@ -91,7 +104,12 @@ function updateProjectPrereleaseVersion(projectPath) {
91
104
  childProcess.execSync('git', ['commit', '-m', `update ${packageConfig.name} prerelease version to ${updatedVersion}`]);
92
105
  console.log(`update ${packageConfig.name} prerelease version to ${updatedVersion}`);
93
106
  // 提交变更集
94
- 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
+ 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
95
113
  })
96
114
  }
97
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farris/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "Farris command line interface",
5
5
  "main": "index.js",
6
6
  "scripts": {