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

chore(docs): update prettier config and format docs content #11293

Merged
merged 5 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# Ignore fixture projects
__fixtures__

# Ignore the docs (docusaurus) project
docs/
# Ignore the certain files in /docs
/docs/versioned_docs
/docs/versioned_sidebars

# Ignore the .nx directory
/.nx
Expand Down
12 changes: 0 additions & 12 deletions .prettierrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ After running `yarn start`, you should be able to see your changes in the local

#### Internal linking

For links to other docs inside the `tutorials` directory you need to use *relative* links.
For links to other docs inside the `tutorials` directory you need to use _relative_ links.

```
In [previous section](./first-page) we....
Expand All @@ -35,6 +35,7 @@ Fork the repo, make your changes and open a PR on GitHub. That will build and la
Double check that your changes look good!

### Updating Doc Images

To update any images in the doc, first upload your screenshot into a comment textbox in your PR. Once it's uploaded, you can open the image in a new tab and use the github url as a image link in your docs.

## Contributors
Expand Down
42 changes: 20 additions & 22 deletions docs/docs/app-configuration-redwood-toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ For certain options, instead of having to configure build tools directly, there'

## [web]

| Key | Description | Default |
| :---------------------------- | :--------------------------------------------------------- | :---------------------- |
| `title` | Title of your Redwood app | `'Redwood App'` |
| `port` | Port for the web server to listen at | `8910` |
| `apiUrl` | URL to your api server. This can be a relative URL in which case it acts like a proxy, or a fully-qualified URL | `'/.redwood/functions'` |
| `includeEnvironmentVariables` | Environment variables made available to the web side during dev and build | `[]` |
| `host` | Hostname for the web server to listen at | Defaults to `'0.0.0.0'` in production and `'::'` in development |
| `apiGraphQLUrl` | URL to your GraphQL function | `'${apiUrl}/graphql'` |
| `apiDbAuthUrl` | URL to your dbAuth function | `'${apiUrl}/auth'` |
| `sourceMap` | Enable source maps for production builds | `false` |
| `a11y` | Enable storybook `addon-a11y` and `eslint-plugin-jsx-a11y` | `true` |
| Key | Description | Default |
| :---------------------------- | :-------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------- |
| `title` | Title of your Redwood app | `'Redwood App'` |
| `port` | Port for the web server to listen at | `8910` |
| `apiUrl` | URL to your api server. This can be a relative URL in which case it acts like a proxy, or a fully-qualified URL | `'/.redwood/functions'` |
| `includeEnvironmentVariables` | Environment variables made available to the web side during dev and build | `[]` |
| `host` | Hostname for the web server to listen at | Defaults to `'0.0.0.0'` in production and `'::'` in development |
| `apiGraphQLUrl` | URL to your GraphQL function | `'${apiUrl}/graphql'` |
| `apiDbAuthUrl` | URL to your dbAuth function | `'${apiUrl}/auth'` |
| `sourceMap` | Enable source maps for production builds | `false` |
| `a11y` | Enable storybook `addon-a11y` and `eslint-plugin-jsx-a11y` | `true` |

### Customizing the GraphQL Endpoint

Expand Down Expand Up @@ -105,30 +105,28 @@ Don't make secrets available to your web side. Everything in `includeEnvironment

## [api]

| Key | Description | Default |
| :------------- | :---------------------------------- | :------------------------- |
| `port` | Port for the api server to listen at | `8911` |
| `host` | Hostname for the api server to listen at | Defaults to `'0.0.0.0'` in production and `'::'` in development |
| `schemaPath` | The location of your Prisma schema. If you have [enabled Prisma multi file schemas](https://www.prisma.io/docs/orm/prisma-schema/overview/location#multi-file-prisma-schema), then its value is the directory where your `schema.prisma` can be found, for example: `'./api/db/schema'` | Defaults to `'./api/db/schema.prisma'` |
| `debugPort` | Port for the debugger to listen at | `18911` |

| Key | Description | Default |
| :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------- |
| `port` | Port for the api server to listen at | `8911` |
| `host` | Hostname for the api server to listen at | Defaults to `'0.0.0.0'` in production and `'::'` in development |
| `schemaPath` | The location of your Prisma schema. If you have [enabled Prisma multi file schemas](https://www.prisma.io/docs/orm/prisma-schema/overview/location#multi-file-prisma-schema), then its value is the directory where your `schema.prisma` can be found, for example: `'./api/db/schema'` | Defaults to `'./api/db/schema.prisma'` |
| `debugPort` | Port for the debugger to listen at | `18911` |

Additional server configuration can be done using [Server File](docker.md#using-the-server-file)


### Multi File Schema

Prisma's `prismaSchemaFolder` [feature](https://www.prisma.io/docs/orm/prisma-schema/overview/location#multi-file-prisma-schema) allows you to define multiple files in a schema subdirectory of your prisma directory.
Prisma's `prismaSchemaFolder` [feature](https://www.prisma.io/docs/orm/prisma-schema/overview/location#multi-file-prisma-schema) allows you to define multiple files in a schema subdirectory of your prisma directory.

:::note Important
:::note Important
If you wish to [organize your Prisma Schema into multiple files](https://www.prisma.io/blog/organize-your-prisma-schema-with-multi-file-support), you will need [enable](https://www.prisma.io/docs/orm/prisma-schema/overview/location#multi-file-prisma-schema) that feature in Prisma, move your `schema.prisma` file into a new directory such as `./api/db/schema` and then set `schemaPath` in the api toml config.
:::

For example:

```toml title="redwood.toml"
[api]
port = 8911
port = 8911
schemaPath = "./api/db/schema"
```

Expand Down
16 changes: 8 additions & 8 deletions docs/docs/assets-and-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ export const CarIcon = (props: SVGProps) => {

If you needed to convert a whole library of SVGs into stylable (or animatable!) components, one easy way would be to use the [SVGR cli](https://react-svgr.com/docs/cli/)


## Custom fonts

There are many different ways to peel this potato – it's all a search away – but if you're using the CSS `@font-face` rule, we have a quick tip for you:

1. Place your fonts in the public folder, so it gets carried across
Expand All @@ -154,15 +154,15 @@ There are many different ways to peel this potato – it's all a search away –
```shell
web/
├── src
├── App.tsx
├── entry.client.tsx
├── index.css
├── ...
├── App.tsx
├── entry.client.tsx
├── index.css
├── ...
├── public
├── favicon.png
├── fonts
│ ├── favicon.png
│ ├── fonts
// highlight-next-line
└── RedwoodNeue.woff2
└── RedwoodNeue.woff2
```

```css
Expand Down
9 changes: 4 additions & 5 deletions docs/docs/auth/azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ const HomePage = () => {
{/* MetaTags, h1, paragraphs, etc. */}

<p>{JSON.stringify({ isAuthenticated })}</p>
<button onClick={signUp}>
Sign Up
</button>
<button onClick={signUp}>Sign Up</button>
</>
)
}
Expand Down Expand Up @@ -155,7 +153,7 @@ AZURE_ACTIVE_DIRECTORY_KNOWN_AUTHORITY=https://rwauthtestb2c.b2clogin.com
```

And don't forget to add `AZURE_ACTIVE_DIRECTORY_KNOWN_AUTHORITY` to the `includeEnvironmentVariables` array in `redwood.toml`.
(`AZURE_ACTIVE_DIRECTORY_JWT_ISSUER` is only used on the API side. But more importantly, it's sensitive—do *not* include it in the web side.)
(`AZURE_ACTIVE_DIRECTORY_JWT_ISSUER` is only used on the API side. But more importantly, it's sensitive—do _not_ include it in the web side.)

#### Update `activeDirectoryClient` instance

Expand All @@ -170,13 +168,14 @@ const azureActiveDirectoryClient = new PublicClientApplication({
postLogoutRedirectUri:
process.env.AZURE_ACTIVE_DIRECTORY_LOGOUT_REDIRECT_URI,
// highlight-next-line
knownAuthorities: [process.env.AZURE_ACTIVE_DIRECTORY_KNOWN_AUTHORITY]
knownAuthorities: [process.env.AZURE_ACTIVE_DIRECTORY_KNOWN_AUTHORITY],
},
})
```

Now you can call the `logIn` and `logOut` functions from `useAuth()`, and everything should just work.

Here's a few more links to relevant documentation for reference:

- [Overview of tokens in Azure Active Directory B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/tokens-overview)
- [Working with MSAL.js and Azure AD B2C](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/working-with-b2c.md)
4 changes: 1 addition & 3 deletions docs/docs/auth/clerk.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ See the [migration guide](https://github.com/redwoodjs/redwood/releases/tag/v5.3

:::


To get started, run the setup command:

```text
Expand Down Expand Up @@ -83,7 +82,6 @@ const HomePage = () => {

Clicking sign up should open a sign-up box and after you sign up, you should see `{"isAuthenticated":true}` on the page.


## Customizing the session token

There's not a lot to the default session token.
Expand All @@ -105,7 +103,7 @@ export const getCurrentUser = async (

// ...
}
````
```

## Avoiding feature duplication

Expand Down
18 changes: 12 additions & 6 deletions docs/docs/auth/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ We'll take all the work you have to do reading docs for granted here and cut to
import { NhostClient } from '@nhost/nhost-js'

const client = new NhostClient({
backendUrl: '...'
backendUrl: '...',
})
```

Expand Down Expand Up @@ -105,7 +105,7 @@ import { NhostClient } from '@nhost/nhost-js'
// ...

const client = new NhostClient({
backendUrl: process.env.NHOST_BACKEND_URL
backendUrl: process.env.NHOST_BACKEND_URL,
})
```

Expand Down Expand Up @@ -283,10 +283,16 @@ const HomePage = () => {
{/* MetaTags, h1, paragraphs, etc. */}

<p>{JSON.stringify({ isAuthenticated })}</p>
<button onClick={() => signUp({
// email: '[email protected]',
// password: 'super secret password',
})}>sign up</button>
<button
onClick={() =>
signUp({
// email: '[email protected]',
// password: 'super secret password',
})
}
>
sign up
</button>
</>
)
}
Expand Down
36 changes: 19 additions & 17 deletions docs/docs/auth/dbauth.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Almost all config for dbAuth lives in `api/src/functions/auth.js` in the object
### allowedUserFields

```javascript
allowedUserFields: ["id", "email"]
allowedUserFields: ['id', 'email']
```

Most of the auth handlers accept a `user` argument that you can reference in the body of the function. These handlers also sometimes return that `user` object. As a security measure, `allowedUserFields` defines the only properties that will be available in that object so that sensitive data isn't accidentally leaked by these handlers to the client.
Expand Down Expand Up @@ -223,13 +223,16 @@ If the password is valid, return `true`. Otherwise, throw the `PasswordValidatio
```javascript
signup: {
passwordValidation: (password) => {

if (password.length < 8) {
throw new PasswordValidationError('Password must be at least 8 characters')
throw new PasswordValidationError(
'Password must be at least 8 characters'
)
}

if (!password.match(/[A-Z]/)) {
throw new PasswordValidationError('Password must contain at least one capital letter')
throw new PasswordValidationError(
'Password must contain at least one capital letter'
)
}

return true
Expand Down Expand Up @@ -299,13 +302,13 @@ login: {

By default no setting is required. This is because each db has its own rules for enabling this feature. To enable please see the table below and pick the correct 'userMatchString' for your db of choice.

| DB | Default | usernameMatchString | notes |
|---|---|---|---|
| Postgres | 'default' | 'insensitive' | |
| MySQL | 'case-insensitive' | N/A | turned on by default so no setting required |
| MongoDB | 'default' | 'insensitive' |
| SQLite | N/A | N/A | [Not Supported] Insensitive checks can only be defined at a per column level |
| Microsoft SQL Server | 'case-insensitive' | N/A | turned on by default so no setting required |
| DB | Default | usernameMatchString | notes |
| -------------------- | ------------------ | ------------------- | ---------------------------------------------------------------------------- |
| Postgres | 'default' | 'insensitive' | |
| MySQL | 'case-insensitive' | N/A | turned on by default so no setting required |
| MongoDB | 'default' | 'insensitive' |
| SQLite | N/A | N/A | [Not Supported] Insensitive checks can only be defined at a per column level |
| Microsoft SQL Server | 'case-insensitive' | N/A | turned on by default so no setting required |

### Cookie config

Expand Down Expand Up @@ -440,13 +443,13 @@ In both cases, actual scanning and matching of devices is handled by the operati

WebAuthn is supported in the following browsers (as of July 2022):

| OS | Browser | Authenticator |
| ------- | ------- | ------------- |
| macOS | Firefox | Yubikey Security Key NFC (USB), Yubikey 5Ci, SoloKey |
| OS | Browser | Authenticator |
| ------- | ------- | -------------------------------------------------------------- |
| macOS | Firefox | Yubikey Security Key NFC (USB), Yubikey 5Ci, SoloKey |
| macOS | Chrome | Touch ID, Yubikey Security Key NFC (USB), Yubikey 5Ci, SoloKey |
| iOS | All | Face ID, Touch ID, Yubikey Security Key NFC (NFC), Yubikey 5Ci |
| Android | Chrome | Fingerprint Scanner, caBLE |
| Android | Firefox | Screen PIN |
| Android | Chrome | Fingerprint Scanner, caBLE |
| Android | Firefox | Screen PIN |

### Configuration

Expand Down Expand Up @@ -528,7 +531,6 @@ import { db } from 'src/lib/db'
import { DbAuthHandler } from '@redwoodjs/api'

export const handler = async (event, context) => {

// assorted handler config here...

const authHandler = new DbAuthHandler(event, context, {
Expand Down
14 changes: 10 additions & 4 deletions docs/docs/auth/firebase.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,16 @@ const HomePage = () => {
{/* MetaTags, h1, paragraphs, etc. */}

<p>{JSON.stringify({ isAuthenticated })}</p>
<button onClick={() => signUp({
// email: '[email protected]',
// password: 'super secret password',
})}>sign up</button>
<button
onClick={() =>
signUp({
// email: '[email protected]',
// password: 'super secret password',
})
}
>
sign up
</button>
</>
)
}
Expand Down
Loading
Loading