Skip to content

Commit c35da47

Browse files
committed
install and use ci-info
1 parent 3a7d544 commit c35da47

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

bin/cli.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33

44
const path = require('path');
55
const process = require('process');
6-
const {Command, Option} = require('commander');
6+
const program = require('commander');
77
const rc = require('rc')('madge');
88
const version = require('../package.json').version;
99
const ora = require('ora');
1010
const chalk = require('chalk');
1111
const startTime = Date.now();
12-
13-
const program = new Command();
12+
const ci = require('ci-info');
1413

1514
// Revert https://github.com/tj/commander.js/pull/1409
1615
program.storeOptionsAsProperties();
@@ -36,7 +35,7 @@ program
3635
.option('--ts-config <file>', 'path to typescript config')
3736
.option('--include-npm', 'include shallow NPM modules', false)
3837
.option('--no-color', 'disable color in output and image', false)
39-
.addOption(new Option('--no-spinner', 'disable progress spinner', false).env('MADGE_NO_SPINNER'))
38+
.option('--no-spinner', 'disable progress spinner', false)
4039
.option('--stdin', 'read predefined tree from STDIN', false)
4140
.option('--warning', 'show warnings about skipped files', false)
4241
.option('--debug', 'turn on debug output', false)
@@ -77,7 +76,8 @@ const spinner = ora({
7776
text: 'Finding files',
7877
color: 'white',
7978
interval: 100000,
80-
isEnabled: program.spinner
79+
isEnabled: !ci.isCI && program.spinner,
80+
isSilent: ci.isCI
8181
});
8282

8383
let exitCode = 0;

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"debug": "node bin/cli.js --debug bin lib",
3636
"generate": "npm run generate:small && npm run generate:madge",
3737
"generate:small": "bin/cli.js --image /tmp/simple.svg test/cjs/circular/a.js",
38-
"generate:madge": "bin/cli.js --image /tmp/madge.svg bin lib",
38+
"generate:madge": "export CI=true; bin/cli.js --image /tmp/madge.svg bin lib",
3939
"test:output": "./test/output.sh",
4040
"release": "npm test && release-it"
4141
},
@@ -45,7 +45,8 @@
4545
},
4646
"dependencies": {
4747
"chalk": "^4.1.1",
48-
"commander": "^8.2.0",
48+
"ci-info": "^3.7.1",
49+
"commander": "^7.2.0",
4950
"commondir": "^1.0.1",
5051
"debug": "^4.3.1",
5152
"dependency-tree": "^9.0.0",

0 commit comments

Comments
 (0)