Skip to content

Commit

Permalink
fix: Make spire compatible with yargs 14
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Nov 13, 2019
1 parent c40971d commit 68f7ec8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions packages/spire/lib/create-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ function createCli() {
default: false,
group: 'Options',
})
.exitProcess(false)
.strict(true);
.command('*', '', () => {}, (argv) => {
yargs.showHelp();
console.error('\nUnknown command: ' + argv._[0]);
process.exit(1);
})
.demandCommand(1, 'You need to specify at least one command')
.exitProcess(false);
}

module.exports = createCli;
2 changes: 1 addition & 1 deletion packages/spire/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"pretty-format": "^24.7.0",
"signale": "^1.4.0",
"spire-config-default": "^1.7.3",
"yargs": "^14.0.0"
"yargs": "^14.2.0"
},
"devDependencies": {
"spire-test-utils": "^1.7.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/spire/tests/verify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('spire', () => {
}),
});
await expect(fixture.run('spire', ['nope'])).rejects.toMatchObject({
stderr: expect.stringMatching(/Unknown argument: nope/),
stderr: expect.stringMatching(/Unknown command: nope/),
});
});
});

0 comments on commit 68f7ec8

Please sign in to comment.