Skip to content

Commit

Permalink
Merge branch 'main' of github.com:redwoodjs/redwood into feat/dc-kc-e…
Browse files Browse the repository at this point in the history
…xperimental-vite-optin

* 'main' of github.com:redwoodjs/redwood: (27 commits)
  fix(deps): update dependency @types/node to v16.18.9 (#7140)
  fix(deps): update dependency vscode-languageserver-textdocument to v1.0.8 (#7132)
  fix: add cli-helpers as dep (#7141)
  remove deprecated auth providers (#7138)
  chore: update test project fixture dbauth packages (#7139)
  NavLink not highlighting when on sub pages (#6939)
  Rename create auth functions (#7137)
  Export underlying cache client with Service Cache functions (#7062)
  fix(deps): update dependency @simplewebauthn/browser to v6.2.2 (#7103)
  fix(deps): update dependency msw to v0.49.2 (#7126)
  chore(deps): update dependency nx to v15.3.3 (#7125)
  fix(deps): update docusaurus monorepo to v2.2.0 (#7116)
  [docs] How to test in GitHub actions (#6921)
  fix(deps): update typescript-eslint monorepo to v5.46.1 (#7109)
  Codemod to include full-name in test-project signup (#7124)
  Rebuild test-project fixture (#7123)
  feat: add CustomValidator (#7051)
  dbAuthClient (#7111)
  chore(deps): update dependency nx to v15.3.2 (#7114)
  chore(deps): update dependency redis to v4.5.1 (#7115)
  ...
  • Loading branch information
dac09 committed Dec 14, 2022
2 parents 0c6ecea + bedee5c commit f071045
Show file tree
Hide file tree
Showing 172 changed files with 7,306 additions and 5,296 deletions.
2 changes: 1 addition & 1 deletion __fixtures__/test-project/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@redwoodjs/api": "3.2.0",
"@redwoodjs/auth-dbauth-api": "4.0.0-canary.319+867569f28",
"@redwoodjs/auth-dbauth-api": "4.0.0-canary.368+aa6fb1e09",
"@redwoodjs/graphql-server": "3.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const standard = defineScenario<Prisma.PostCreateArgs>({
body: 'String',
author: {
create: {
email: 'String9024253',
email: 'String2399859',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
Expand All @@ -24,7 +24,7 @@ export const standard = defineScenario<Prisma.PostCreateArgs>({
body: 'String',
author: {
create: {
email: 'String425638',
email: 'String4475086',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export const standard = defineScenario<Prisma.UserCreateArgs>({
user: {
one: {
data: {
email: 'String7002266',
email: 'String3489044',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
},
},
two: {
data: {
email: 'String4616578',
email: 'String8239407',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
Expand Down
6 changes: 3 additions & 3 deletions __fixtures__/test-project/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
]
},
"dependencies": {
"@redwoodjs/auth-dbauth-web": "4.0.0-canary.319+867569f28",
"@redwoodjs/auth-dbauth-web": "4.0.0-canary.368+aa6fb1e09",
"@redwoodjs/forms": "3.2.0",
"@redwoodjs/router": "3.2.0",
"@redwoodjs/web": "3.2.0",
Expand All @@ -24,9 +24,9 @@
},
"devDependencies": {
"autoprefixer": "^10.4.13",
"postcss": "^8.4.19",
"postcss": "^8.4.20",
"postcss-loader": "^7.0.2",
"prettier-plugin-tailwindcss": "^0.2.0",
"prettier-plugin-tailwindcss": "^0.2.1",
"tailwindcss": "^3.2.4"
}
}
6 changes: 4 additions & 2 deletions __fixtures__/test-project/web/src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { createDbAuth } from '@redwoodjs/auth-dbauth-web'
import { createDbAuthClient, createAuth } from '@redwoodjs/auth-dbauth-web'

export const { AuthProvider, useAuth } = createDbAuth()
const dbAuthClient = createDbAuthClient()

export const { AuthProvider, useAuth } = createAuth(dbAuthClient)
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ const ForgotPasswordPage = () => {
errorClassName="rw-input rw-input-error"
ref={usernameRef}
validation={{
required: true,
required: {
value: true,
message: 'Username is required',
},
}}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const LoginPage = () => {
}, [])

const onSubmit = async (data: Record<string, string>) => {
const response = await logIn({ ...data })
const response = await logIn({
username: data.username,
password: data.password,
})

if (response.message) {
toast(response.message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const ResetPasswordPage = ({ resetToken }: { resetToken: string }) => {
validation={{
required: {
value: true,
message: 'Password is required',
message: 'New Password is required',
},
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ const SignupPage = () => {
}
}, [isAuthenticated])

// focus on email box on page load
// focus on username box on page load
const usernameRef = useRef<HTMLInputElement>(null)
useEffect(() => {
usernameRef.current?.focus()
}, [])

const onSubmit = async (data: Record<string, string>) => {
const response = await signUp({ ...data })
const response = await signUp({
username: data.username,
password: data.password,
'full-name': data['full-name'],
})

if (response.message) {
toast(response.message)
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/auth/firebase.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ We're using [Firebase Google Sign-In](https://firebase.google.com/docs/auth/web/
import * as firebaseAuth from '@firebase/auth'
import { initializeApp, getApp, getApps } from 'firebase/app'

import { createFirebaseAuth } from '@redwoodjs/auth-providers-web'
import { createAuth } from '@redwoodjs/auth-providers-web'

const firebaseConfig = {
apiKey: process.env.FIREBASE_API_KEY,
Expand Down Expand Up @@ -50,7 +50,7 @@ export const firebaseClient = {
firebaseApp,
}

export const { AuthProvider, useAuth } = createFirebaseAuth(firebaseClient)
export const { AuthProvider, useAuth } = createAuth(firebaseClient)
```

## Usage
Expand Down
29 changes: 22 additions & 7 deletions docs/docs/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ Cells are signature to Redwood. We think they provide a simpler and more declara
| `--list` | Use this flag to generate a list cell. This flag is needed when dealing with irregular words whose plural and singular is identical such as equipment or pokemon |
| `--tests` | Generate test files [default: true] |
| `--stories` | Generate Storybook files [default: true] |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Usage**
Expand Down Expand Up @@ -519,6 +520,7 @@ Redwood loves function components and makes extensive use of React Hooks, which
| `--typescript, --ts` | Generate TypeScript files Enabled by default if we detect your project is TypeScript |
| `--tests` | Generate test files [default: true] |
| `--stories` | Generate Storybook files [default: true] |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Destroying**
Expand Down Expand Up @@ -568,6 +570,7 @@ Creates a data migration script in `api/db/dataMigrations`.
| Arguments & Options | Description |
| :------------------ | :----------------------------------------------------------------------- |
| `name` | Name of the data migration, prefixed with a timestamp at generation time |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Usage**
Expand All @@ -585,9 +588,12 @@ Generate log in, sign up, forgot password and password reset pages for dbAuth
yarn redwood generate dbAuth
```
| Arguments & Options | Description |
| ------------------- | ------------------------------------------------------------------------------------------------ |
| `--webAuthn` | Whether or not to add webAuthn support to the log in page. If not specified you will be prompted |
| Arguments & Options | Description |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `--username-label` | The label to give the username field on the auth forms, e.g. "Email". Defaults to "Username". If not specified you will be prompted |
| `--password-label` | The label to give the password field on the auth forms, e.g. "Secret". Defaults to "Password". If not specified you will be prompted |
| `--webAuthn` | Whether or not to add webAuthn support to the log in page. If not specified you will be prompted |
| `--rollback` | Rollback changes if an error occurs [default: true]
If you don't want to create your own log in, sign up, forgot password and
password reset pages from scratch you can use this generator. The pages will be
Expand All @@ -613,6 +619,7 @@ yarn redwood generate directive <name>
| `--force, -f` | Overwrite existing files |
| `--typescript, --ts` | Generate TypeScript files (defaults to your projects language target) |
| `--type` | Directive type [Choices: "validator", "transformer"] |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Usage**
Expand Down Expand Up @@ -651,6 +658,7 @@ Not to be confused with Javascript functions, Capital-F Functions are meant to b
| `name` | Name of the function |
| `--force, -f` | Overwrite existing files |
| `--typescript, --ts` | Generate TypeScript files Enabled by default if we detect your project is TypeScript |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Usage**
Expand Down Expand Up @@ -720,6 +728,7 @@ Layouts wrap pages and help you stay DRY.
| `--tests` | Generate test files [default: true] |
| `--stories` | Generate Storybook files [default: true] |
| `--skipLink` | Generate a layout with a skip link [default: false] |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Usage**
Expand Down Expand Up @@ -763,10 +772,11 @@ Generate a RedwoodRecord model.
yarn redwood generate model <name>
```
| Arguments & Options | Description |
| ------------------- | ------------------------------------ |
| `name` | Name of the model (in schema.prisma) |
| `--force, -f` | Overwrite existing files |
| Arguments & Options | Description |
| ------------------- | ----------------------------------------------------- |
| `name` | Name of the model (in schema.prisma) |
| `--force, -f` | Overwrite existing files |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Usage**
Expand Down Expand Up @@ -814,6 +824,7 @@ This also updates `Routes.js` in `./web/src`.
| `--typescript, --ts` | Generate TypeScript files Enabled by default if we detect your project is TypeScript |
| `--tests` | Generate test files [default: true] |
| `--stories` | Generate Storybook files [default: true] |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Destroying**
Expand Down Expand Up @@ -939,6 +950,7 @@ The content of the generated components is different from what you'd get by runn
| `--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 |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Usage**
Expand Down Expand Up @@ -1075,6 +1087,7 @@ Generates an arbitrary Node.js script in `./scripts/<name>` that can be used wit
| -------------------- | ------------------------------------------------------------------------------------ |
| `name` | Name of the service |
| `--typescript, --ts` | Generate TypeScript files Enabled by default if we detect your project is TypeScript |
| `--rollback` | Rollback changes if an error occurs [default: true] |
Scripts have access to services and libraries used in your project. Some examples of how this can be useful:
Expand Down Expand Up @@ -1120,6 +1133,7 @@ https://community.redwoodjs.com/t/prisma-beta-2-and-redwoodjs-limited-generator-
| `--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 |
| `--rollback` | Rollback changes if an error occurs [default: true] |
> **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 @@ -1303,6 +1317,7 @@ Services are where Redwood puts its business logic. They can be used by your Gra
| `--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] |
| `--rollback` | Rollback changes if an error occurs [default: true] |
**Destroying**
Expand Down
Loading

0 comments on commit f071045

Please sign in to comment.