From 7a46395c3e33be7ffb218ce35017f2b6c0806f9f Mon Sep 17 00:00:00 2001 From: lauragift21 <laurandidi21@gmail.com> Date: Tue, 29 Mar 2022 14:08:10 +0200 Subject: [PATCH] replace wrangler generate in quickstarts/examples --- content/workers/get-started/guide.md | 11 +++++--- content/workers/get-started/quickstarts.md | 7 +++-- content/workers/learning/profiling-workers.md | 4 +-- .../workers/learning/using-durable-objects.md | 4 +-- .../workers/platform/sites/configuration.md | 26 ------------------- .../platform/sites/start-from-scratch.md | 4 +-- layouts/shortcodes/worker-starter.html | 2 +- 7 files changed, 17 insertions(+), 41 deletions(-) diff --git a/content/workers/get-started/guide.md b/content/workers/get-started/guide.md index 1285ffb46..6cab2d96f 100644 --- a/content/workers/get-started/guide.md +++ b/content/workers/get-started/guide.md @@ -76,12 +76,15 @@ Open the browser, log into your account, and select **Allow**. This will send an --- -## 4. Generate a new project +## 4. Create a new project -Wrangler’s `generate` [command](/workers/cli-wrangler/commands/#generate) will create a new project. By default, the [default starter](https://github.com/cloudflare/worker-template) template will be used to generate a new project. To provide a custom template, you may provide the [template argument](/workers/cli-wrangler/commands/#generate) with a URL to your desired repository. For example, to create a Worker from the default template called `my-worker`, run: +Wrangler’s `init` [command](/workers/wrangler/commands/#init) will create a new project. + + +By default, the [default starter](https://github.com/cloudflare/worker-template) template will be used to generate a new project. To provide a custom template, you may provide the [template argument](/workers/cli-wrangler/commands/#generate) with a URL to your desired repository. For example, to create a Worker from the default template called `my-worker`, run: ```sh -~/ $ wrangler generate my-worker +~/ $ wrangler init my-worker ``` Wrangler will create a directory called `my-worker` and populate it with the contents of the starter template, in this case the default template. Wrangler will automatically configure the `wrangler.toml` file in the project’s root with the `name = "my-worker"`. @@ -196,7 +199,7 @@ In addition to standard request properties, the Workers platform populates the r For more complex routing, it is recommended to use a library. The [Workers router starter](https://github.com/cloudflare/worker-template-router) template provides an API similar to ExpressJS for handling requests based on HTTP methods and paths: ```sh -~/ $ wrangler generate my-worker-with-router https://github.com/cloudflare/worker-template-router +~/ $ git clone https://github.com/cloudflare/worker-template-router my-worker-with-router ``` This starter is used in the tutorial for [building a Slack Bot](/workers/tutorials/build-a-slackbot/). diff --git a/content/workers/get-started/quickstarts.md b/content/workers/get-started/quickstarts.md index f216a632c..e5d600553 100644 --- a/content/workers/get-started/quickstarts.md +++ b/content/workers/get-started/quickstarts.md @@ -13,18 +13,17 @@ layout: list Quickstarts are GitHub repos that are designed to be a starting point for building a new Cloudflare Workers project. For the projects below, you simply run: ```sh -$ wrangler generate <new-project-name> <github-repo-url> +$ git clone <github-repo-url> <new-project-name> ``` {{<definitions>}} +- `github-repo-url` + - This is the URL of the GitHub repo starter, as below. - `new-project-name` - A folder with this name will be created with your new project inside, pre-configured to [your Workers account](/workers/cli-wrangler/configuration/). -- `github-repo-url` - - This is the URL of the GitHub repo starter, as below. - {{</definitions>}} {{</content-column>}} diff --git a/content/workers/learning/profiling-workers.md b/content/workers/learning/profiling-workers.md index 6d4326c89..969259fa3 100644 --- a/content/workers/learning/profiling-workers.md +++ b/content/workers/learning/profiling-workers.md @@ -16,10 +16,10 @@ As part of the Workers platform's integration with Chrome Developer Tools, you c ## Profiling an example project -Create a new Workers project with the `wrangler generate` command: +Create a new Workers project with the `wrangler init` command: ```sh -$ wrangler generate my-worker +$ wrangler init my-worker ``` Open the `index.js` file in your project's directory and replace the content with: diff --git a/content/workers/learning/using-durable-objects.md b/content/workers/learning/using-durable-objects.md index 26787f21b..f5a4a99b3 100644 --- a/content/workers/learning/using-durable-objects.md +++ b/content/workers/learning/using-durable-objects.md @@ -221,10 +221,10 @@ You must use [Wrangler version 1.19.3 or greater](/workers/cli-wrangler/install- {{</Aside>}} -The easiest way to upload Workers that implement or bind to Durable Objects is to use [Wrangler](/workers/cli-wrangler/), the Workers CLI. You can start with one of our templates, the simplest of which can be used by running: +The easiest way to upload Workers that implement or bind to Durable Objects is to use [Wrangler](/workers/cli-wrangler/), the Workers CLI. You can start with one of our templates by running the command: ```sh -$ wrangler generate <WORKER-NAME> https://github.com/cloudflare/durable-objects-template +$ git clone https://github.com/cloudflare/durable-objects-template <WORKER-NAME> ``` This will create a directory for your project with basic configuration and a single JavaScript source file already set up. If you want to use TypeScript, or be able to bundle external dependencies with your code using Rollup or Webpack, or to use CommonJS modules rather than ES modules, try one of the other starter templates instead: diff --git a/content/workers/platform/sites/configuration.md b/content/workers/platform/sites/configuration.md index ad4c1e44e..778ccdb5e 100644 --- a/content/workers/platform/sites/configuration.md +++ b/content/workers/platform/sites/configuration.md @@ -8,32 +8,6 @@ weight: 4 Workers Sites require the latest version of [Wrangler](https://github.com/cloudflare/wrangler). -## Commands - -{{<definitions>}} - -- `wrangler generate proj --site` - - - Creates a project with a Worker serving a generic HTML file and favicon with the directory structure: - - ```txt - ├── public # files to serve - | ├── favicon.ico - | └── index.html - ├── workers-site - | ├── index.js # Workers script that serves the assets - | ├── package-lock.json - | └── package.json # defines dependencies used by Workers script - └── wrangler.toml - ``` - - - Auto-fills `wrangler.toml` with `entry-point` (defaults to `workers-site`) and `bucket` (defaults to `public`). - -- `wrangler init proj --site` - - Creates a `wrangler.toml` file and a `workers-site` directory. In the `site` configuration key in the generated `wrangler.toml` file, you will need to update the `bucket` key with the relative path to the folder containing your static site assets. For example, if your website lives within the `public` directory of your project, then you should use the `bucket = "./public"` pairing. - -{{</definitions>}} - ## wrangler.toml There are a few specific configuration settings for Workers Sites in your `wrangler.toml` file: diff --git a/content/workers/platform/sites/start-from-scratch.md b/content/workers/platform/sites/start-from-scratch.md index d498d9e9c..019e0646b 100644 --- a/content/workers/platform/sites/start-from-scratch.md +++ b/content/workers/platform/sites/start-from-scratch.md @@ -10,10 +10,10 @@ To start from scratch to create a Workers Site, follow these steps: 1. Ensure you have the latest version of [Wrangler](/workers/cli-wrangler/install-update/#update) and Node.js installed. -2. In your terminal, run `wrangler generate --site <project-name>`, replacing `<project-name>` with the name of your project. The following example creates a project called `my-site`: +2. In your terminal, run `git clone https://github.com/cloudflare/worker-sites-template <project-name>`, replacing `<project-name>` with the name of your project. The following example creates a project called `my-site`: ```sh -$ wrangler generate --site my-site +$ git clone https://github.com/cloudflare/worker-sites-template my-site ``` This command creates the following: diff --git a/layouts/shortcodes/worker-starter.html b/layouts/shortcodes/worker-starter.html index 4263e4aa4..787dc0ce9 100644 --- a/layouts/shortcodes/worker-starter.html +++ b/layouts/shortcodes/worker-starter.html @@ -3,7 +3,7 @@ {{- $descr := .Get "description" -}} {{- $remote := printf "https://github.com/%s" $repo -}} -{{- $command := printf "wrangler generate my-app %s" $remote -}} +{{- $command := printf "git clone %s my-app" $remote -}} <div class="WorkerStarter"> <div class="WorkerStarter--title"> -- GitLab