-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update to yargs 12 #248
update to yargs 12 #248
Conversation
@galactusss @perissology It looks like we've also added middlewares to ❯ ggs 'middleware' *
package-lock.json:10389: "eth-json-rpc-middleware": "^1.5.0",
package-lock.json:10395: "eth-json-rpc-middleware": {
package-lock.json:10397: "resolved": "https://registry.npmjs.org/eth-json-rpc-middleware/-/eth-json-rpc-middleware-1.6.0.tgz",
src/cli.js:4: environmentMiddleware,
src/cli.js:5: manifestMiddleware,
src/cli.js:6: moduleMiddleware,
src/cli.js:7:} = require('./middleware')
src/cli.js:12:const MIDDLEWARES = [
src/cli.js:13: manifestMiddleware,
src/cli.js:14: moduleMiddleware,
src/cli.js:15: environmentMiddleware,
src/cli.js:22:cmd.middleware(MIDDLEWARES)
src/commands/dao_cmds/acl.js:4: manifestMiddleware,
src/commands/dao_cmds/acl.js:5: moduleMiddleware,
src/commands/dao_cmds/acl.js:6: environmentMiddleware,
src/commands/dao_cmds/acl.js:7:} = require('../../middleware')
src/commands/dao_cmds/acl.js:9:const MIDDLEWARES = [
src/commands/dao_cmds/acl.js:10: manifestMiddleware,
src/commands/dao_cmds/acl.js:11: moduleMiddleware,
src/commands/dao_cmds/acl.js:12: environmentMiddleware,
src/commands/dao_cmds/acl.js:22: cmd.middlewares = MIDDLEWARES
src/commands/dao_cmds/token.js:2: manifestMiddleware,
src/commands/dao_cmds/token.js:3: moduleMiddleware,
src/commands/dao_cmds/token.js:4: environmentMiddleware,
src/commands/dao_cmds/token.js:5:} = require('../../middleware')
src/commands/dao_cmds/token.js:7:const MIDDLEWARES = [
src/commands/dao_cmds/token.js:8: manifestMiddleware,
src/commands/dao_cmds/token.js:9: moduleMiddleware,
src/commands/dao_cmds/token.js:10: environmentMiddleware,
src/commands/dao_cmds/token.js:21: cmd.middlewares = MIDDLEWARES
src/middleware/environment.js:70:module.exports = function environmentMiddleware(argv) {
src/middleware/index.js:1:const manifestMiddleware = require('./manifest')
src/middleware/index.js:2:const moduleMiddleware = require('./module')
src/middleware/index.js:3:const environmentMiddleware = require('./environment')
src/middleware/index.js:6: manifestMiddleware,
src/middleware/index.js:7: moduleMiddleware,
src/middleware/index.js:8: environmentMiddleware,
src/middleware/manifest.js:5:module.exports = function manifestMiddleware(argv) {
src/middleware/module.js:5:module.exports = function moduleMiddleware(argv) {
src/middleware/module.js:26: // hack: we need to access the module in downstream middleware (environmentMiddleware), but
src/middleware/module.js:27: // yargs does not update the `argv` param until all middleware have |
@sohkai I added these changes. I tested with all the features of the new release and is working fine 👍 |
.demandCommand(1, 'You need to specify a command') | ||
const cmd = yargs.commandDir('token_cmds') | ||
cmd.demandCommand(1, 'You need to specify a command') | ||
return cmd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this a bit cleaner, since yargs
always uses the builder pattern, is:
return yargs
.commandDir('token_cmds')
.demandCommand(1, 'You need to specify a command')
@galactusss Let's make sure to do a bit of smoke testing and try out most of the commands and options to see if there are any regressions :). These changes seem to be a bit harder to search for without great knowledge of how the args are handled. |
replace by #386 |
fixes #166
This doesn't fix the coercing bug (I think your referencing coerce being called multiple times which still happens), however it does provide a way to register global middleware which allows us to centralize common middleware registration