create-cedar-app 0.7.1 → 0.7.2-next.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/create-cedar-app.js +94 -94
- package/package.json +7 -6
- package/templates/esm-js/.editorconfig +10 -0
- package/templates/esm-js/.env +15 -0
- package/templates/esm-js/.env.defaults +19 -0
- package/templates/esm-js/.env.example +4 -0
- package/templates/esm-js/.redwood/README.md +44 -0
- package/templates/esm-js/.vscode/extensions.json +14 -0
- package/templates/esm-js/.vscode/launch.json +56 -0
- package/templates/esm-js/.vscode/settings.json +11 -0
- package/templates/esm-js/.vscode/tasks.json +29 -0
- package/templates/esm-js/.yarnrc.yml +15 -0
- package/templates/esm-js/README.md +17 -0
- package/templates/esm-js/api/db/schema.prisma +24 -0
- package/templates/esm-js/api/jsconfig.json +41 -0
- package/templates/esm-js/api/package.json +10 -0
- package/templates/esm-js/api/src/directives/requireAuth/requireAuth.js +22 -0
- package/templates/esm-js/api/src/directives/requireAuth/requireAuth.test.js +18 -0
- package/templates/esm-js/api/src/directives/skipAuth/skipAuth.js +16 -0
- package/templates/esm-js/api/src/directives/skipAuth/skipAuth.test.js +10 -0
- package/templates/esm-js/api/src/functions/graphql.js +19 -0
- package/templates/esm-js/api/src/graphql/.keep +0 -0
- package/templates/esm-js/api/src/lib/auth.js +32 -0
- package/templates/esm-js/api/src/lib/db.js +26 -0
- package/templates/esm-js/api/src/lib/logger.js +17 -0
- package/templates/esm-js/api/src/services/.keep +0 -0
- package/templates/esm-js/api/vitest.config.js +10 -0
- package/templates/esm-js/gitignore.template +24 -0
- package/templates/esm-js/graphql.config.cjs +11 -0
- package/templates/esm-js/package.json +32 -0
- package/templates/esm-js/prettier.config.cjs +18 -0
- package/templates/esm-js/redwood.toml +21 -0
- package/templates/esm-js/scripts/.keep +0 -0
- package/templates/esm-js/scripts/jsconfig.json +54 -0
- package/templates/esm-js/scripts/seed.js +27 -0
- package/templates/esm-js/vitest.config.mjs +7 -0
- package/templates/esm-js/web/jsconfig.json +53 -0
- package/templates/esm-js/web/package.json +26 -0
- package/templates/esm-js/web/public/README.md +43 -0
- package/templates/esm-js/web/public/favicon.png +0 -0
- package/templates/esm-js/web/public/robots.txt +2 -0
- package/templates/esm-js/web/src/App.jsx +16 -0
- package/templates/esm-js/web/src/Routes.jsx +20 -0
- package/templates/esm-js/web/src/components/.keep +0 -0
- package/templates/esm-js/web/src/entry.client.jsx +35 -0
- package/templates/esm-js/web/src/index.css +0 -0
- package/templates/esm-js/web/src/index.html +15 -0
- package/templates/esm-js/web/src/layouts/.keep +0 -0
- package/templates/esm-js/web/src/pages/FatalErrorPage/FatalErrorPage.jsx +58 -0
- package/templates/esm-js/web/src/pages/NotFoundPage/NotFoundPage.jsx +45 -0
- package/templates/esm-js/web/vite.config.js +21 -0
- package/templates/esm-js/web/vitest.setup.js +12 -0
- package/templates/esm-ts/.editorconfig +10 -0
- package/templates/esm-ts/.env +15 -0
- package/templates/esm-ts/.env.defaults +19 -0
- package/templates/esm-ts/.env.example +4 -0
- package/templates/esm-ts/.redwood/README.md +44 -0
- package/templates/esm-ts/.vscode/extensions.json +14 -0
- package/templates/esm-ts/.vscode/launch.json +56 -0
- package/templates/esm-ts/.vscode/settings.json +11 -0
- package/templates/esm-ts/.vscode/tasks.json +29 -0
- package/templates/esm-ts/.yarnrc.yml +15 -0
- package/templates/esm-ts/README.md +17 -0
- package/templates/esm-ts/api/db/schema.prisma +24 -0
- package/templates/esm-ts/api/package.json +10 -0
- package/templates/esm-ts/api/src/directives/requireAuth/requireAuth.test.ts +18 -0
- package/templates/esm-ts/api/src/directives/requireAuth/requireAuth.ts +25 -0
- package/templates/esm-ts/api/src/directives/skipAuth/skipAuth.test.ts +10 -0
- package/templates/esm-ts/api/src/directives/skipAuth/skipAuth.ts +16 -0
- package/templates/esm-ts/api/src/functions/graphql.ts +19 -0
- package/templates/esm-ts/api/src/graphql/.keep +0 -0
- package/templates/esm-ts/api/src/lib/auth.ts +32 -0
- package/templates/esm-ts/api/src/lib/db.ts +26 -0
- package/templates/esm-ts/api/src/lib/logger.ts +17 -0
- package/templates/esm-ts/api/src/services/.keep +0 -0
- package/templates/esm-ts/api/tsconfig.json +26 -0
- package/templates/esm-ts/api/vitest.config.ts +10 -0
- package/templates/esm-ts/gitignore.template +24 -0
- package/templates/esm-ts/graphql.config.cjs +11 -0
- package/templates/esm-ts/package.json +32 -0
- package/templates/esm-ts/prettier.config.cjs +18 -0
- package/templates/esm-ts/redwood.toml +21 -0
- package/templates/esm-ts/scripts/.keep +0 -0
- package/templates/esm-ts/scripts/seed.ts +27 -0
- package/templates/esm-ts/scripts/tsconfig.json +29 -0
- package/templates/esm-ts/vitest.config.ts +7 -0
- package/templates/esm-ts/web/package.json +26 -0
- package/templates/esm-ts/web/public/README.md +43 -0
- package/templates/esm-ts/web/public/favicon.png +0 -0
- package/templates/esm-ts/web/public/robots.txt +2 -0
- package/templates/esm-ts/web/src/App.tsx +22 -0
- package/templates/esm-ts/web/src/Routes.tsx +20 -0
- package/templates/esm-ts/web/src/components/.keep +0 -0
- package/templates/esm-ts/web/src/entry.client.tsx +35 -0
- package/templates/esm-ts/web/src/index.css +0 -0
- package/templates/esm-ts/web/src/index.html +15 -0
- package/templates/esm-ts/web/src/layouts/.keep +0 -0
- package/templates/esm-ts/web/src/pages/FatalErrorPage/FatalErrorPage.tsx +57 -0
- package/templates/esm-ts/web/src/pages/NotFoundPage/NotFoundPage.tsx +44 -0
- package/templates/esm-ts/web/tsconfig.json +44 -0
- package/templates/esm-ts/web/vite.config.ts +21 -0
- package/templates/esm-ts/web/vitest.setup.ts +12 -0
- package/templates/js/api/package.json +2 -2
- package/templates/js/package.json +3 -3
- package/templates/js/web/package.json +4 -4
- package/templates/ts/api/package.json +2 -2
- package/templates/ts/package.json +3 -3
- package/templates/ts/web/package.json +4 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# This file contains the configuration settings for your Redwood app.
|
|
2
|
+
# This file is also what makes your Redwood app a Redwood app.
|
|
3
|
+
# If you remove it and try to run `yarn rw dev`, you'll get an error.
|
|
4
|
+
#
|
|
5
|
+
# For the full list of options, see the "App Configuration: redwood.toml" doc:
|
|
6
|
+
# https://redwoodjs.com/docs/app-configuration-redwood-toml
|
|
7
|
+
|
|
8
|
+
[web]
|
|
9
|
+
title = "Cedar App"
|
|
10
|
+
port = 8910
|
|
11
|
+
apiUrl = "/.redwood/functions"
|
|
12
|
+
includeEnvironmentVariables = [
|
|
13
|
+
# Add any ENV vars that should be available to the web side to this array
|
|
14
|
+
# See https://redwoodjs.com/docs/environment-variables#web
|
|
15
|
+
]
|
|
16
|
+
[api]
|
|
17
|
+
port = 8911
|
|
18
|
+
[browser]
|
|
19
|
+
open = true
|
|
20
|
+
[notifications]
|
|
21
|
+
versionUpdates = ["latest"]
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"noEmit": true,
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"target": "ES2023",
|
|
6
|
+
"module": "Node16",
|
|
7
|
+
"moduleResolution": "Node16",
|
|
8
|
+
"paths": {
|
|
9
|
+
"$api/*": [
|
|
10
|
+
"../api/*"
|
|
11
|
+
],
|
|
12
|
+
"api/*": [
|
|
13
|
+
"../api/*"
|
|
14
|
+
],
|
|
15
|
+
"$api/src/*": [
|
|
16
|
+
"../api/src/*",
|
|
17
|
+
"../.redwood/types/mirror/api/src/*"
|
|
18
|
+
],
|
|
19
|
+
"api/src/*": [
|
|
20
|
+
"../api/src/*",
|
|
21
|
+
"../.redwood/types/mirror/api/src/*"
|
|
22
|
+
],
|
|
23
|
+
"$web/*": [
|
|
24
|
+
"../web/*"
|
|
25
|
+
],
|
|
26
|
+
"web/*": [
|
|
27
|
+
"../web/*"
|
|
28
|
+
],
|
|
29
|
+
"$web/src/*": [
|
|
30
|
+
"../web/src/*",
|
|
31
|
+
"../.redwood/types/mirror/web/src/*"
|
|
32
|
+
],
|
|
33
|
+
"web/src/*": [
|
|
34
|
+
"../web/src/*",
|
|
35
|
+
"../.redwood/types/mirror/web/src/*"
|
|
36
|
+
],
|
|
37
|
+
"types/*": [
|
|
38
|
+
"../types/*",
|
|
39
|
+
"../web/types/*",
|
|
40
|
+
"../api/types/*"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"typeRoots": [
|
|
44
|
+
"../node_modules/@types"
|
|
45
|
+
],
|
|
46
|
+
"jsx": "preserve"
|
|
47
|
+
},
|
|
48
|
+
"include": [
|
|
49
|
+
".",
|
|
50
|
+
"../.redwood/types/includes/all-*",
|
|
51
|
+
"../.redwood/types/includes/web-*",
|
|
52
|
+
"../types"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// import { db } from 'api/src/lib/db.js'
|
|
2
|
+
|
|
3
|
+
// Manually apply seeds via the `yarn rw prisma db seed` command.
|
|
4
|
+
//
|
|
5
|
+
// Seeds automatically run the first time you run the `yarn rw prisma migrate dev`
|
|
6
|
+
// command and every time you run the `yarn rw prisma migrate reset` command.
|
|
7
|
+
//
|
|
8
|
+
// See https://redwoodjs.com/docs/database-seeds for more info
|
|
9
|
+
|
|
10
|
+
export default async () => {
|
|
11
|
+
try {
|
|
12
|
+
// Create your database records here! For example, seed some users:
|
|
13
|
+
//
|
|
14
|
+
// const users = [
|
|
15
|
+
// { name: 'Alice', email: 'alice@cedarjs.com' },
|
|
16
|
+
// { name: 'Bob', email: 'bob@cedarjs.com' },
|
|
17
|
+
// ]
|
|
18
|
+
//
|
|
19
|
+
// await db.user.createMany({ data: users })
|
|
20
|
+
|
|
21
|
+
console.info(
|
|
22
|
+
'\n No seed data, skipping. See scripts/seed.js to start seeding your database!\n'
|
|
23
|
+
)
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error(error)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"noEmit": true,
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"target": "ES2022",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "Bundler",
|
|
8
|
+
"skipLibCheck": false,
|
|
9
|
+
"rootDirs": [
|
|
10
|
+
"./src",
|
|
11
|
+
"../.redwood/types/mirror/web/src",
|
|
12
|
+
"../api/src",
|
|
13
|
+
"../.redwood/types/mirror/api/src"
|
|
14
|
+
],
|
|
15
|
+
"paths": {
|
|
16
|
+
"src/*": [
|
|
17
|
+
"./src/*",
|
|
18
|
+
"../.redwood/types/mirror/web/src/*",
|
|
19
|
+
"../api/src/*",
|
|
20
|
+
"../.redwood/types/mirror/api/src/*"
|
|
21
|
+
],
|
|
22
|
+
"$api/*": [
|
|
23
|
+
"../api/*"
|
|
24
|
+
],
|
|
25
|
+
"types/*": [
|
|
26
|
+
"./types/*",
|
|
27
|
+
"../types/*"
|
|
28
|
+
],
|
|
29
|
+
"@cedarjs/testing": [
|
|
30
|
+
"../node_modules/@cedarjs/testing/web"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"typeRoots": [
|
|
34
|
+
"../node_modules/@types",
|
|
35
|
+
"./node_modules/@types",
|
|
36
|
+
"../node_modules/@testing-library"
|
|
37
|
+
],
|
|
38
|
+
"types": [
|
|
39
|
+
"jest",
|
|
40
|
+
"jest-dom"
|
|
41
|
+
],
|
|
42
|
+
"jsx": "preserve"
|
|
43
|
+
},
|
|
44
|
+
"include": [
|
|
45
|
+
"src",
|
|
46
|
+
"config",
|
|
47
|
+
".storybook/**/*",
|
|
48
|
+
"../.redwood/types/includes/all-*",
|
|
49
|
+
"../.redwood/types/includes/web-*",
|
|
50
|
+
"../types",
|
|
51
|
+
"./types"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "web",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"browserslist": {
|
|
7
|
+
"development": [
|
|
8
|
+
"last 1 version"
|
|
9
|
+
],
|
|
10
|
+
"production": [
|
|
11
|
+
"defaults"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@cedarjs/forms": "0.0.5",
|
|
16
|
+
"@cedarjs/router": "0.0.5",
|
|
17
|
+
"@cedarjs/web": "0.0.5",
|
|
18
|
+
"react": "19.0.0-rc-f2df5694-20240916",
|
|
19
|
+
"react-dom": "19.0.0-rc-f2df5694-20240916"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@cedarjs/vite": "0.0.5",
|
|
23
|
+
"@types/react": "^18.2.55",
|
|
24
|
+
"@types/react-dom": "^18.2.19"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Static Assets
|
|
2
|
+
|
|
3
|
+
Use this folder to add static files directly to your app. All included files and folders will be copied directly into the `/dist` folder (created when Vite builds for production). They will also be available during development when you run `yarn rw dev`.
|
|
4
|
+
|
|
5
|
+
> Note: files will _not_ hot reload while the development server is running. You'll need to manually stop/start to access file changes.
|
|
6
|
+
|
|
7
|
+
### Example Use
|
|
8
|
+
|
|
9
|
+
A file like `favicon.png` will be copied to `/dist/favicon.png`. A folder containing a file such as `static-files/my-logo.jpg` will be copied to `/dist/static-files/my-logo.jpg`. These can be referenced in your code directly without any special handling, e.g.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
and
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
<img src="/static-files/my-logo.jpg"> alt="Logo" />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Best Practices
|
|
22
|
+
|
|
23
|
+
Because assets in this folder are bypassing the javascript module system, **this folder should be used sparingly** for assets such as favicons, robots.txt, manifests, libraries incompatible with Vite, etc.
|
|
24
|
+
|
|
25
|
+
In general, it's best to import files directly into a template, page, or component. This allows Vite to include that file in the bundle when small enough, or to copy it over to the `dist` folder with a hash.
|
|
26
|
+
|
|
27
|
+
### Example Asset Import with Vite
|
|
28
|
+
|
|
29
|
+
Instead of handling our logo image as a static file per the example above, we can do the following:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
import React from "react"
|
|
33
|
+
import logo from "./my-logo.jpg"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
function Header() {
|
|
37
|
+
return <img src={logo} alt="Logo" />
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default Header
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
See Vite's docs for [static asset handling](https://vitejs.dev/guide/assets.html)
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FatalErrorBoundary, RedwoodProvider } from '@cedarjs/web'
|
|
2
|
+
import { RedwoodApolloProvider } from '@cedarjs/web/apollo'
|
|
3
|
+
|
|
4
|
+
import FatalErrorPage from 'src/pages/FatalErrorPage'
|
|
5
|
+
|
|
6
|
+
import './index.css'
|
|
7
|
+
|
|
8
|
+
const App = ({ children }) => (
|
|
9
|
+
<FatalErrorBoundary page={FatalErrorPage}>
|
|
10
|
+
<RedwoodProvider titleTemplate="%PageTitle | %AppTitle">
|
|
11
|
+
<RedwoodApolloProvider>{children}</RedwoodApolloProvider>
|
|
12
|
+
</RedwoodProvider>
|
|
13
|
+
</FatalErrorBoundary>
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
export default App
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// In this file, all Page components from 'src/pages` are auto-imported. Nested
|
|
2
|
+
// directories are supported, and should be uppercase. Each subdirectory will be
|
|
3
|
+
// prepended onto the component name.
|
|
4
|
+
//
|
|
5
|
+
// Examples:
|
|
6
|
+
//
|
|
7
|
+
// 'src/pages/HomePage/HomePage.js' -> HomePage
|
|
8
|
+
// 'src/pages/Admin/BooksPage/BooksPage.js' -> AdminBooksPage
|
|
9
|
+
|
|
10
|
+
import { Router, Route } from '@cedarjs/router'
|
|
11
|
+
|
|
12
|
+
const Routes = () => {
|
|
13
|
+
return (
|
|
14
|
+
<Router>
|
|
15
|
+
<Route notfound page={NotFoundPage} />
|
|
16
|
+
</Router>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default Routes
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { hydrateRoot, createRoot } from 'react-dom/client'
|
|
2
|
+
|
|
3
|
+
import App from './App'
|
|
4
|
+
import Routes from './Routes'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* When `#redwood-app` isn't empty then it's very likely that you're using
|
|
8
|
+
* prerendering. So React attaches event listeners to the existing markup
|
|
9
|
+
* rather than replacing it.
|
|
10
|
+
* https://react.dev/reference/react-dom/client/hydrateRoot
|
|
11
|
+
*/
|
|
12
|
+
const redwoodAppElement = document.getElementById('redwood-app')
|
|
13
|
+
|
|
14
|
+
if (!redwoodAppElement) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
"Could not find an element with ID 'redwood-app'. Please ensure it " +
|
|
17
|
+
"exists in your 'web/src/index.html' file."
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (redwoodAppElement.children?.length > 0) {
|
|
22
|
+
hydrateRoot(
|
|
23
|
+
redwoodAppElement,
|
|
24
|
+
<App>
|
|
25
|
+
<Routes />
|
|
26
|
+
</App>
|
|
27
|
+
)
|
|
28
|
+
} else {
|
|
29
|
+
const root = createRoot(redwoodAppElement)
|
|
30
|
+
root.render(
|
|
31
|
+
<App>
|
|
32
|
+
<Routes />
|
|
33
|
+
</App>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<!-- Please keep this div empty -->
|
|
12
|
+
<div id="redwood-app"></div>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</html>
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// This page will be rendered when an error makes it all the way to the top of the
|
|
2
|
+
// application without being handled by a Javascript catch statement or React error
|
|
3
|
+
// boundary.
|
|
4
|
+
//
|
|
5
|
+
// You can modify this page as you wish, but it is important to keep things simple to
|
|
6
|
+
// avoid the possibility that it will cause its own error. If it does, Redwood will
|
|
7
|
+
// still render a generic error page, but your users will prefer something a bit more
|
|
8
|
+
// thoughtful :)
|
|
9
|
+
|
|
10
|
+
// This import will be automatically removed when building for production
|
|
11
|
+
import { DevFatalErrorPage } from '@cedarjs/web/dist/components/DevFatalErrorPage'
|
|
12
|
+
|
|
13
|
+
export default DevFatalErrorPage ||
|
|
14
|
+
(() => (
|
|
15
|
+
<main>
|
|
16
|
+
<style
|
|
17
|
+
dangerouslySetInnerHTML={{
|
|
18
|
+
__html: `
|
|
19
|
+
html, body {
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
html * {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
}
|
|
25
|
+
main {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
|
29
|
+
text-align: center;
|
|
30
|
+
background-color: #E2E8F0;
|
|
31
|
+
height: 100vh;
|
|
32
|
+
}
|
|
33
|
+
section {
|
|
34
|
+
background-color: white;
|
|
35
|
+
border-radius: 0.25rem;
|
|
36
|
+
width: 32rem;
|
|
37
|
+
padding: 1rem;
|
|
38
|
+
margin: 0 auto;
|
|
39
|
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
40
|
+
}
|
|
41
|
+
h1 {
|
|
42
|
+
font-size: 2rem;
|
|
43
|
+
margin: 0;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
line-height: 1;
|
|
46
|
+
color: #2D3748;
|
|
47
|
+
}
|
|
48
|
+
`,
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
<section>
|
|
53
|
+
<h1>
|
|
54
|
+
<span>Something went wrong</span>
|
|
55
|
+
</h1>
|
|
56
|
+
</section>
|
|
57
|
+
</main>
|
|
58
|
+
))
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default () => (
|
|
2
|
+
<main>
|
|
3
|
+
<style
|
|
4
|
+
dangerouslySetInnerHTML={{
|
|
5
|
+
__html: `
|
|
6
|
+
html, body {
|
|
7
|
+
margin: 0;
|
|
8
|
+
}
|
|
9
|
+
html * {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
}
|
|
12
|
+
main {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
|
16
|
+
text-align: center;
|
|
17
|
+
background-color: #E2E8F0;
|
|
18
|
+
height: 100vh;
|
|
19
|
+
}
|
|
20
|
+
section {
|
|
21
|
+
background-color: white;
|
|
22
|
+
border-radius: 0.25rem;
|
|
23
|
+
width: 32rem;
|
|
24
|
+
padding: 1rem;
|
|
25
|
+
margin: 0 auto;
|
|
26
|
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
27
|
+
}
|
|
28
|
+
h1 {
|
|
29
|
+
font-size: 2rem;
|
|
30
|
+
margin: 0;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
line-height: 1;
|
|
33
|
+
color: #2D3748;
|
|
34
|
+
}
|
|
35
|
+
`,
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
<section>
|
|
40
|
+
<h1>
|
|
41
|
+
<span>404 Page Not Found</span>
|
|
42
|
+
</h1>
|
|
43
|
+
</section>
|
|
44
|
+
</main>
|
|
45
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="vitest/config" />
|
|
2
|
+
|
|
3
|
+
import dns from 'node:dns'
|
|
4
|
+
|
|
5
|
+
import { defineConfig } from 'vite'
|
|
6
|
+
|
|
7
|
+
import { cedar } from '@cedarjs/vite'
|
|
8
|
+
|
|
9
|
+
// So that Vite will load on localhost instead of `127.0.0.1`.
|
|
10
|
+
// See: https://vitejs.dev/config/server-options.html#server-host.
|
|
11
|
+
dns.setDefaultResultOrder('verbatim')
|
|
12
|
+
|
|
13
|
+
export default defineConfig(({ mode }) => ({
|
|
14
|
+
plugins: [cedar({ mode })],
|
|
15
|
+
test: {
|
|
16
|
+
environment: 'jsdom',
|
|
17
|
+
setupFiles: ['./vitest.setup.js'],
|
|
18
|
+
// Enables global test APIs like describe, it, expect
|
|
19
|
+
globals: true,
|
|
20
|
+
},
|
|
21
|
+
}))
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest'
|
|
2
|
+
|
|
3
|
+
import { cleanup } from '@testing-library/react'
|
|
4
|
+
import { afterEach } from 'vitest'
|
|
5
|
+
|
|
6
|
+
afterEach(() => {
|
|
7
|
+
// If vitest globals are enabled testing-library will clean up after each
|
|
8
|
+
// test automatically, but we don't enable globals, so we have to manually
|
|
9
|
+
// clean up here
|
|
10
|
+
// https://testing-library.com/docs/react-testing-library/api/#cleanup
|
|
11
|
+
cleanup()
|
|
12
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# THIS FILE SHOULD NOT BE CHECKED INTO YOUR VERSION CONTROL SYSTEM
|
|
2
|
+
#
|
|
3
|
+
# Environment variables set here will override those in .env.defaults.
|
|
4
|
+
# Any environment variables you need in production you will need to setup with
|
|
5
|
+
# your hosting provider. For example in Netlify you can add environment
|
|
6
|
+
# variables in Settings > Build & Deploy > environment
|
|
7
|
+
#
|
|
8
|
+
# DATABASE_URL=postgres://user:pass@postgreshost.com:5432/database_name
|
|
9
|
+
# TEST_DATABASE_URL=postgres://user:pass@postgreshost.com:5432/test_database_name
|
|
10
|
+
#
|
|
11
|
+
# Sets an app-specific secret used to sign and verify your own app's webhooks.
|
|
12
|
+
# For example if you schedule a cron job with a signed payload that later will
|
|
13
|
+
# then invoke your api-side webhook function you will use this secret to sign and the verify.
|
|
14
|
+
# Important: Please change this default to a strong password or other secret
|
|
15
|
+
# WEBHOOK_SECRET=THIS_IS_NOT_SECRET_PLEASE_CHANGE
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# These environment variables will be used by default if you do not create any
|
|
2
|
+
# yourself in .env. This file should be safe to check into your version control
|
|
3
|
+
# system. Any custom values should go in .env and .env should *not* be checked
|
|
4
|
+
# into version control.
|
|
5
|
+
|
|
6
|
+
# schema.prisma defaults
|
|
7
|
+
DATABASE_URL=file:./dev.db
|
|
8
|
+
|
|
9
|
+
# location of the test database for api service scenarios (defaults to ./.redwood/test.db if not set)
|
|
10
|
+
# TEST_DATABASE_URL=file:./.redwood/test.db
|
|
11
|
+
|
|
12
|
+
# disables Prisma CLI update notifier
|
|
13
|
+
PRISMA_HIDE_UPDATE_MESSAGE=true
|
|
14
|
+
|
|
15
|
+
# Option to override the current environment's default api-side log level
|
|
16
|
+
# See: https://redwoodjs.com/docs/logger for level options, defaults to "trace" otherwise.
|
|
17
|
+
# Most applications want "debug" or "info" during dev, "trace" when you have issues and "warn" in production.
|
|
18
|
+
# Ordered by how verbose they are: trace | debug | info | warn | error | silent
|
|
19
|
+
# LOG_LEVEL=debug
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# .redwood
|
|
2
|
+
|
|
3
|
+
## What is this directory?
|
|
4
|
+
|
|
5
|
+
Redwood uses this `.redwood` directory to store transitory data that aids in the smooth and convenient operation of your Redwood project.
|
|
6
|
+
|
|
7
|
+
## Do I need to do anything with this directory?
|
|
8
|
+
|
|
9
|
+
No. You shouldn't have to create, edit or delete anything in this directory in your day-to-day work with Redwood.
|
|
10
|
+
|
|
11
|
+
You don't need to commit any other contents of this directory to your version control system. It's ignored by default.
|
|
12
|
+
|
|
13
|
+
## What's in this directory?
|
|
14
|
+
|
|
15
|
+
### Files
|
|
16
|
+
|
|
17
|
+
| Name | Description |
|
|
18
|
+
| :---------------- | :----------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| commandCache.json | This file contains mappings to assist the Redwood CLI in efficiently executing commands. |
|
|
20
|
+
| schema.graphql | This is the GraphQL schema which has been automatically generated from your Redwood project. |
|
|
21
|
+
| telemetry.txt | Contains a unique ID used for telemetry. This value is rotated every 24 hours to protect your project's anonymity. |
|
|
22
|
+
| test.db | The sqlite database used when running tests. |
|
|
23
|
+
|
|
24
|
+
### Directories
|
|
25
|
+
|
|
26
|
+
| Name | Description |
|
|
27
|
+
| :---------- | :----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| locks | Stores temporary files that Redwood uses to keep track of the execution of async/background tasks between processes. |
|
|
29
|
+
| logs | Stores log files for background tasks such as update checking. |
|
|
30
|
+
| prebuild | Stores transpiled JavaScript that is generated as part of Redwood's build process. |
|
|
31
|
+
| telemetry | Stores the recent telemetry that the Redwood CLI has generated. You may inspect these files to see everything Redwood is anonymously collecting. |
|
|
32
|
+
| types | Stores the results of type generation. |
|
|
33
|
+
| updateCheck | Stores a file which contains the results of checking for Redwood updates. |
|
|
34
|
+
| studio | Used to store data for `rw studio` |
|
|
35
|
+
|
|
36
|
+
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.
|
|
37
|
+
|
|
38
|
+
### Telemetry
|
|
39
|
+
|
|
40
|
+
RedwoodJS collects completely anonymous telemetry data about general usage. For transparency, that data is viewable in the respective directories and files. To learn more and manage your project's settings, visit [telemetry.redwoodjs.com](https://telemetry.redwoodjs.com).
|
|
41
|
+
|
|
42
|
+
### Have any questions?
|
|
43
|
+
|
|
44
|
+
Feel free to reach out to us in the [RedwoodJS Community](https://community.redwoodjs.com/) forum if you have any questions.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"recommendations": [
|
|
3
|
+
"dbaeumer.vscode-eslint",
|
|
4
|
+
"eamodio.gitlens",
|
|
5
|
+
"ofhumanbondage.react-proptypes-intellisense",
|
|
6
|
+
"mgmcdermott.vscode-language-babel",
|
|
7
|
+
"wix.vscode-import-cost",
|
|
8
|
+
"pflannery.vscode-versionlens",
|
|
9
|
+
"editorconfig.editorconfig",
|
|
10
|
+
"prisma.prisma",
|
|
11
|
+
"graphql.vscode-graphql"
|
|
12
|
+
],
|
|
13
|
+
"unwantedRecommendations": []
|
|
14
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.3.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"command": "yarn redwood dev --apiDebugPort 18911", // you can add --fwd='--open=false' to prevent the browser from opening
|
|
6
|
+
"name": "Run Dev Server",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"type": "node-terminal"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "Attach API debugger",
|
|
12
|
+
"port": 18911, // you can change this port, see https://redwoodjs.com/docs/project-configuration-dev-test-build#debugger-configuration
|
|
13
|
+
"request": "attach",
|
|
14
|
+
"skipFiles": [
|
|
15
|
+
"<node_internals>/**"
|
|
16
|
+
],
|
|
17
|
+
"type": "node",
|
|
18
|
+
"localRoot": "${workspaceFolder}/node_modules/@cedarjs/api-server/dist",
|
|
19
|
+
"remoteRoot": "${workspaceFolder}/node_modules/@cedarjs/api-server/dist",
|
|
20
|
+
"sourceMaps": true,
|
|
21
|
+
"restart": true,
|
|
22
|
+
"preLaunchTask": "WaitForDevServer",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "Launch Web debugger",
|
|
26
|
+
"type": "chrome",
|
|
27
|
+
"request": "launch",
|
|
28
|
+
"url": "http://localhost:8910",
|
|
29
|
+
"webRoot": "${workspaceRoot}/web/src",
|
|
30
|
+
"preLaunchTask": "WaitForDevServer",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"command": "yarn redwood test api",
|
|
34
|
+
"name": "Test api",
|
|
35
|
+
"request": "launch",
|
|
36
|
+
"type": "node-terminal"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"command": "yarn redwood test web",
|
|
40
|
+
"name": "Test web",
|
|
41
|
+
"request": "launch",
|
|
42
|
+
"type": "node-terminal"
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
"compounds": [
|
|
46
|
+
{
|
|
47
|
+
"name": "Start Debug",
|
|
48
|
+
"configurations": [
|
|
49
|
+
"Run Dev Server",
|
|
50
|
+
"Attach API debugger",
|
|
51
|
+
"Launch Web debugger"
|
|
52
|
+
],
|
|
53
|
+
"stopAll": true
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|