Skip to content

Commit

Permalink
Merge branch 'main' of github.com:redwoodjs/redwood into chore/router…
Browse files Browse the repository at this point in the history
…-dual-pkg

* 'main' of github.com:redwoodjs/redwood: (74 commits)
  chore(deps): Remove webpack related packages (redwoodjs#11028)
  fix(deps): update dependency pino to v9 (redwoodjs#11030)
  fix(deps): update dependency lru-cache to v11 (redwoodjs#11029)
  fix(deps): update dependency @sdl-codegen/node to v1 (redwoodjs#11027)
  chore(deps): update yarn to v4.3.1 (redwoodjs#11026)
  chore(deps): update dependency vitest to v2 (redwoodjs#11021)
  fix(deps): update dependency @react-email/render to v0.0.16 (redwoodjs#11025)
  chore(deps): update dependency rimraf to v6 (redwoodjs#11024)
  chore(deps): update dependency make-dir-cli to v4 (redwoodjs#11023)
  chore(deps): update dependency glob to v11 (redwoodjs#11022)
  chore(deps): update dependency type-fest to v4 (redwoodjs#11020)
  fix(deps): update dependency @whatwg-node/fetch to v0.9.18 (redwoodjs#11016)
  chore(deps): update dependency @supabase/ssr to v0.4.0 (redwoodjs#11017)
  fix(deps): update dependency @joshwooding/vite-plugin-react-docgen-typescript to v0.4.0 (redwoodjs#11018)
  fix(deps): update dependency esbuild to v0.23.0 (redwoodjs#11015)
  fix(deps): update dependency @swc/core to v1.7.0 (redwoodjs#11012)
  chore(storybook): Pin versions and update them (redwoodjs#11011)
  fix(deps): update dependency eslint-plugin-prettier to v5.2.1 (redwoodjs#11010)
  fix(deps): update dependency @vitejs/plugin-react to v4.3.1 (redwoodjs#11013)
  fix(deps): update dependency graphql-yoga to v5.6.1 (redwoodjs#11007)
  ...
  • Loading branch information
dac09 committed Jul 21, 2024
2 parents 968efeb + 5e1caa8 commit 6738c11
Show file tree
Hide file tree
Showing 235 changed files with 3,533 additions and 10,448 deletions.
17 changes: 17 additions & 0 deletions .changesets/10867.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- breaking: remove webpack (#10867) by @Josh-Walker-GM

This PR removes support for webpack.

---
To the person releasing, the follow are the breaking changes I have identified:
1. `prebuildWebFile` is function no longer exported from `@redwoodjs/babel-config` package
2. `@redwoodjs/cli-storybook` has been removed
3. `yarn rw build` no longer accepts the `--stats` flag
4. `yarn rw dev` no longer accepts the `--watchNodeModules` flag
5. `yarn rw setup custom-web-index` command has been removed
6. `yarn rw setup webpack` has been removed
7. `@redwoodjs/core` no longer provides `@redwoodjs/core/config/*` files
8. The `web.bundler` TOML config option has been removed
9. `@redwoodjs/testing` no longer provides storybook config files
10. `@redwoodjs/testing` no longer provides a `StorybookProvider`
11. The `webpack` bin has been removed from `@redwoodjs/web`
25 changes: 25 additions & 0 deletions .changesets/10869.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
feat(prisma): Support multi file Prisma schemas (#10869) by @dthyresson

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.

This PR updates:

* Prisma utilities
* generators
* dbAuth setup
* documentation

to support single and multi file Prisma schemas.

If you have enabled Prisma multi file schemas, you configure your project toml api `schemaPath` setting the directory where your schema.prisma can be found, for example: './api/db/schema'

When [organizing 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
schemaPath = "./api/db/schema"
```
11 changes: 11 additions & 0 deletions .changesets/10893.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
fix(realtime/trusted-docs): Supports GraphQL subscriptions and trusted documents (#10893) by @dthyresson

Fixes: https://github.com/redwoodjs/redwood/issues/10892

This PR updates the SSELink to check if there is a trusted document hash in the request. If there is, then don't also include the query.

The persisted operations plugin checks if the params has a query. If it does then raises an error that only persisted operations are allowed.

Subscriptions failed this test because the request had both the hash and a query. And since there were query details, the request was blocked.

Now, if there is a hash, the SSELink won't add back the query and thus it succeeds.
34 changes: 34 additions & 0 deletions .changesets/10894.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
feat(trusted-docs): Allows useRedwoodTrustedDocuments to set more custom UsePersistedOperationsOptions (#10894) by @dthyresson

Allows useRedwoodTrustedDocuments to set more custom UsePersistedOperationsOptions

Allows the useRedwoodTrustedDocuments plugin to define:

```ts
/**
* Whether to allow execution of arbitrary GraphQL operations aside from persisted operations.
*/
allowArbitraryOperations?: boolean | AllowArbitraryOperationsHandler;
/**
* The path to the persisted operation id
*/
extractPersistedOperationId?: ExtractPersistedOperationId;

/**
* Whether to skip validation of the persisted operation
*/
skipDocumentValidation?: boolean;

/**
* Custom errors to be thrown
*/
customErrors?: CustomPersistedQueryErrors;
```

This can let you override to allow certain ops or skip validation etc:

> If you validate your persisted operations while building your store, we recommend to skip the validation on the server. So this will reduce the work done by the server and the latency of the requests.
The allow authenticated request is still considered, but `allowArbitraryOperations` can override.

Omitted `getPersistedOperation` as this extracts hash from store.
3 changes: 3 additions & 0 deletions .changesets/10900.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- feat(Storybook Vite): Add JS project support (#10900) by @arimendelow

This adds support to the SBV CLI for JS projects.
3 changes: 3 additions & 0 deletions .changesets/10961.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- fix(storybook): Fix import issues with storybook vite (#10961) by @Josh-Walker-GM

Fixes an issue with the `yarn rw storybook-vite` command where it would not start due to an import issue.
3 changes: 3 additions & 0 deletions .changesets/9366.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- 📝 Added page for using GitPod to the documentation (#9366) by @ahaywood

This introduces new documentation to make getting started with redwood using GitPod easy!
2 changes: 1 addition & 1 deletion .github/actions/check_changesets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"@actions/exec": "1.1.1",
"@actions/github": "6.0.0"
},
"packageManager": "yarn@4.3.0"
"packageManager": "yarn@4.3.1"
}
2 changes: 1 addition & 1 deletion .github/actions/check_create_redwood_app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"@actions/core": "1.10.1",
"@actions/exec": "1.1.1"
},
"packageManager": "yarn@4.3.0"
"packageManager": "yarn@4.3.1"
}
2 changes: 1 addition & 1 deletion .github/actions/detect-changes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"@actions/core": "1.10.1",
"@actions/exec": "1.1.1"
},
"packageManager": "yarn@4.3.0"
"packageManager": "yarn@4.3.1"
}
3 changes: 0 additions & 3 deletions .github/actions/set-up-test-project/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ runs:
main: 'setUpTestProject.mjs'

inputs:
bundler:
description: The bundler to use (vite or webpack)
default: vite
canary:
description: Upgrade the project to canary?
default: "false"
Expand Down
21 changes: 0 additions & 21 deletions .github/actions/set-up-test-project/setUpTestProject.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ const TEST_PROJECT_PATH = path.join(

core.setOutput('test-project-path', TEST_PROJECT_PATH)

const bundler = core.getInput('bundler')

const canary = core.getInput('canary') === 'true'


console.log({
bundler,
canary
})

Expand Down Expand Up @@ -73,22 +68,6 @@ const execInProject = createExecWithEnvInCwd(TEST_PROJECT_PATH)
* @returns {Promise<void>}
*/
async function sharedTasks() {
console.log({ bundler })
console.log()

if (bundler === 'webpack') {
console.log(`Setting the bundler to ${bundler}`)
console.log()

const redwoodTOMLPath = path.join(TEST_PROJECT_PATH, 'redwood.toml')
const redwoodTOML = fs.readFileSync(redwoodTOMLPath, 'utf-8')
const redwoodTOMLWithWebpack = redwoodTOML.replace('[web]\n', '[web]\n bundler = "webpack"\n')
fs.writeFileSync(redwoodTOMLPath, redwoodTOMLWithWebpack)

// There's an empty line at the end of the redwood.toml file, so no need to console.log after.
console.log(fs.readFileSync(redwoodTOMLPath, 'utf-8'))
}

console.log('Generating dbAuth secret')
const { stdout } = await execInProject(
'yarn rw g secret --raw',
Expand Down
35 changes: 8 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ jobs:
tutorial-e2e:
needs: check

strategy:
matrix:
bundler: [vite, webpack]

name: 🌲 Tutorial E2E / ${{ matrix.bundler }} / node 20 latest
name: 🌲 Tutorial E2E / node 20 latest
runs-on: ubuntu-latest

steps:
Expand All @@ -148,7 +144,6 @@ jobs:
git config --global user.name "Your Name"
./tasks/run-e2e "$project_path" \
--bundler ${{ matrix.bundler }} \
--no-build-framework \
--no-start
Expand All @@ -173,7 +168,7 @@ jobs:
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.bundler }}-logs
name: logs
path: |
${{ steps.crwa.outputs.project-path }}/dev_server.log
${{ steps.crwa.outputs.project-path }}/e2e.log
Expand All @@ -182,11 +177,7 @@ jobs:
needs: detect-changes
if: needs.detect-changes.outputs.code == 'false'

strategy:
matrix:
bundler: [vite, webpack]

name: 🌲 Tutorial E2E / ${{ matrix.bundler }} / node 20 latest
name: 🌲 Tutorial E2E / node 20 latest
runs-on: ubuntu-latest

steps:
Expand All @@ -198,9 +189,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
bundler: [vite, webpack]

name: 🔄 Smoke tests / ${{ matrix.os }} / ${{ matrix.bundler }} / node 20 latest
name: 🔄 Smoke tests / ${{ matrix.os }} / node 20 latest
runs-on: ${{ matrix.os }}

env:
Expand All @@ -217,8 +207,6 @@ jobs:
- name: 🌲 Set up test project
id: set-up-test-project
uses: ./.github/actions/set-up-test-project
with:
bundler: ${{ matrix.bundler }}
env:
REDWOOD_DISABLE_TELEMETRY: 1
YARN_ENABLE_IMMUTABLE_INSTALLS: false
Expand Down Expand Up @@ -278,9 +266,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
bundler: [vite, webpack]

name: 🔄 Smoke tests / ${{ matrix.os }} / ${{ matrix.bundler }} / node 20 latest
name: 🔄 Smoke tests / ${{ matrix.os }} / node 20 latest
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -292,9 +279,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
bundler: [vite, webpack]

name: 🔄 Smoke tests React 18 / ${{ matrix.os }} / ${{ matrix.bundler }} / node 20 latest
name: 🔄 Smoke tests React 18 / ${{ matrix.os }} / node 20 latest
runs-on: ${{ matrix.os }}

env:
Expand Down Expand Up @@ -330,8 +316,6 @@ jobs:
- name: 🌲 Set up test project for React 18
id: set-up-test-project-react-18
uses: ./.github/actions/set-up-test-project
with:
bundler: ${{ matrix.bundler }}
env:
REDWOOD_DISABLE_TELEMETRY: 1
YARN_ENABLE_IMMUTABLE_INSTALLS: false
Expand Down Expand Up @@ -391,9 +375,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
bundler: [vite, webpack]

name: 🔄 Smoke tests React 18 / ${{ matrix.os }} / ${{ matrix.bundler }} / node 20 latest
name: 🔄 Smoke tests React 18 / ${{ matrix.os }} / node 20 latest
runs-on: ${{ matrix.os }}

steps:
Expand Down Expand Up @@ -446,7 +429,7 @@ jobs:
working-directory: ${{ steps.set-up-test-project.outputs.test-project-path }}

- name: Run "rw storybook"
run: yarn rw sb --smoke-test
run: yarn rw sbv --smoke-test
working-directory: ${{ steps.set-up-test-project.outputs.test-project-path }}

- name: Run "rw exec"
Expand Down Expand Up @@ -667,7 +650,6 @@ jobs:
id: set-up-test-project
uses: ./.github/actions/set-up-test-project
with:
bundler: vite
canary: true
env:
REDWOOD_DISABLE_TELEMETRY: 1
Expand Down Expand Up @@ -739,7 +721,6 @@ jobs:
id: set-up-test-project
uses: ./.github/actions/set-up-test-project
with:
bundler: vite
canary: true
env:
REDWOOD_DISABLE_TELEMETRY: 1
Expand Down
2 changes: 1 addition & 1 deletion docs/.node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.13.1
20.15.1
17 changes: 17 additions & 0 deletions docs/docs/app-configuration-redwood-toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,26 @@ Don't make secrets available to your web side. Everything in `includeEnvironment
| :------------- | :---------------------------------- | :------------------------- |
| `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` |
| `serverConfig` | [Deprecated; use the [server file](./docker.md#using-the-server-file) instead] Path to the `server.config.js` file | `'./api/server.config.js'` |

### 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.

:::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
schemaPath = "./api/db/schema"
```

## [browser]

```toml title="redwood.toml"
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ Each lambda function in `./api/dist/functions` is parsed by zip-it-and-ship-it r
## Web

The web side of Redwood is packaged by Webpack into the `./web/dist` folder.
The web side of Redwood is built by Vite into the `./web/dist` folder.
Loading

0 comments on commit 6738c11

Please sign in to comment.