-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
polish: split generate into its own file (#1343)
* polish: split generate into its own file * Create spotty-birds-care.md * use regular functions
- Loading branch information
Showing
3 changed files
with
41 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
polish: split generate into its own file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { DeprecationError } from "./errors"; | ||
import type { Argv, ArgumentsCamelCase } from "yargs"; | ||
|
||
interface GenerateArgs { | ||
name: string; | ||
template: string; | ||
} | ||
|
||
export function generateOptions(yargs: Argv) { | ||
return yargs | ||
.positional("name", { | ||
describe: "Name of the Workers project", | ||
default: "worker", | ||
}) | ||
.positional("template", { | ||
describe: "The URL of a GitHub template", | ||
default: "https://github.com/cloudflare/worker-template", | ||
}); | ||
} | ||
|
||
export function generateHandler( | ||
generateArgs: ArgumentsCamelCase<GenerateArgs> | ||
) { | ||
// "👯 [DEPRECATED]. Scaffold a Cloudflare Workers project from a public GitHub repository.", | ||
throw new DeprecationError( | ||
"`wrangler generate` has been deprecated.\n" + | ||
"Try running `wrangler init` to generate a basic Worker, or cloning the template repository instead:\n\n" + | ||
"```\n" + | ||
`git clone ${generateArgs.template}\n` + | ||
"```\n\n" + | ||
"Please refer to https://developers.cloudflare.com/workers/wrangler/deprecations/#generate for more information." | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters