Skip to content

Commit

Permalink
Merge pull request #19 from HecJimSan/refact/#18
Browse files Browse the repository at this point in the history
#18 refact(cli.js, package.json) use version from package.json
  • Loading branch information
hector-js authored Mar 18, 2020
2 parents 9bc1d89 + 8775700 commit a374a11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"test": "mocha --recursive --require esm --exit",
"eslint": "eslint ./src/**/*.js ./test/**/*.js",
"test-all": "npm run eslint && npm run coverage",
"test-all": "rm -rf node_modules & npm i & npm run eslint && npm run coverage",
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"coverage": "nyc --reporter=html --cache false --reporter=text-summary mocha --recursive --require esm --exit"
},
Expand Down
6 changes: 3 additions & 3 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { newCli } from './new/new.cli';
import { start } from './start/start.cli';
import { testcli } from './testcli/test.cli';
import { config } from './config/config.cli';
import { version } from './../package.json';

const chalk = require('chalk');
const VERSION = '0.22.1';

export function cli(args) {
switch (args._[0]) {
Expand Down Expand Up @@ -38,7 +38,7 @@ export function cli(args) {
}

if (args.version) {
info(chalk.yellow(`\nVersion: ${VERSION}\n`));
info(chalk.yellow(`\nVersion: ${version}\n`));
}

if (args.license) {
Expand All @@ -57,7 +57,7 @@ export function cli(args) {
info(chalk.grey(` - --headers : add headers to check in the request`));
info(chalk.grey(` - --license : MIT\n\n`));
info(chalk.grey(`Example: hjs new mock-service --vs\n`));
info(chalk.yellow(`version: ${VERSION}\n`));
info(chalk.yellow(`version: ${version}\n`));
}

if (args._.length === 0 && sizeObject(args) === 1) {
Expand Down
3 changes: 2 additions & 1 deletion test/unit/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ describe('cli', () => {
'./testcli/test.cli': { testcli: testcliStub },
'./config/config.cli': { config: configStub },
'shelljs': { cd: cdStub },
'console': { info: infoStub, warn: warnStub }
'console': { info: infoStub, warn: warnStub },
'./../package.json': { version: '0.22.1' }
}).cli;
args = {
_: ['']
Expand Down

0 comments on commit a374a11

Please sign in to comment.