Skip to content
Open
Show file tree
Hide file tree
Changes from 147 commits
Commits
Show all changes
284 commits
Select commit Hold shift + click to select a range
2dabca5
update test project fixture
Tobbe Jul 13, 2025
ed87de0
Run vitest
Tobbe Jul 13, 2025
88a3b65
vitest app root config
Tobbe Jul 14, 2025
1e55968
fix(api): Fix SupportedVerifierTypes import
Tobbe Jul 14, 2025
90a4764
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 14, 2025
14ce45b
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 14, 2025
a0297e4
fix(api): Fix webhook exports
Tobbe Jul 14, 2025
e345021
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 14, 2025
eb5f462
vitest api config
Tobbe Jul 14, 2025
dc6be5c
update create-cedar-app templates and tests
Tobbe Jul 14, 2025
50af3ff
update test project fixture
Tobbe Jul 14, 2025
c8588ea
feat(cli): Tailwind and PostCSS .cjs
Tobbe Jul 14, 2025
e42252c
templates: set "type": "module" by default
Tobbe Jul 14, 2025
704e8c6
.js imports for dbAuth setup
Tobbe Jul 14, 2025
7bd71df
service template: .js extension in relative import
Tobbe Jul 14, 2025
c45a4ba
vitest.setup.ts
Tobbe Jul 14, 2025
bd5981e
hacky @cedarjs/auth resolve alias
Tobbe Jul 15, 2025
e64f3d9
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 18, 2025
58f0803
fix create-cedar-app test
Tobbe Jul 18, 2025
3d80f10
fix test.test.js and update snapshots
Tobbe Jul 18, 2025
9b48e56
fix tailwind test
Tobbe Jul 18, 2025
8142432
testing plugins etc
Tobbe Jul 19, 2025
cb3076d
fix building
Tobbe Jul 19, 2025
6a0b7ea
Skip building cjs types for now
Tobbe Jul 19, 2025
eabf42d
esm/cjs comment
Tobbe Jul 19, 2025
f070c49
improve regex
Tobbe Jul 19, 2025
cfb4c04
include cjs config files in eslint config
Tobbe Jul 19, 2025
bcdde70
update test project fixture
Tobbe Jul 19, 2025
69347af
vite-plugin-creaet-auth-import-transform: simplify regex
Tobbe Jul 19, 2025
0c4d042
anchor regex
Tobbe Jul 19, 2025
c9c6edb
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 19, 2025
4d67b35
Remove check for jest config
Tobbe Jul 19, 2025
882667e
fix(routes): Don't import Routes from sub-folders
Tobbe Jul 19, 2025
cad471b
improve testing
Tobbe Jul 19, 2025
4bf055f
fix test test
Tobbe Jul 19, 2025
aac576e
fix project config test
Tobbe Jul 19, 2025
1903101
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 19, 2025
b9074a1
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 21, 2025
8a79568
match vitest watch behavior with jest
Tobbe Jul 21, 2025
adff625
vitest: Fix running all sides by default
Tobbe Jul 21, 2025
4c466db
Remove unused vitest-config.ts file
Tobbe Jul 21, 2025
2559bf4
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 21, 2025
2e54046
yarn dedupe
Tobbe Jul 21, 2025
9d0bed2
Update service template to include extension in imports
Tobbe Jul 22, 2025
cb65692
only run vitest for changed files by default
Tobbe Jul 22, 2025
677e912
More work to support using vitest in Cedar apps
Tobbe Jul 22, 2025
a4027fa
make it build
Tobbe Jul 22, 2025
4550f57
fix eslint version mismatch
Tobbe Jul 22, 2025
e01e1c1
rename autoImportsPlugin
Tobbe Jul 22, 2025
80d34e7
fix vitest version mismatch by using peerdep
Tobbe Jul 22, 2025
7670079
vitest config plugin
Tobbe Jul 22, 2025
0db29ed
move globalSetup into custom vitest env
Tobbe Jul 22, 2025
7c5fe15
merge fw vitest setup files with user's
Tobbe Jul 22, 2025
691f3f9
sync vitest-api.setup.ts with project
Tobbe Jul 22, 2025
ee3163f
updated vitest config
Tobbe Jul 22, 2025
33967ad
use mergeConfig() for vitest api side config
Tobbe Jul 23, 2025
d01477a
remove commendted code
Tobbe Jul 23, 2025
5abf8fc
.js import and source format
Tobbe Jul 23, 2025
80dcbc6
Let vitest handle merging
Tobbe Jul 23, 2025
100ba35
vitest preset
Tobbe Jul 23, 2025
4bf5bc5
rename to -preset.ts
Tobbe Jul 23, 2025
5b60988
export vitest preset from /api
Tobbe Jul 23, 2025
cea0cb4
refactor testing module
Tobbe Jul 23, 2025
e8021fd
update templates
Tobbe Jul 23, 2025
bd44a4d
move public vitest preset export to vite package
Tobbe Jul 23, 2025
a712d18
copy envVarDefinitions to testing package to avoid circular deps
Tobbe Jul 23, 2025
f215bda
copy envVarDefinitions to testing package to avoid circular deps
Tobbe Jul 23, 2025
21cb7ce
add todo for env var config
Tobbe Jul 23, 2025
c00c6a3
update test project fixture
Tobbe Jul 23, 2025
a871cb6
fix tests
Tobbe Jul 23, 2025
4250f3b
update fragment test project fixture
Tobbe Jul 23, 2025
85c157d
chore(ci): Remove unneeded awaits in specs
Tobbe Jul 23, 2025
0c75624
debug tests
Tobbe Jul 23, 2025
b2d24fb
fix tests on CI
Tobbe Jul 23, 2025
c1eb936
update test-project templates to use .js on relative imports
Tobbe Jul 23, 2025
a161b54
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 24, 2025
86cac46
fix(prerender): Use built LocationProvider
Tobbe Jul 24, 2025
b020da4
update templates to include vitest as a dev dep
Tobbe Jul 24, 2025
42cf79a
update default vitest config
Tobbe Jul 24, 2025
b95567d
remove debug logs
Tobbe Jul 24, 2025
0593759
chore(prerender): Use readFile instead of require for json file
Tobbe Jul 24, 2025
66f3ed5
chore(cli): Remove unused runScriptFunction() from execBabel
Tobbe Jul 24, 2025
98733d0
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 25, 2025
70cbbf7
wip prerender esm support
Tobbe Jul 25, 2025
24b7efd
skip test
Tobbe Jul 25, 2025
095e939
Main cedar vite plugin: Make options optional
Tobbe Jul 25, 2025
dc08ce0
update fragment fixture
Tobbe Jul 25, 2025
65292ab
trusted documents
Tobbe Jul 25, 2025
dd56ef1
update fragments test project fixture
Tobbe Jul 25, 2025
a91e4c6
add more file extensions to imports
Tobbe Jul 25, 2025
fff1fe2
Update test project fixture
Tobbe Jul 25, 2025
8f1689d
Fix cli-helpers test
Tobbe Jul 25, 2025
8938d46
fix gql import path
Tobbe Jul 25, 2025
e324dab
more file extensions
Tobbe Jul 25, 2025
420a382
Remove unused code
Tobbe Jul 26, 2025
f8c054d
import { gql } from 'graphql-tag'
Tobbe Jul 26, 2025
76adc69
fix tests
Tobbe Jul 26, 2025
9dbf2c5
smoke-tests auth .js imports
Tobbe Jul 26, 2025
cb34f2e
update typegen templates
Tobbe Jul 26, 2025
db4c92e
more template .js ext
Tobbe Jul 26, 2025
02ec72b
types/graphql.js
Tobbe Jul 26, 2025
18abf73
update cli snapshots
Tobbe Jul 26, 2025
e3504f2
fixes while debugging context
Tobbe Jul 26, 2025
bf78f40
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 26, 2025
0b38b0e
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 29, 2025
b2b9aef
api-server: Use ESM bins
Tobbe Jul 29, 2025
a52ab7b
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 29, 2025
2eaa7f8
chore(cli): Refactor dev.test.js – extract common config
Tobbe Jul 30, 2025
18ff587
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 30, 2025
5c6ade7
fix tests
Tobbe Jul 30, 2025
238808f
feat(project-config): Allow for both .js and .mjs dist SSR files
Tobbe Jul 31, 2025
7837cd2
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 31, 2025
3014013
match main
Tobbe Jul 31, 2025
1e601b3
Merge branch 'main' into tobbe-crxa-esm
Tobbe Jul 31, 2025
4d8673a
revert unneeded test project changes
Tobbe Jul 31, 2025
57bbd7c
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
6aa09c3
less code churn compared to main
Tobbe Aug 1, 2025
2e9da8d
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
6c7287f
limit code churn compared to main
Tobbe Aug 1, 2025
7645a1e
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
664ae54
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
cda0931
limit code churn compared to main
Tobbe Aug 1, 2025
9e7cabf
fragment test project: scaffold.css
Tobbe Aug 1, 2025
16acb61
test project: scaffold.css
Tobbe Aug 1, 2025
a979a73
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
e389147
Address Greptile comments
Tobbe Aug 1, 2025
9805950
cjs syntax in tw config
Tobbe Aug 1, 2025
bc27871
addressing greptile regex and eq comments
Tobbe Aug 1, 2025
0b6700a
fixing one more greptile comment
Tobbe Aug 1, 2025
5744b95
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
2b91bfd
reduce code churn
Tobbe Aug 1, 2025
68120df
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
059ac21
Remove commented out code
Tobbe Aug 1, 2025
a862c81
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
eb154e7
fix(codemods): Link to git tag on GitHub for graphql config download
Tobbe Aug 1, 2025
81798cb
update tempate test
Tobbe Aug 1, 2025
8cded72
updated vitest project config in templates and test projects
Tobbe Aug 1, 2025
38b49b3
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
6ddea2b
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 1, 2025
4c30607
Fix a couple more greptile comments
Tobbe Aug 2, 2025
e623cc8
tutorial e2e: .js imports
Tobbe Aug 2, 2025
419792c
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 2, 2025
0894d19
more descriptive comment
Tobbe Aug 2, 2025
66e0ae1
prerender: Add back .js to generated imports
Tobbe Aug 2, 2025
2039a42
node-runner.test.ts
Tobbe Aug 2, 2025
1348b4d
node-runner.test.ts with fixtures dir
Tobbe Aug 2, 2025
562e0c3
Use it() instead of test()
Tobbe Aug 2, 2025
39cfc2a
remove excessive tests
Tobbe Aug 3, 2025
8653508
Allow passing custom config to NodeRunner
Tobbe Aug 3, 2025
7906904
Mock `@cedarjs/context` using vite alias
Tobbe Aug 3, 2025
aa752e0
Also mock `graphql-tag`
Tobbe Aug 3, 2025
e0bfefe
mock graphql-tag
Tobbe Aug 3, 2025
81263f8
cell transform verification wip
Tobbe Aug 3, 2025
22efd01
test cell transform
Tobbe Aug 3, 2025
8451d38
ESM vs CJS test
Tobbe Aug 3, 2025
0268927
Explain why we do the special babel modules import
Tobbe Aug 4, 2025
77c03ae
Simplify import-dir plugin and explain why we're using extensionless …
Tobbe Aug 4, 2025
4080920
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 5, 2025
5672f3e
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 6, 2025
ab52871
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 8, 2025
5fbde2f
add missing dep, improve TD tests
Tobbe Aug 8, 2025
ab648ab
rename node-runner plugin
Tobbe Aug 8, 2025
663240d
Remove files deleted upstream
Tobbe Aug 8, 2025
413715d
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 8, 2025
866bd7b
align with main
Tobbe Aug 8, 2025
bc897c7
align with main more
Tobbe Aug 8, 2025
146f14b
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 8, 2025
5bf37d7
add some spacing around comment
Tobbe Aug 8, 2025
6746bcd
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 8, 2025
694c3c3
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 8, 2025
eaa5a92
revert changes to global.d.ts
Tobbe Aug 8, 2025
1224189
Better types
Tobbe Aug 8, 2025
b5a496d
simplify build files
Tobbe Aug 8, 2025
afec5ad
try fixing TS issues when building
Tobbe Aug 8, 2025
4e7dd0e
remove unused file
Tobbe Aug 8, 2025
0126bab
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 8, 2025
b8d6be5
add back comment from main
Tobbe Aug 8, 2025
e90dc3f
Remove commented code from vite getMergedConfig
Tobbe Aug 8, 2025
433e6b1
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 8, 2025
4d07464
chore(project-config): getEnvVarDefinitions
Tobbe Aug 8, 2025
3ad20a7
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 8, 2025
d296427
Fix bad merge
Tobbe Aug 9, 2025
4c9f9ae
fix db import tracking
Tobbe Aug 9, 2025
b2ae7bc
test db import tracking
Tobbe Aug 9, 2025
0d3573f
fix global type and update test project
Tobbe Aug 9, 2025
dfa1501
fix test to be async
Tobbe Aug 9, 2025
72b038b
put vitest config in the correct location
Tobbe Aug 9, 2025
0d8e0fd
Don't fail CI if config file doesn't exist
Tobbe Aug 9, 2025
2fcb3e7
Better comments around db import tracking tests
Tobbe Aug 9, 2025
b0ff6b5
Force bash in CI for if support
Tobbe Aug 9, 2025
1d2d76c
esm test project fixtures
Tobbe Aug 9, 2025
e26ba65
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 9, 2025
dc64dff
Restore create-cedar-app templates
Tobbe Aug 9, 2025
679515a
remove ignored files
Tobbe Aug 9, 2025
2200c3a
Restore test fixtures
Tobbe Aug 9, 2025
b22be8d
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 9, 2025
0cdea5b
Restore create-cedar-app templates part II
Tobbe Aug 9, 2025
fb5905c
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 9, 2025
e88fa8c
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 9, 2025
4e686a5
chore(create-cedar-app): Test esm template dirs
Tobbe Aug 9, 2025
77481ee
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 9, 2025
7b11576
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 9, 2025
a79e87e
Add back removed function
Tobbe Aug 9, 2025
06ff717
Fix imports
Tobbe Aug 9, 2025
c843e22
revert changes to eslint-config that are no longer needed
Tobbe Aug 9, 2025
b938763
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 9, 2025
24f3157
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 10, 2025
409e9a3
rebuild test project
Tobbe Aug 10, 2025
4836da3
Create ESM project
Tobbe Aug 10, 2025
f680356
ESM test command
Tobbe Aug 10, 2025
e3ea289
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 10, 2025
dedce67
use test test from main
Tobbe Aug 10, 2025
76726e7
remove debug logs
Tobbe Aug 10, 2025
9869707
remove handled TODO
Tobbe Aug 10, 2025
a85b88b
gql import for prerender
Tobbe Aug 10, 2025
03eb428
ccdra Hidden esm flag
Tobbe Aug 10, 2025
1b113cb
Don't create esm apps when you pass --yes
Tobbe Aug 10, 2025
da46786
Add note on how to run create-cedar-app e2e tests locally
Tobbe Aug 10, 2025
0d1bd40
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 10, 2025
fa53f6e
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 10, 2025
93b0e6e
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 10, 2025
2bfdbbb
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 10, 2025
f11b5b0
Add CI job for ESM test project
Tobbe Aug 10, 2025
ff3748d
Fix formatting in esm project action
Tobbe Aug 10, 2025
2e0e975
Revert gql changes in babel-config package
Tobbe Aug 10, 2025
19107a5
chore(ci): Update CI workflow naming
Tobbe Aug 10, 2025
d6821ff
revert more changes to packages/babel-config
Tobbe Aug 10, 2025
f8259ee
revert more changes to packages/babel-config
Tobbe Aug 10, 2025
88e34c3
revert babel related comment in dataMigrate upHandler
Tobbe Aug 10, 2025
30357f8
Remove mockContext export from testing/package.json
Tobbe Aug 10, 2025
925c486
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 10, 2025
a1fe802
Try simplifying helmet import
Tobbe Aug 10, 2025
4a5df75
Try simplifying helmet import in more places
Tobbe Aug 10, 2025
6f2ec87
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 11, 2025
68abbe1
feat(docs): Add note about gql import in ESM apps
Tobbe Aug 11, 2025
046f79d
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 11, 2025
a8ea439
feat(esm): Support ESM in GQL Realtime setup and generation
Tobbe Aug 11, 2025
eef5963
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 11, 2025
6f9a8d6
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 11, 2025
2d78229
Remove unsued templates
Tobbe Aug 11, 2025
3c5a79f
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 11, 2025
0cdd981
Merge branch 'main' into tobbe-crxa-esm
Tobbe Aug 11, 2025
9fa3606
Make ESM apps the default
Tobbe Aug 11, 2025
c51e03f
yarn.lock
Tobbe Aug 11, 2025
7705798
fix bad merge
Tobbe Aug 11, 2025
766753c
ccdra: make esm the default also in prompt
Tobbe Aug 11, 2025
6c64216
Update ccdra e2e tests
Tobbe Aug 11, 2025
bee213b
Handle --esm in more tests
Tobbe Aug 11, 2025
436bb42
Update prompt tests
Tobbe Aug 12, 2025
53be851
--esm support for telemetry ci check
Tobbe Aug 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 13 additions & 13 deletions __fixtures__/fragment-test-project/.redwood/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ You don't need to commit any other contents of this directory to your version co

### Files

| Name | Description |
| :---------------- | :------- |
| commandCache.json | This file contains mappings to assist the Redwood CLI in efficiently executing commands. |
| schema.graphql | This is the GraphQL schema which has been automatically generated from your Redwood project. |
| studio.db | The sqlite database used by the experimental `rw exp studio` feature. |
| Name | Description |
| :---------------- | :----------------------------------------------------------------------------------------------------------------- |
| commandCache.json | This file contains mappings to assist the Redwood CLI in efficiently executing commands. |
| schema.graphql | This is the GraphQL schema which has been automatically generated from your Redwood project. |
| telemetry.txt | Contains a unique ID used for telemetry. This value is rotated every 24 hours to protect your project's anonymity. |
| test.db | The sqlite database used when running tests. |
| test.db | The sqlite database used when running tests. |

### Directories

| Name | Description |
| :---------- | :------- |
| locks | Stores temporary files that Redwood uses to keep track of the execution of async/background tasks between processes. |
| logs | Stores log files for background tasks such as update checking. |
| prebuild | Stores transpiled JavaScript that is generated as part of Redwood's build process. |
| Name | Description |
| :---------- | :----------------------------------------------------------------------------------------------------------------------------------------------- |
| locks | Stores temporary files that Redwood uses to keep track of the execution of async/background tasks between processes. |
| logs | Stores log files for background tasks such as update checking. |
| prebuild | Stores transpiled JavaScript that is generated as part of Redwood's build process. |
| telemetry | Stores the recent telemetry that the Redwood CLI has generated. You may inspect these files to see everything Redwood is anonymously collecting. |
| types | Stores the results of type generation. |
| updateCheck | Stores a file which contains the results of checking for Redwood updates. |
| types | Stores the results of type generation. |
| updateCheck | Stores a file which contains the results of checking for Redwood updates. |
| studio | Used to store data for `rw studio` |

We try to keep this README up to date but you may, from time to time, find other files or directories in this `.redwood` directory that have not yet been documented here. This is likely nothing to worry about but feel free to let us know and we'll update this list.

Expand Down
8 changes: 7 additions & 1 deletion __fixtures__/fragment-test-project/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@
},
"[prisma]": {
"editor.formatOnSave": true
}
},
"tailwindCSS.classAttributes": [
"class",
"className",
"activeClassName",
"errorClassName"
]
}
107 changes: 1 addition & 106 deletions __fixtures__/fragment-test-project/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# README

Welcome to [RedwoodJS](https://redwoodjs.com)!

> **Prerequisites**
>
> - Redwood requires [Node.js](https://nodejs.org/en/) (=20.x) and [Yarn](https://yarnpkg.com/)
> - Are you on Windows? For best results, follow our [Windows development setup](https://redwoodjs.com/docs/how-to/windows-development-setup) guide
Welcome to your new [CedarJS](https://cedarjs.com) project!

Start by installing dependencies:

Expand All @@ -20,103 +15,3 @@ yarn redwood dev
```

Your browser should automatically open to [http://localhost:8910](http://localhost:8910) where you'll see the Welcome Page, which links out to many great resources.

> **The Redwood CLI**
>
> Congratulations on running your first Redwood CLI command! From dev to deploy, the CLI is with you the whole way. And there's quite a few commands at your disposal:
>
> ```
> yarn redwood --help
> ```
>
> For all the details, see the [CLI reference](https://cedarjs.com/docs/cli-commands).

## Prisma and the database

Redwood wouldn't be a full-stack framework without a database. It all starts with the schema. Open the [`schema.prisma`](api/db/schema.prisma) file in `api/db` and replace the `UserExample` model with the following `Post` model:

```prisma
model Post {
id Int @id @default(autoincrement())
title String
body String
createdAt DateTime @default(now())
}
```

Redwood uses [Prisma](https://www.prisma.io/), a next-gen Node.js and TypeScript ORM, to talk to the database. Prisma's schema offers a declarative way of defining your app's data models. And Prisma [Migrate](https://www.prisma.io/migrate) uses that schema to make database migrations hassle-free:

```
yarn rw prisma migrate dev

# ...

? Enter a name for the new migration: › create posts
```

> `rw` is short for `redwood`

You'll be prompted for the name of your migration. `create posts` will do.

Now let's generate everything we need to perform all the CRUD (Create, Retrieve, Update, Delete) actions on our `Post` model:

```
yarn redwood generate scaffold post
```

Navigate to [http://localhost:8910/posts/new](http://localhost:8910/posts/new), fill in the title and body, and click "Save".

Did we just create a post in the database? Yup! With `yarn rw generate scaffold <model>`, Redwood created all the pages, components, and services necessary to perform all CRUD actions on our posts table.

## Frontend first with Storybook

Don't know what your data models look like? That's more than ok—Redwood integrates Storybook so that you can work on design without worrying about data. Mockup, build, and verify your React components, even in complete isolation from the backend:

```
yarn rw storybook
```

Seeing "Couldn't find any stories"? That's because you need a `*.stories.{tsx,jsx}` file. The Redwood CLI makes getting one easy enough—try generating a [Cell](https://redwoodjs.com/docs/cells), Redwood's data-fetching abstraction:

```
yarn rw generate cell examplePosts
```

The Storybook server should hot reload and now you'll have four stories to work with. They'll probably look a little bland since there's no styling. See if the Redwood CLI's `setup ui` command has your favorite styling library:

```
yarn rw setup ui --help
```

## Testing with Jest

It'd be hard to scale from side project to startup without a few tests. Redwood fully integrates Jest with both the front- and back-ends, and makes it easy to keep your whole app covered by generating test files with all your components and services:

```
yarn rw test
```

To make the integration even more seamless, Redwood augments Jest with database [scenarios](https://redwoodjs.com/docs/testing#scenarios) and [GraphQL mocking](https://redwoodjs.com/docs/testing#mocking-graphql-calls).

## Ship it

Redwood is designed for both serverless deploy targets like Netlify and Vercel and serverful deploy targets like Render and AWS:

```
yarn rw setup deploy --help
```

Don't go live without auth! Lock down your app with Redwood's built-in, database-backed authentication system ([dbAuth](https://redwoodjs.com/docs/authentication#self-hosted-auth-installation-and-setup)), or integrate with nearly a dozen third-party auth providers:

```
yarn rw setup auth --help
```

## Next Steps

The best way to learn Redwood is by going through the comprehensive [tutorial](https://redwoodjs.com/docs/tutorial/foreword) and joining the community (via the [Discourse forum](https://community.redwoodjs.com) or the [Discord server](https://discord.gg/redwoodjs)).

## Quick Links

- Stay updated: read [Forum announcements](https://community.redwoodjs.com/c/announcements/5), follow us on [Twitter](https://twitter.com/redwoodjs), and subscribe to the [newsletter](https://redwoodjs.com/newsletter)
- [Learn how to contribute](https://redwoodjs.com/docs/contributing)
8 changes: 0 additions & 8 deletions __fixtures__/fragment-test-project/api/jest.config.js

This file was deleted.

7 changes: 4 additions & 3 deletions __fixtures__/fragment-test-project/api/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "api",
"type": "module",
"version": "0.0.0",
"private": true,
"dependencies": {
"@cedarjs/api": "7.0.0",
"@cedarjs/auth-dbauth-api": "7.0.0",
"@cedarjs/graphql-server": "7.0.0"
"@cedarjs/api": "0.0.5",
"@cedarjs/auth-dbauth-api": "0.0.5",
"@cedarjs/graphql-server": "0.0.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mockRedwoodDirective, getDirectiveName } from '@cedarjs/testing/api'

import requireAuth from './requireAuth'
import requireAuth from './requireAuth.js'

describe('requireAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import gql from 'graphql-tag'
import { gql } from 'graphql-tag'

import type { ValidatorDirectiveFunc } from '@cedarjs/graphql-server'
import { createValidatorDirective } from '@cedarjs/graphql-server'

import { requireAuth as applicationRequireAuth } from 'src/lib/auth'
import { requireAuth as applicationRequireAuth } from 'src/lib/auth.js'

export const schema = gql`
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getDirectiveName } from '@cedarjs/testing/api'

import skipAuth from './skipAuth'
import skipAuth from './skipAuth.js'

describe('skipAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from 'graphql-tag'
import { gql } from 'graphql-tag'

import { createValidatorDirective } from '@cedarjs/graphql-server'

Expand Down
4 changes: 2 additions & 2 deletions __fixtures__/fragment-test-project/api/src/functions/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { APIGatewayProxyEvent, Context } from 'aws-lambda'
import { DbAuthHandler } from '@cedarjs/auth-dbauth-api'
import type { DbAuthHandlerOptions, UserType } from '@cedarjs/auth-dbauth-api'

import { cookieName } from 'src/lib/auth'
import { db } from 'src/lib/db'
import { cookieName } from 'src/lib/auth.js'
import { db } from 'src/lib/db.js'

export const handler = async (
event: APIGatewayProxyEvent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import directives from 'src/directives/**/*.{js,ts}'
import sdls from 'src/graphql/**/*.sdl.{js,ts}'
import services from 'src/services/**/*.{js,ts}'

import { cookieName, getCurrentUser } from 'src/lib/auth'
import { db } from 'src/lib/db'
import { logger } from 'src/lib/logger'
import { cookieName, getCurrentUser } from 'src/lib/auth.js'
import { db } from 'src/lib/db.js'
import { logger } from 'src/lib/logger.js'

const authDecoder = createAuthDecoder(cookieName)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ export const schema = gql`
@skipAuth
deleteProduce(id: String!): Produce! @skipAuth
}
`
`;
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ export const schema = gql`
updateStall(id: String!, input: UpdateStallInput!): Stall! @requireAuth
deleteStall(id: String!): Stall! @requireAuth
}
`
`;
2 changes: 1 addition & 1 deletion __fixtures__/fragment-test-project/api/src/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Decoded } from '@cedarjs/api'
import { AuthenticationError, ForbiddenError } from '@cedarjs/graphql-server'

import { db } from './db'
import { db } from './db.js'

/**
* The name of the cookie that dbAuth sets
Expand Down
17 changes: 11 additions & 6 deletions __fixtures__/fragment-test-project/api/src/lib/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ import { PrismaClient } from '@prisma/client'

import { emitLogLevels, handlePrismaLogging } from '@cedarjs/api/logger'

import { logger } from './logger'
import { logger } from './logger.js'

/*
* Instance of the Prisma Client
*/
export const db = new PrismaClient({
const prismaClient = new PrismaClient({
log: emitLogLevels(['info', 'warn', 'error']),
})

handlePrismaLogging({
db,
db: prismaClient,
logger,
logLevels: ['info', 'warn', 'error'],
})

/**
* Global Prisma client extensions should be added here, as $extend
* returns a new instance.
* export const db = prismaClient.$extend(...)
* Add any .$on hooks before using $extend
*/
export const db = prismaClient
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
createContact,
updateContact,
deleteContact,
} from './contacts'
import type { StandardScenario } from './contacts.scenarios'
} from './contacts.js'
import type { StandardScenario } from './contacts.scenarios.js'

// Generated boilerplate tests do not account for all circumstances
// and can fail without adjustments, e.g. Float.
Expand Down Expand Up @@ -39,7 +39,9 @@ describe('contacts', () => {
})

scenario('updates a contact', async (scenario: StandardScenario) => {
const original = (await contact({ id: scenario.contact.one.id })) as Contact
const original = (await contact({
id: scenario.contact.one.id,
})) as Contact
const result = await updateContact({
id: original.id,
input: { name: 'String2' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { QueryResolvers, MutationResolvers } from 'types/graphql'
import type { QueryResolvers, MutationResolvers } from 'types/graphql.js'

import { db } from 'src/lib/db'
import { db } from 'src/lib/db.js'

export const contacts: QueryResolvers['contacts'] = () => {
return db.contact.findMany()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Prisma, Contact } from '@prisma/client'

import type { ScenarioData } from '@cedarjs/testing/api'

export const standard = defineScenario<Prisma.ContactCreateArgs>({
contact: {
one: { data: { name: 'String', email: 'String', message: 'String' } },
two: { data: { name: 'String', email: 'String', message: 'String' } },
},
})

export type StandardScenario = ScenarioData<Contact, 'contact'>
Loading
Loading