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

add --yes flag to wrangler init #448

Merged
merged 1 commit into from
Feb 11, 2022
Merged

add --yes flag to wrangler init #448

merged 1 commit into from
Feb 11, 2022

Conversation

JacobMGEvans
Copy link
Contributor

@JacobMGEvans JacobMGEvans commented Feb 11, 2022

Add --yes with alias --y flag as automatic answer to all prompts and run wrangler init non-interactively.
generated during setup:

  • package.json
  • TypeScript, which includes tsconfig.json & @cloudflare/workers-types
  • Template "hello world" Worker at src/index.ts

resolves #446

@JacobMGEvans JacobMGEvans added the polish Small improvements to the experience label Feb 11, 2022
@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2022

🦋 Changeset detected

Latest commit: f0d304d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2022

wrangler prerelease is available for testing:

npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/1831806780/wrangler

@petebacondarwin
Copy link
Contributor

I was thinking about this recently and I think that, while having a --yes to force acceptance of all options, can avoid having to interact, it might be better to allow devs to specify exactly what answers they would have chosen via command line args.

For example you might have --create-package-json or --use-typescript etc. What do you think?

@threepointone
Copy link
Contributor

Could do, but let's not do it just yet, let's add more flags if people ask for it. -y is good tho, been wanting it myself.

@petebacondarwin
Copy link
Contributor

Perhaps -y could be an alias for --accept-all? Or is --yes a common enough convention?

@threepointone
Copy link
Contributor

Thing is, if people wanted customisation, they simply wouldn't use -y, and it would be easier to do the steps.

(An optimisation that we can do, is bunch up the npm install commands for the very end. In a future PR.)

@JacobMGEvans
Copy link
Contributor Author

Perhaps -y could be an alias for --accept-all? Or is --yes a common enough convention?

I would say it is pretty common convention.

packages/wrangler/src/__tests__/index.test.ts Outdated Show resolved Hide resolved
packages/wrangler/src/index.tsx Outdated Show resolved Hide resolved
packages/wrangler/src/index.tsx Outdated Show resolved Hide resolved
packages/wrangler/src/index.tsx Outdated Show resolved Hide resolved
.changeset/olive-maps-promise.md Outdated Show resolved Hide resolved
@threepointone threepointone changed the title add yes flag add --yes flag to wrangler init Feb 11, 2022
Comment on lines 220 to 221
describe:
"Skip confirmation prompt, automatic yes to prompts; assume 'yes' as answer to all prompts and run non-interactively.",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs bikeshedding but is non-blocking

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just way too long, let's keep it short and bikeshed. Maybe 'Answer "yes" to any prompts.'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't answer yes for clobbering existing wrangler projects, I am fine with that message though.
'Answer "yes" to any prompts for new projects.' ?

Copy link
Contributor

@threepointone threepointone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tentatively approving with one nit, ship it.

…nteractively.

- flag can be used with `--yes` or `--y`
@JacobMGEvans JacobMGEvans merged commit b72a111 into main Feb 11, 2022
@JacobMGEvans JacobMGEvans deleted the feat/init-yes-flag branch February 11, 2022 22:29
@github-actions github-actions bot mentioned this pull request Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polish Small improvements to the experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

polish: add -y --yes flag to init
3 participants