create-cedar-app 0.7.2-next.2 → 0.7.2-next.50
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,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,57 @@
|
|
|
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
|
+
<section>
|
|
52
|
+
<h1>
|
|
53
|
+
<span>Something went wrong</span>
|
|
54
|
+
</h1>
|
|
55
|
+
</section>
|
|
56
|
+
</main>
|
|
57
|
+
))
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
<section>
|
|
39
|
+
<h1>
|
|
40
|
+
<span>404 Page Not Found</span>
|
|
41
|
+
</h1>
|
|
42
|
+
</section>
|
|
43
|
+
</main>
|
|
44
|
+
)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"noEmit": true,
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"target": "ES2022",
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "Bundler",
|
|
9
|
+
"skipLibCheck": false,
|
|
10
|
+
"rootDirs": [
|
|
11
|
+
"./src",
|
|
12
|
+
"../.redwood/types/mirror/web/src",
|
|
13
|
+
"../api/src",
|
|
14
|
+
"../.redwood/types/mirror/api/src"
|
|
15
|
+
],
|
|
16
|
+
"paths": {
|
|
17
|
+
"src/*": [
|
|
18
|
+
"./src/*",
|
|
19
|
+
"../.redwood/types/mirror/web/src/*",
|
|
20
|
+
"../api/src/*",
|
|
21
|
+
"../.redwood/types/mirror/api/src/*"
|
|
22
|
+
],
|
|
23
|
+
"$api/*": ["../api/*"],
|
|
24
|
+
"types/*": ["./types/*", "../types/*"],
|
|
25
|
+
"@cedarjs/testing": ["../node_modules/@cedarjs/testing/web"]
|
|
26
|
+
},
|
|
27
|
+
"typeRoots": [
|
|
28
|
+
"../node_modules/@types",
|
|
29
|
+
"./node_modules/@types",
|
|
30
|
+
"../node_modules/@testing-library"
|
|
31
|
+
],
|
|
32
|
+
"types": ["jest", "jest-dom"],
|
|
33
|
+
"jsx": "preserve"
|
|
34
|
+
},
|
|
35
|
+
"include": [
|
|
36
|
+
"src",
|
|
37
|
+
"config",
|
|
38
|
+
".storybook/**/*",
|
|
39
|
+
"../.redwood/types/includes/all-*",
|
|
40
|
+
"../.redwood/types/includes/web-*",
|
|
41
|
+
"../types",
|
|
42
|
+
"./types"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -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.ts'],
|
|
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
|
+
})
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
]
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@cedarjs/core": "0.7.2-next.
|
|
11
|
-
"@cedarjs/project-config": "0.7.2-next.
|
|
12
|
-
"@cedarjs/testing": "0.7.2-next.
|
|
10
|
+
"@cedarjs/core": "0.7.2-next.50",
|
|
11
|
+
"@cedarjs/project-config": "0.7.2-next.50",
|
|
12
|
+
"@cedarjs/testing": "0.7.2-next.50"
|
|
13
13
|
},
|
|
14
14
|
"eslintConfig": {
|
|
15
15
|
"extends": "@cedarjs/eslint-config",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
]
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@cedarjs/forms": "0.7.2-next.
|
|
15
|
-
"@cedarjs/router": "0.7.2-next.
|
|
16
|
-
"@cedarjs/web": "0.7.2-next.
|
|
14
|
+
"@cedarjs/forms": "0.7.2-next.50",
|
|
15
|
+
"@cedarjs/router": "0.7.2-next.50",
|
|
16
|
+
"@cedarjs/web": "0.7.2-next.50",
|
|
17
17
|
"react": "18.3.1",
|
|
18
18
|
"react-dom": "18.3.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@cedarjs/vite": "0.7.2-next.
|
|
21
|
+
"@cedarjs/vite": "0.7.2-next.50",
|
|
22
22
|
"@types/react": "^18.2.55",
|
|
23
23
|
"@types/react-dom": "^18.2.19"
|
|
24
24
|
}
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
]
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@cedarjs/core": "0.7.2-next.
|
|
11
|
-
"@cedarjs/project-config": "0.7.2-next.
|
|
12
|
-
"@cedarjs/testing": "0.7.2-next.
|
|
10
|
+
"@cedarjs/core": "0.7.2-next.50",
|
|
11
|
+
"@cedarjs/project-config": "0.7.2-next.50",
|
|
12
|
+
"@cedarjs/testing": "0.7.2-next.50"
|
|
13
13
|
},
|
|
14
14
|
"eslintConfig": {
|
|
15
15
|
"extends": "@cedarjs/eslint-config",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
]
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@cedarjs/forms": "0.7.2-next.
|
|
15
|
-
"@cedarjs/router": "0.7.2-next.
|
|
16
|
-
"@cedarjs/web": "0.7.2-next.
|
|
14
|
+
"@cedarjs/forms": "0.7.2-next.50",
|
|
15
|
+
"@cedarjs/router": "0.7.2-next.50",
|
|
16
|
+
"@cedarjs/web": "0.7.2-next.50",
|
|
17
17
|
"react": "18.3.1",
|
|
18
18
|
"react-dom": "18.3.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@cedarjs/vite": "0.7.2-next.
|
|
21
|
+
"@cedarjs/vite": "0.7.2-next.50",
|
|
22
22
|
"@types/react": "^18.2.55",
|
|
23
23
|
"@types/react-dom": "^18.2.19"
|
|
24
24
|
}
|