Skip to content

Commit

Permalink
Merge branch 'main' into docs/moar-ts-hints
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar authored Aug 9, 2022
2 parents 6b83ceb + e40ba15 commit 538d052
Show file tree
Hide file tree
Showing 146 changed files with 7,897 additions and 4,261 deletions.
2 changes: 1 addition & 1 deletion .github/actions/check_test_project_fixture/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "check_test_project_fixture",
"private": true,
"dependencies": {
"@actions/core": "1.9.0",
"@actions/core": "1.9.1",
"@actions/exec": "1.1.1"
},
"packageManager": "[email protected]"
Expand Down
20 changes: 15 additions & 5 deletions .github/actions/check_test_project_fixture/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ __metadata:
version: 6
cacheKey: 8c0

"@actions/core@npm:1.9.0":
version: 1.9.0
resolution: "@actions/core@npm:1.9.0"
"@actions/core@npm:1.9.1":
version: 1.9.1
resolution: "@actions/core@npm:1.9.1"
dependencies:
"@actions/http-client": ^2.0.1
checksum: 66a238981d7f9aa3c8ca0d80eb87aa291203dabd5c8e60e50d5075632c643883337f342fd677470d6cfd3588c483f32897fbb5c03a400b9c60171a32d2cbeb8d
uuid: ^8.3.2
checksum: 9e568d0df7d659ad0738da66f167d411714f7351fab527fcb91dd6afbeb58006e6cf1f752adc567aab1b9043f96581b2457746f394f7a756f7b14b554d7c4710
languageName: node
linkType: hard

Expand Down Expand Up @@ -43,7 +44,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "check_test_project_fixture@workspace:."
dependencies:
"@actions/core": 1.9.0
"@actions/core": 1.9.1
"@actions/exec": 1.1.1
languageName: unknown
linkType: soft
Expand All @@ -54,3 +55,12 @@ __metadata:
checksum: e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75
languageName: node
linkType: hard

"uuid@npm:^8.3.2":
version: 8.3.2
resolution: "uuid@npm:8.3.2"
bin:
uuid: dist/bin/uuid
checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54
languageName: node
linkType: hard
2 changes: 1 addition & 1 deletion .github/actions/only_doc_changes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "only_doc_changes",
"private": true,
"dependencies": {
"@actions/core": "1.9.0",
"@actions/core": "1.9.1",
"@actions/exec": "1.1.1"
},
"packageManager": "[email protected]"
Expand Down
20 changes: 15 additions & 5 deletions .github/actions/only_doc_changes/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ __metadata:
version: 6
cacheKey: 8c0

"@actions/core@npm:1.9.0":
version: 1.9.0
resolution: "@actions/core@npm:1.9.0"
"@actions/core@npm:1.9.1":
version: 1.9.1
resolution: "@actions/core@npm:1.9.1"
dependencies:
"@actions/http-client": ^2.0.1
checksum: 66a238981d7f9aa3c8ca0d80eb87aa291203dabd5c8e60e50d5075632c643883337f342fd677470d6cfd3588c483f32897fbb5c03a400b9c60171a32d2cbeb8d
uuid: ^8.3.2
checksum: 9e568d0df7d659ad0738da66f167d411714f7351fab527fcb91dd6afbeb58006e6cf1f752adc567aab1b9043f96581b2457746f394f7a756f7b14b554d7c4710
languageName: node
linkType: hard

Expand Down Expand Up @@ -43,7 +44,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "only_doc_changes@workspace:."
dependencies:
"@actions/core": 1.9.0
"@actions/core": 1.9.1
"@actions/exec": 1.1.1
languageName: unknown
linkType: soft
Expand All @@ -54,3 +55,12 @@ __metadata:
checksum: e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75
languageName: node
linkType: hard

"uuid@npm:^8.3.2":
version: 8.3.2
resolution: "uuid@npm:8.3.2"
bin:
uuid: dist/bin/uuid
checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54
languageName: node
linkType: hard
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You'll almost always want to test the functionality of your changes to the Redwo
- run `yarn create redwood-app ./redwood-project`
- `git clone` the [RedwoodJS Tutorial Blog](https://github.com/redwoodjs/redwood-tutorial)
- use a project you've already created
- create a functional test project using `yarn run build:test-project <project directory>` 👀
- create a functional test project: go to the location of your local copy of the Redwood Framework and use `yarn run build:test-project <project directory>` 👀

**Using the functional test project might be the fastest and easiest way to test your changes.**

Expand Down Expand Up @@ -102,7 +102,7 @@ cd redwood-project
RWFW_PATH=~/redwood yarn rwfw project:sync
```
Where <framework directory> is the path to your local copy of the Redwood Framework. Once provided to `rwfw`, it'll remember it and you shouldn't have to provide it again unless you move it.
Where `~/redwood` is the path to your local copy of the Redwood Framework. Once provided to `rwfw`, it'll remember it and you shouldn't have to provide it again unless you move it.

As `project:sync` starts up, it'll start logging to the console. In order, it:

Expand Down
36 changes: 26 additions & 10 deletions __fixtures__/test-project/api/db/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,48 @@ model UserExample {
name String?
}


/// A blog post.
model Post {
/// The unique identifier of a post.
id Int @id @default(autoincrement())
/// The title of a post.
title String
/// The content of a post.
body String
/// When the post was created.
createdAt DateTime @default(now())
/// The id of the author who wrote the post.
authorId Int
/// Who authored the post.
author User @relation(fields: [authorId], references: [id])
}

model Contact {
/// The unique identifier of a contact.
id Int @id @default(autoincrement())
/// The name of the contact.
name String
/// The email of the contact.
email String
/// The message of the contact.
message String
/// When the contact was created.
createdAt DateTime @default(now())
}

/// A User.
model User {
/// The unique identifier of a user.
id Int @id @default(autoincrement())
/// The user's email address.
email String @unique
hashedPassword String
fullName String
hashedPassword String
salt String
resetToken String?
resetTokenExpiresAt DateTime?
/// Roles to which the user belongs.
roles String?
/// Posts the user has authored.
posts Post[]
}

model Contact {
id Int @id @default(autoincrement())
name String
email String
message String
createdAt DateTime @default(now())
}
5 changes: 4 additions & 1 deletion __fixtures__/test-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
"prisma": {
"seed": "yarn rw exec seed"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"resolutions": {
"jest": "28.1.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from '@redwoodjs/testing/web'
import { render } from '@redwoodjs/testing/web'

import { Loading, Empty, Failure, Success } from './BlogPostCell'
import { standard } from './BlogPostCell.mock'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from '@redwoodjs/testing/web'
import { render } from '@redwoodjs/testing/web'

import { Loading, Empty, Failure, Success } from './BlogPostsCell'
import { standard } from './BlogPostsCell.mock'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from '@redwoodjs/testing/web'
import { render } from '@redwoodjs/testing/web'

import { Loading, Empty, Failure, Success } from './WaterfallBlogPostCell'
import { standard } from './WaterfallBlogPostCell.mock'
Expand Down
33 changes: 18 additions & 15 deletions docs/docs/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -897,11 +897,13 @@ A scaffold quickly creates a CRUD for a model by generating the following files
The content of the generated components is different from what you'd get by running them individually.
| Arguments & Options | Description |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model` | Model to scaffold. You can also use `<path/model>` to nest files by type at the given path directory (or directories). For example, `redwood g scaffold admin/post` |
| `--force, -f` | Overwrite existing files |
| `--typescript, --ts` | Generate TypeScript files Enabled by default if we detect your project is TypeScript |
| Arguments & Options | Description |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model` | Model to scaffold. You can also use `<path/model>` to nest files by type at the given path directory (or directories). For example, `redwood g scaffold admin/post` |
| `--docs` | Use or set to `true` to generated comments in SDL to use in self-documentating your app's GraphQL API. See: [Self-Documenting GraphQL API](./graphql.md#self-documenting-graphql-api) [default:false] |
| `--force, -f` | Overwrite existing files |
| `--tailwind` | Generate TailwindCSS version of scaffold.css (automatically set to `true` if TailwindCSS config exists) |
| `--typescript, --ts` | Generate TypeScript files Enabled by default if we detect your project is TypeScript |
**Usage**
Expand Down Expand Up @@ -1075,13 +1077,14 @@ The sdl will inspect your `schema.prisma` and will do its best with relations. S
<!-- See limited generator support for relations
https://community.redwoodjs.com/t/prisma-beta-2-and-redwoodjs-limited-generator-support-for-relations-with-workarounds/361 -->
| Arguments & Options | Description |
| -------------------- | ------------------------------------------------------------------------------------ |
| `model` | Model to generate the sdl for |
| `--crud` | Set to `false`, or use `--no-crud`, if you do not want to generate mutations |
| `--force, -f` | Overwrite existing files |
| `--tests` | Generate service test and scenario [default: true] |
| `--typescript, --ts` | Generate TypeScript files Enabled by default if we detect your project is TypeScript |
| Arguments & Options | Description |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `model` | Model to generate the sdl for |
| `--crud` | Set to `false`, or use `--no-crud`, if you do not want to generate mutations |
| `--docs` | Use or set to `true` to generated comments in SDL to use in self-documentating your app's GraphQL API. See: [Self-Documenting GraphQL API](./graphql.md#self-documenting-graphql-api) [default: false] |
| `--force, -f` | Overwrite existing files |
| `--tests` | Generate service test and scenario [default: true] |
| `--typescript, --ts` | Generate TypeScript files Enabled by default if we detect your project is TypeScript |
> **Note:** The generated sdl will include the `@requireAuth` directive by default to ensure queries and mutations are secure. If your app's queries and mutations are all public, you can set up a custom SDL generator template to apply `@skipAuth` (or a custom validator directive) to suit you application's needs.
Expand Down Expand Up @@ -1264,7 +1267,7 @@ Services are where Redwood puts its business logic. They can be used by your Gra
| `name` | Name of the service |
| `--force, -f` | Overwrite existing files |
| `--typescript, --ts` | Generate TypeScript files Enabled by default if we detect your project is TypeScript |
| `--tests` | Generate test and scenario files [default: true] |
| `--tests` | Generate test and scenario files [default: true] |
**Destroying**
Expand Down Expand Up @@ -1823,15 +1826,15 @@ yarn redwood setup tsconfig
### setup ui
Set up a UI design or style library. Right now the choices are [Chakra UI](https://chakra-ui.com/), [TailwindCSS](https://tailwindcss.com/) and [WindiCSS](https://windicss.org/).
Set up a UI design or style library. Right now the choices are [TailwindCSS](https://tailwindcss.com/), [Chakra UI](https://chakra-ui.com/), [Mantine UI](https://ui.mantine.dev/) and [WindiCSS](https://windicss.org/).
```
yarn rw setup ui <library>
```
| Arguments & Options | Description |
| :------------------ | :-------------------------------------------------------------------------- |
| `library` | Library to configure. Choices are `chakra-ui`, `tailwindcss` and `windicss` |
| `library` | Library to configure. Choices are `chakra-ui`, `tailwindcss`, `mantine`, and `windicss` |
| `--force, -f` | Overwrite existing configuration |
## storybook
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: How to use environment variables on the api and web sides

You can provide environment variables to each side of your Redwood app in different ways, depending on each Side's target, and whether you're in development or production.

> Right now, Redwood apps have two fixed Sides, API and Web, that have each have a single target, nodejs and browser respectively.
> Right now, Redwood apps have two fixed Sides, API and Web, that each have a single target, nodejs and browser respectively.
## Generally

Expand Down Expand Up @@ -46,7 +46,7 @@ By adding environment variables to this array, they'll be available to Web in pr

Note: if someone inspects your site's source, _they could see your `REDWOOD_ENV_SECRET_API_KEY` in plain text._ This is a limitation of delivering static JS and HTML to the browser.

#### Option 2: Prefixing with REDWOOD*ENV*
#### Option 2: Prefixing with REDWOOD\_ENV\_

In `.env`, if you prefix your environment variables with `REDWOOD_ENV_`, they'll be available via `process.env.REDWOOD_ENV_MY_VAR_NAME`, and will be dynamically replaced at built-time.

Expand Down
Loading

0 comments on commit 538d052

Please sign in to comment.