Skip to content
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

Closed
wants to merge 8 commits into from
Closed

update to yargs 12 #248

wants to merge 8 commits into from

Conversation

ewingrj
Copy link
Contributor

@ewingrj ewingrj commented Oct 23, 2018

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

@sohkai
Copy link
Contributor

sohkai commented Jan 17, 2019

@galactusss @perissology It looks like we've also added middlewares to dao_cmds/acl.js and dao_cmds/token.js; would be great to move those out like the other ones already in this PR and then test them to make sure they still work.

❯ 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

@0xGabi
Copy link
Contributor

0xGabi commented Jan 17, 2019

@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
Copy link
Contributor

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')

@sohkai
Copy link
Contributor

sohkai commented Jan 18, 2019

@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.

@0xGabi
Copy link
Contributor

0xGabi commented Feb 28, 2019

replace by #386

@0xGabi 0xGabi closed this Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider updating yargs to 12.0.0
3 participants