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

Commit

Permalink
Add error when template is passed to generate site
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Oct 21, 2019
1 parent c5e29eb commit 3a15bad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,12 @@ 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_input = matches.value_of("template");

let (target_type, template) = if site {
if template_input.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")
}
// Workers Sites projects are always Webpack for now
let target_type = Some(TargetType::Webpack);
let template = "https://github.com/cloudflare/worker-sites-template";
Expand All @@ -404,7 +408,7 @@ fn run() -> Result<(), failure::Error> {
};

let default_template = "https://github.com/cloudflare/worker-template";
let template = matches.value_of("template").unwrap_or(match target_type {
let template = template_input.unwrap_or(match target_type {
Some(ref pt) => match pt {
TargetType::Rust => "https://github.com/cloudflare/rustwasm-worker-template",
_ => default_template,
Expand Down

0 comments on commit 3a15bad

Please sign in to comment.