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

Adds docs for jobs setup and generate commands #11359

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 54 additions & 11 deletions docs/docs/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ Create a Redwood project using the yarn create command:
yarn create redwood-app <project directory> [option]
```

| Arguments & Options | Description |
| :--------------------- | :---------------------------------------------------------------------------------------------------------------------- |
| `project directory` | Specify the project directory [Required] |
| `--yarn-install` | Enables the yarn install step and version-requirement checks. You can pass `--no-yarn-install` to disable this behavior |
| `--typescript`, `--ts` | Generate a TypeScript project. JavaScript by default |
| `--overwrite` | Create the project even if the specified project directory isn't empty |
| `--no-telemetry` | Disable sending telemetry events for this create command and all Redwood CLI commands: https://telemetry.redwoodjs.com |
| `--yarn1` | Use yarn 1 instead of yarn 3 |
| `--git-init`, `--git` | Initialize a git repo during the install process, disabled by default |
| Arguments & Options | Description |
| :--------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `project directory` | Specify the project directory [Required] |
| `--yarn-install` | Enables the yarn install step and version-requirement checks. You can pass `--no-yarn-install` to disable this behavior |
| `--typescript`, `--ts` | Generate a TypeScript project. JavaScript by default |
| `--overwrite` | Create the project even if the specified project directory isn't empty |
| `--no-telemetry` | Disable sending telemetry events for this create command and all Redwood CLI commands: [https://telemetry.redwoodjs.com](https://telemetry.redwoodjs.com) |
| `--yarn1` | Use yarn 1 instead of yarn 3 |
| `--git-init`, `--git` | Initialize a git repo during the install process, disabled by default |

If you run into trouble during the yarn install step, which may happen if you're developing on an external drive and in other miscellaneous scenarios, try the `--yarn1` flag:

Expand Down Expand Up @@ -248,7 +248,7 @@ yarn redwood deploy <target>

| Commands | Description |
| :---------------------------- | :--------------------------------------- |
| `serverless ` | Deploy to AWS using Serverless framework |
| `serverless` | Deploy to AWS using Serverless framework |
| `netlify [...commands]` | Build command for Netlify deploy |
| `render <side> [...commands]` | Build command for Render deploy |
| `vercel [...commands]` | Build command for Vercel deploy |
Expand Down Expand Up @@ -436,7 +436,8 @@ Some generators require that their argument be a model in your `schema.prisma`.
| `dataMigration <name>` | Generate a data migration component |
| `dbAuth` | Generate sign in, sign up and password reset pages for dbAuth |
| `deploy <provider>` | Generate a deployment configuration |
| `function <name>` | Generate a Function |
| `function <name>` | Generate a Job |
cannikin marked this conversation as resolved.
Show resolved Hide resolved
| `job <name>` | Generate a background job |
| `layout <name>` | Generate a layout component |
| `page <name> [path]` | Generate a page component |
| `scaffold <model>` | Generate Pages, SDL, and Services files based on a given DB schema Model. Also accepts `<path/model>` |
Expand Down Expand Up @@ -735,6 +736,35 @@ $ /redwood-app/node_modules/.bin/dev-server
17:21:49 api | ► http://localhost:8911/user/
```

### generate job

Generate a background job file (and optional tests) in `api/src/jobs`.

```bash
yarn redwood generate job <name>
```

| Arguments & Options | Description |
| -------------------- | ------------------------------------------------------------------------------------- |
| `name` | Name of the job ("Job" suffix is optional) |
| `--force, -f` | Overwrite existing files |
| `--typescript, --ts` | Generate TypeScript files. Enabled by default if we detect your project is TypeScript |
cannikin marked this conversation as resolved.
Show resolved Hide resolved
| `--tests` | Generate test files [default: true] |

#### Example

```bash
yarn redwood generate job WelcomeEmail
# or
yarn rw g job WelcomeEmail
```

:::info Job naming
By convention a job filename and exported code ends in `Job` and the generate command enforces this. If you don't include "Job" at the end of the name, the generator will add it. For example, with the above command, the file generated would be `api/src/jobs/WelcomeEmailJob/WelcomeEmailJob.{js|ts}`.
:::

Learn more about jobs in the [Background Jobs docs](background-jobs).

### generate layout

Generate a layout component.
Expand Down Expand Up @@ -1755,6 +1785,7 @@ yarn redwood setup <category>
| `deploy` | Set up a deployment configuration for a provider |
| `generator` | Copy default Redwood generator templates locally for customization |
| `i18n` | Set up i18n |
| `jobs` | Set up background job creation and processing |
| `package` | Peform setup actions by running a third-party npm package |
| `tsconfig` | Add relevant tsconfig so you can start using TypeScript |
| `ui` | Set up a UI design or style library |
Expand Down Expand Up @@ -1896,6 +1927,18 @@ In order to use [Netlify Dev](https://www.netlify.com/products/dev/) you need to

> Note: To detect the RedwoodJS framework, please use netlify-cli v3.34.0 or greater.

### setup jobs

This command adds the necessary packages and files defining the configuration for Redwood's [Background Jobs](background-jobs) processing.

```
yarn redwood setup jobs
```

| Arguments & Options | Description |
| :------------------ | :----------------------- |
| `--force, -f` | Overwrite existing files |

### setup mailer

This command adds the necessary packages and files to get started using the RedwoodJS mailer. By default it also creates an example mail template which can be skipped with the `--skip-examples` flag.
Expand Down
Loading