-
Notifications
You must be signed in to change notification settings - Fork 111
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
Passes flags to commands #230
Conversation
@@ -51,7 +51,7 @@ module.exports = (config) => { | |||
serverCompiler.options.output.path, `${Object.keys(serverCompiler.options.entry)[0]}.js` | |||
); | |||
|
|||
nodemon({ script: serverPath, watch: [serverPath] }) | |||
nodemon({ script: serverPath, watch: [serverPath], nodeArgs: [...flags] }) |
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.
Can just be nodeArgs: flags
const config = kytConfigFn(optionalConfig); | ||
action(config, program); | ||
action(config, program, flags); |
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.
It looks like program
isn't actually used be any of the actions, and instead just need flags
. Can you double check that, and if true, maybe we can simplify this signature to just this:
action(config, flags);
@tizmagik Thanks for the feedback. Made the updates. setup is using |
Spent some time with this PR, still some issues I see: This doesn't fully fix #150 e.g. we still can't do this:
In that same vein, there is no distinction between
Produces:
If you want, we can say this fixes #113 but leave #150 open for a follow-up PR. |
I actually need this functionality right now for a starter kyt I'm building. I haven't fully formed a solution, but I think we could drop the eslint Node API and use the eslint cli. For example:
|
Hey @tizmagik, Ok more updates! Lint now takes any flags. I also separated flags and args. The way args works through commander is that they get parsed and placed into the command object, so I'm passing along that object to be used by setup, and creating the array of flags from anything that's a string. Let me know if you see anything else. Thanks! @delambo test this out with your starter-kyt and let me know if it works |
|
||
if (report.errorCount === 0) { | ||
logger.end(`Your JS looks ${report.warningCount === 0 ? 'great ✨' : | ||
const cmd = `eslint src/ -c ${configFile} --color --env browser ${flags.join(' ')}`; |
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.
Could this just be eslint src/ -c ${configFile} ${flags.join(' ')}
? E.g. drop the --color
and --env
flags
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.
we need to specify color and browser since we're running it with shelljs now
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.
I think it might be better to put env: { browser: true}
in the base eslint config instead, this way it's overridable at the command-line by the user.
I believe color is enabled by default anyway?
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.
I moved env but color doesn't work without the flag.
kyt dev -- --inspect | ||
``` | ||
will run the [node debugging for Chrome DevTools](https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27#.mpuwgy17v) | ||
|
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.
Maybe we should also mention for the test
and lint
commands? Or, mention that flags can now be passed generically in almost all cases (except for lint-style
) so it doesn't read as necessarily specific to these two commands?
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.
I added separate notes. good catch!
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.
A couple minor things otherwise LGTM. Nice job!
Fixes #150
Fixes #113