Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Disallow templates with generate site #789

Conversation

EverlastingBugstopper
Copy link
Contributor

This PR adds failure logic when a template is passed to wrangler generate --site

Example

$ wrangler generate --site name https://github.com/cloudflare/wrangler
Error: You cannot specify a template when generating a Workers Site. If you want to generate site boilerplate, run wrangler generate --site

Fixes #776

@EverlastingBugstopper EverlastingBugstopper added this to the 1.5.0 milestone Oct 21, 2019
@EverlastingBugstopper EverlastingBugstopper requested a review from a team October 21, 2019 17:31
@EverlastingBugstopper EverlastingBugstopper self-assigned this Oct 21, 2019
@EverlastingBugstopper EverlastingBugstopper changed the base branch from master to avery/toml-more-like-big-gulp October 21, 2019 17:31
@EverlastingBugstopper EverlastingBugstopper force-pushed the avery/no-you-cannot-git-this-site branch 2 times, most recently from 0a2ef34 to 3a15bad Compare October 21, 2019 17:34
Copy link
Contributor

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

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

some nits but other wise lgtm

src/main.rs Outdated
let mut target_type = None;

let template = if site {
if template_value.is_some() {
failure::bail!("You cannot specify a template when generating a Workers Site. If you want to generate site boilerplate, run wrangler generate --site")
Copy link
Contributor

Choose a reason for hiding this comment

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

This text is a little confusing to me- I might say:

"You cannot specify a template when generating a Workers Site. If you'd like to use the default site boilerplate, run wrangler generate --site. If you'd like to use another site boilerplate, omit the --site when running wrangler generate."

src/main.rs Outdated
@@ -390,17 +390,21 @@ fn run() -> Result<(), failure::Error> {
} else if let Some(matches) = matches.subcommand_matches("generate") {
let name = matches.value_of("name").unwrap_or("worker");
let site = matches.is_present("site");
let template_value = matches.value_of("template");
Copy link
Contributor

Choose a reason for hiding this comment

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

template value is a confusing name to me- maybe template_url?

src/main.rs Outdated
let mut target_type = None;

let template = if site {
if template.is_some() {
failure::bail!("You cannot specify a template when generating a Workers Site. If you'd like to use the default site boilerplate, run wrangler generate --site. If you'd like to use another site boilerplate, omit the --site when running wrangler generate.")
Copy link
Contributor

Choose a reason for hiding this comment

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

lol i'm still on this, something seems off here

"You cannot specify a template when generating a Workers Site. If you'd like to use the default site boilerplate, run wrangler generate --site. If you'd like to use another site boilerplate, omit the --site when running wrangler generate."

I think if we change the bolded part to "You've passed both --site and a template to wrangler generate- however you can only pass one or the other."

what do you think?

@EverlastingBugstopper EverlastingBugstopper merged commit c481c56 into avery/toml-more-like-big-gulp Oct 22, 2019
@delete-merged-branch delete-merged-branch bot deleted the avery/no-you-cannot-git-this-site branch October 22, 2019 19:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants