-
Notifications
You must be signed in to change notification settings - Fork 56
refactor: use yargs for the cli #791
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
Conversation
🦋 Changeset detectedLatest commit: d02a59e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Looks great, thanks for the PR.
Does it still work as expected when there is a --
?
I'll take one more look tomorrow
Unknown args and args after If |
Is it what we want? |
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.
Looks good.
I think more comments might help maintaining this code in the future
Yep, that's true, although people were complaining when we wanted people to use What would you think of us throwing an error when people pass |
packages/cloudflare/src/cli/index.ts
Outdated
|
||
const nextAppDir = process.cwd(); | ||
export function runCommand() { | ||
let y = yargs(process.argv.slice(2)) |
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 we filter out -- here?
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.
Anything after --
are considered non-option arguments and put into args._
by yargs
I took a deeper look and have some comments: First I really like the changes, I fell like the CLI is much nice now, thanks for working on this. I do have a few comments:
We use to recommend IIUC this command will now (maybe before also?) use a different env for populating the cache than for deploying.
I see ![]() ![]() Would be nice to ba able to solve this
IIUC I wouldn't mind more duplication in each of the command to make the code easier to follow/extend i.e. each command would: printHeader();
compileConfig() or retieveCompiledConfig();
readWranglerConfig(); Each of this function could be helpers (i.e. Maybe one thing we could do then is to move Thinking forward if we add new commands, we might have to add options to |
So would you like to preserve the old behaviour, or throw an error if it's used after the
I don't get this - that looks like the dependencies aren't installed.
Sure, I'll change it. |
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.
Thank for this PR!
Great code and nice to have some help on the CLI now!
One nit about an error message when the config is not found.
Co-authored-by: Victor Berchet <[email protected]>
Changes
output
arg as it was never used.--env
and--config
become proper first class citizens.Replaces #790
Commands Tested
build
preview
deploy
upload
populateCache