-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor yargs (print help when no command; use commandDir) (#44)
- Loading branch information
Showing
10 changed files
with
107 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict' | ||
|
||
const wiby = require('../..') | ||
|
||
exports.desc = 'Use this command to fetch the results of your latest test against a dependent. wiby will go off to the dependent’s repo and fetch the results of the CI run against the patch branch wiby had created.' | ||
|
||
exports.builder = (yargs) => yargs | ||
.option('dependent', { | ||
desc: 'URL of a dependent', | ||
demandOption: true, | ||
type: 'string' | ||
}) | ||
|
||
exports.handler = (params) => wiby.result(params.dependent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict' | ||
|
||
const wiby = require('../..') | ||
|
||
exports.desc = 'Use this command to test your breaking changes against any one of your dependents. wiby will go off to the dependent’s repo and create a branch with a patch to the `package.json` pointing to your latest version (with the new changes) triggering the dependent’s CI to run.' | ||
|
||
exports.builder = (yargs) => yargs | ||
.option('dependent', { | ||
desc: 'URL of a dependent', | ||
demandOption: true, | ||
type: 'string' | ||
}) | ||
|
||
exports.handler = (params) => wiby.test(params.dependent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env node | ||
|
||
require('dotenv').config() | ||
|
||
const chalk = require('chalk') | ||
const yargs = require('yargs') | ||
|
||
yargs | ||
.commandDir('./commands') | ||
.demandCommand() | ||
.help() | ||
.strict() | ||
.fail((msg, err, yargs) => { | ||
|
||
if (err) { | ||
console.error(err); | ||
} | ||
|
||
if (msg) { | ||
console.error(chalk.red.bold(msg)); | ||
console.error(); | ||
} | ||
|
||
if (!err || err.showHelp) { | ||
yargs.showHelp(); | ||
} | ||
|
||
process.exit(1); | ||
}) | ||
.parse() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict' | ||
|
||
exports.test = require('./test') | ||
|
||
exports.result = require('./result') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters