create-cedar-app 7.0.0 → 7.0.1-next.307

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.
Files changed (154) hide show
  1. package/database-overlays/neon-postgres/api/package.json +3 -3
  2. package/database-overlays/pglite/api/package.json +3 -3
  3. package/dist/create-cedar-app.js +366 -368
  4. package/package.json +5 -7
  5. package/templates/js/api/jsconfig.json +2 -2
  6. package/templates/js/api/package.json +12 -6
  7. package/templates/js/api/src/directives/requireAuth/requireAuth.js +1 -1
  8. package/templates/js/api/src/directives/skipAuth/skipAuth.js +1 -1
  9. package/templates/js/api/src/lib/auth.js +2 -2
  10. package/templates/js/api/src/lib/db.js +3 -1
  11. package/templates/js/package.json +12 -7
  12. package/templates/js/scripts/jsconfig.json +1 -2
  13. package/templates/js/web/jsconfig.json +1 -2
  14. package/templates/js/web/package.json +13 -9
  15. package/templates/js/web/src/pages/FatalErrorPage/FatalErrorPage.jsx +0 -1
  16. package/templates/js/web/src/pages/NotFoundPage/NotFoundPage.jsx +0 -1
  17. package/templates/js/web/vite.config.js +11 -3
  18. package/templates/overlays/{esm/npm → npm}/package.json +8 -8
  19. package/templates/overlays/{esm/pnpm → pnpm}/package.json +7 -7
  20. package/templates/overlays/{esm/pnpm → pnpm}/pnpm-workspace.yaml +1 -1
  21. package/templates/overlays/{esm/yarn → yarn}/package.json +8 -8
  22. package/templates/ts/api/package.json +12 -6
  23. package/templates/ts/api/src/directives/requireAuth/requireAuth.ts +1 -1
  24. package/templates/ts/api/src/directives/skipAuth/skipAuth.ts +1 -1
  25. package/templates/ts/api/src/lib/auth.ts +2 -2
  26. package/templates/ts/api/src/lib/db.ts +3 -1
  27. package/templates/ts/api/tsconfig.json +1 -0
  28. package/templates/ts/eslint.config.js +11 -0
  29. package/templates/ts/package.json +12 -7
  30. package/templates/ts/scripts/tsconfig.json +0 -1
  31. package/templates/ts/web/package.json +13 -9
  32. package/templates/ts/web/vite.config.ts +11 -3
  33. package/templates/esm-js/.cedar/README.md +0 -44
  34. package/templates/esm-js/.editorconfig +0 -10
  35. package/templates/esm-js/.env +0 -15
  36. package/templates/esm-js/.env.defaults +0 -19
  37. package/templates/esm-js/.env.example +0 -4
  38. package/templates/esm-js/.vscode/extensions.json +0 -14
  39. package/templates/esm-js/.vscode/launch.json +0 -56
  40. package/templates/esm-js/.vscode/settings.json +0 -11
  41. package/templates/esm-js/.vscode/tasks.json +0 -29
  42. package/templates/esm-js/README.md +0 -17
  43. package/templates/esm-js/api/db/schema.prisma +0 -29
  44. package/templates/esm-js/api/jsconfig.json +0 -41
  45. package/templates/esm-js/api/package.json +0 -19
  46. package/templates/esm-js/api/prisma.config.cjs +0 -12
  47. package/templates/esm-js/api/src/directives/requireAuth/requireAuth.js +0 -22
  48. package/templates/esm-js/api/src/directives/requireAuth/requireAuth.test.js +0 -18
  49. package/templates/esm-js/api/src/directives/skipAuth/skipAuth.js +0 -16
  50. package/templates/esm-js/api/src/directives/skipAuth/skipAuth.test.js +0 -10
  51. package/templates/esm-js/api/src/functions/graphql.js +0 -19
  52. package/templates/esm-js/api/src/graphql/.keep +0 -0
  53. package/templates/esm-js/api/src/lib/auth.js +0 -32
  54. package/templates/esm-js/api/src/lib/db.js +0 -46
  55. package/templates/esm-js/api/src/lib/logger.js +0 -17
  56. package/templates/esm-js/api/src/services/.keep +0 -0
  57. package/templates/esm-js/cedar.toml +0 -26
  58. package/templates/esm-js/gitignore.template +0 -27
  59. package/templates/esm-js/graphql.config.cjs +0 -11
  60. package/templates/esm-js/package.json +0 -33
  61. package/templates/esm-js/prettier.config.cjs +0 -18
  62. package/templates/esm-js/scripts/.keep +0 -0
  63. package/templates/esm-js/scripts/jsconfig.json +0 -60
  64. package/templates/esm-js/scripts/seed.js +0 -27
  65. package/templates/esm-js/web/index.html +0 -15
  66. package/templates/esm-js/web/jsconfig.json +0 -53
  67. package/templates/esm-js/web/package.json +0 -30
  68. package/templates/esm-js/web/public/README.md +0 -43
  69. package/templates/esm-js/web/public/favicon.png +0 -0
  70. package/templates/esm-js/web/public/robots.txt +0 -2
  71. package/templates/esm-js/web/src/App.jsx +0 -16
  72. package/templates/esm-js/web/src/Routes.jsx +0 -20
  73. package/templates/esm-js/web/src/components/.keep +0 -0
  74. package/templates/esm-js/web/src/entry.client.jsx +0 -35
  75. package/templates/esm-js/web/src/index.css +0 -0
  76. package/templates/esm-js/web/src/layouts/.keep +0 -0
  77. package/templates/esm-js/web/src/pages/FatalErrorPage/FatalErrorPage.jsx +0 -58
  78. package/templates/esm-js/web/src/pages/NotFoundPage/NotFoundPage.jsx +0 -45
  79. package/templates/esm-js/web/vite.config.js +0 -15
  80. package/templates/esm-ts/.cedar/README.md +0 -44
  81. package/templates/esm-ts/.editorconfig +0 -10
  82. package/templates/esm-ts/.env +0 -15
  83. package/templates/esm-ts/.env.defaults +0 -19
  84. package/templates/esm-ts/.env.example +0 -4
  85. package/templates/esm-ts/.vscode/extensions.json +0 -14
  86. package/templates/esm-ts/.vscode/launch.json +0 -56
  87. package/templates/esm-ts/.vscode/settings.json +0 -11
  88. package/templates/esm-ts/.vscode/tasks.json +0 -29
  89. package/templates/esm-ts/README.md +0 -17
  90. package/templates/esm-ts/api/db/schema.prisma +0 -29
  91. package/templates/esm-ts/api/package.json +0 -19
  92. package/templates/esm-ts/api/prisma.config.cjs +0 -12
  93. package/templates/esm-ts/api/src/directives/requireAuth/requireAuth.test.ts +0 -18
  94. package/templates/esm-ts/api/src/directives/requireAuth/requireAuth.ts +0 -25
  95. package/templates/esm-ts/api/src/directives/skipAuth/skipAuth.test.ts +0 -10
  96. package/templates/esm-ts/api/src/directives/skipAuth/skipAuth.ts +0 -16
  97. package/templates/esm-ts/api/src/functions/graphql.ts +0 -19
  98. package/templates/esm-ts/api/src/graphql/.keep +0 -0
  99. package/templates/esm-ts/api/src/lib/auth.ts +0 -32
  100. package/templates/esm-ts/api/src/lib/db.ts +0 -46
  101. package/templates/esm-ts/api/src/lib/logger.ts +0 -17
  102. package/templates/esm-ts/api/src/services/.keep +0 -0
  103. package/templates/esm-ts/api/tsconfig.json +0 -27
  104. package/templates/esm-ts/cedar.toml +0 -26
  105. package/templates/esm-ts/eslint.config.js +0 -3
  106. package/templates/esm-ts/gitignore.template +0 -27
  107. package/templates/esm-ts/graphql.config.cjs +0 -11
  108. package/templates/esm-ts/package.json +0 -33
  109. package/templates/esm-ts/prettier.config.cjs +0 -18
  110. package/templates/esm-ts/scripts/.keep +0 -0
  111. package/templates/esm-ts/scripts/seed.ts +0 -27
  112. package/templates/esm-ts/scripts/tsconfig.json +0 -35
  113. package/templates/esm-ts/web/index.html +0 -15
  114. package/templates/esm-ts/web/package.json +0 -30
  115. package/templates/esm-ts/web/public/README.md +0 -43
  116. package/templates/esm-ts/web/public/favicon.png +0 -0
  117. package/templates/esm-ts/web/public/robots.txt +0 -2
  118. package/templates/esm-ts/web/src/App.tsx +0 -22
  119. package/templates/esm-ts/web/src/Routes.tsx +0 -20
  120. package/templates/esm-ts/web/src/components/.keep +0 -0
  121. package/templates/esm-ts/web/src/entry.client.tsx +0 -35
  122. package/templates/esm-ts/web/src/index.css +0 -0
  123. package/templates/esm-ts/web/src/layouts/.keep +0 -0
  124. package/templates/esm-ts/web/src/pages/FatalErrorPage/FatalErrorPage.tsx +0 -57
  125. package/templates/esm-ts/web/src/pages/NotFoundPage/NotFoundPage.tsx +0 -44
  126. package/templates/esm-ts/web/tsconfig.json +0 -45
  127. package/templates/esm-ts/web/vite.config.ts +0 -15
  128. package/templates/js/api/jest.config.js +0 -8
  129. package/templates/js/eslint.config.mjs +0 -3
  130. package/templates/js/jest.config.js +0 -8
  131. package/templates/js/web/jest.config.js +0 -8
  132. package/templates/overlays/cjs/npm/package-lock.json +0 -28868
  133. package/templates/overlays/cjs/npm/package.json +0 -31
  134. package/templates/overlays/cjs/pnpm/package.json +0 -32
  135. package/templates/overlays/cjs/pnpm/pnpm-lock.yaml +0 -18204
  136. package/templates/overlays/cjs/pnpm/pnpm-workspace.yaml +0 -23
  137. package/templates/overlays/cjs/yarn/package.json +0 -73
  138. package/templates/overlays/cjs/yarn/yarn.lock +0 -18896
  139. package/templates/overlays/esm/npm/package-lock.json +0 -29256
  140. package/templates/overlays/esm/pnpm/pnpm-lock.yaml +0 -18683
  141. package/templates/overlays/esm/yarn/.yarnrc.yml +0 -17
  142. package/templates/overlays/esm/yarn/yarn.lock +0 -19181
  143. package/templates/ts/api/jest.config.js +0 -8
  144. package/templates/ts/eslint.config.mjs +0 -3
  145. package/templates/ts/jest.config.js +0 -8
  146. package/templates/ts/web/jest.config.js +0 -8
  147. /package/templates/{esm-js → js}/api/vitest.config.js +0 -0
  148. /package/templates/{esm-js → js}/eslint.config.js +0 -0
  149. /package/templates/{esm-js → js}/vitest.config.mjs +0 -0
  150. /package/templates/{esm-js → js}/web/vitest.setup.js +0 -0
  151. /package/templates/overlays/{cjs/yarn → yarn}/.yarnrc.yml +0 -0
  152. /package/templates/{esm-ts → ts}/api/vitest.config.ts +0 -0
  153. /package/templates/{esm-ts → ts}/vitest.config.ts +0 -0
  154. /package/templates/{esm-ts → ts}/web/vitest.setup.ts +0 -0
@@ -1,25 +0,0 @@
1
- import { gql } from 'graphql-tag'
2
-
3
- import type { ValidatorDirectiveFunc } from '@cedarjs/graphql-server'
4
- import { createValidatorDirective } from '@cedarjs/graphql-server'
5
-
6
- import { requireAuth as applicationRequireAuth } from 'src/lib/auth'
7
-
8
- export const schema = gql`
9
- """
10
- Use to check whether or not a user is authenticated and is associated
11
- with an optional set of roles.
12
- """
13
- directive @requireAuth(roles: [String]) on FIELD_DEFINITION
14
- `
15
-
16
- type RequireAuthValidate = ValidatorDirectiveFunc<{ roles?: string[] }>
17
-
18
- const validate: RequireAuthValidate = ({ directiveArgs }) => {
19
- const { roles } = directiveArgs
20
- applicationRequireAuth({ roles })
21
- }
22
-
23
- const requireAuth = createValidatorDirective(schema, validate)
24
-
25
- export default requireAuth
@@ -1,10 +0,0 @@
1
- import { getDirectiveName } from '@cedarjs/testing/api'
2
-
3
- import skipAuth from './skipAuth.js'
4
-
5
- describe('skipAuth directive', () => {
6
- it('declares the directive sdl as schema, with the correct name', () => {
7
- expect(skipAuth.schema).toBeTruthy()
8
- expect(getDirectiveName(skipAuth.schema)).toBe('skipAuth')
9
- })
10
- })
@@ -1,16 +0,0 @@
1
- import { gql } from 'graphql-tag'
2
-
3
- import { createValidatorDirective } from '@cedarjs/graphql-server'
4
-
5
- export const schema = gql`
6
- """
7
- Use to skip authentication checks and allow public access.
8
- """
9
- directive @skipAuth on FIELD_DEFINITION
10
- `
11
-
12
- const skipAuth = createValidatorDirective(schema, () => {
13
- return
14
- })
15
-
16
- export default skipAuth
@@ -1,19 +0,0 @@
1
- import { createGraphQLHandler } from '@cedarjs/graphql-server'
2
-
3
- import directives from 'src/directives/**/*.{js,ts}'
4
- import sdls from 'src/graphql/**/*.sdl.{js,ts}'
5
- import services from 'src/services/**/*.{js,ts}'
6
-
7
- import { db } from 'src/lib/db'
8
- import { logger } from 'src/lib/logger'
9
-
10
- export const handler = createGraphQLHandler({
11
- loggerConfig: { logger, options: {} },
12
- directives,
13
- sdls,
14
- services,
15
- onException: () => {
16
- // Disconnect from your database with an unhandled exception.
17
- db.$disconnect()
18
- },
19
- })
File without changes
@@ -1,32 +0,0 @@
1
- /**
2
- * Once you are ready to add authentication to your application
3
- * you'll build out requireAuth() with real functionality. For
4
- * now we just return `true` so that the calls in services
5
- * have something to check against, simulating a logged
6
- * in user that is allowed to access that service.
7
- *
8
- * See https://cedarjs.com/docs/authentication for more info.
9
- */
10
- export const isAuthenticated = () => {
11
- return true
12
- }
13
-
14
- export const hasRole = ({ roles }) => {
15
- return roles !== undefined
16
- }
17
-
18
- // This is used by the cedar directive
19
- // in ./api/src/directives/requireAuth
20
-
21
- // Roles are passed in by the requireAuth directive if you have auth setup
22
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
- export const requireAuth = ({ roles }) => {
24
- return isAuthenticated()
25
- }
26
-
27
- export const getCurrentUser = async () => {
28
- throw new Error(
29
- 'Auth is not set up yet. See https://cedarjs.com/docs/authentication to ' +
30
- 'get started'
31
- )
32
- }
@@ -1,46 +0,0 @@
1
- // See https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/constructor
2
- // for options.
3
-
4
- import path from 'node:path'
5
-
6
- import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'
7
- import { PrismaClient } from 'api/db/generated/prisma/client.mts'
8
-
9
- import { emitLogLevels, handlePrismaLogging } from '@cedarjs/api/logger'
10
- import { getPaths } from '@cedarjs/project-config'
11
-
12
- import { logger } from './logger.js'
13
-
14
- export * from 'api/db/generated/prisma/client.mts'
15
-
16
- const resolveSqliteUrl = (url = 'file:./db/dev.db') => {
17
- if (!url.startsWith('file:.')) {
18
- return url
19
- }
20
-
21
- const apiDir = getPaths().api.base
22
-
23
- return `file:${path.resolve(apiDir, url.slice('file:'.length))}`
24
- }
25
-
26
- const adapter = new PrismaBetterSqlite3({
27
- url: resolveSqliteUrl(process.env.DATABASE_URL),
28
- })
29
- const prismaClient = new PrismaClient({
30
- log: emitLogLevels(['info', 'warn', 'error']),
31
- adapter,
32
- })
33
-
34
- handlePrismaLogging({
35
- db: prismaClient,
36
- logger,
37
- logLevels: ['info', 'warn', 'error'],
38
- })
39
-
40
- /**
41
- * Global Prisma client extensions should be added here, as $extend
42
- * returns a new instance.
43
- * export const db = prismaClient.$extend(...)
44
- * Add any .$on hooks before using $extend
45
- */
46
- export const db = prismaClient
@@ -1,17 +0,0 @@
1
- import { createLogger } from '@cedarjs/api/logger'
2
-
3
- /**
4
- * Creates a logger with CedarLoggerOptions
5
- *
6
- * These extend and override default LoggerOptions,
7
- * can define a destination like a file or other supported pino log transport stream,
8
- * and sets whether or not to show the logger configuration settings (defaults to false)
9
- *
10
- * @param CedarLoggerOptions
11
- *
12
- * CedarLoggerOptions have
13
- * @param {options} LoggerOptions - defines how to log, such as redaction and format
14
- * @param {string | DestinationStream} destination - defines where to log, such as a transport stream or file
15
- * @param {boolean} showConfig - whether to display logger configuration on initialization
16
- */
17
- export const logger = createLogger({})
File without changes
@@ -1,27 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "noEmit": true,
4
- "allowJs": true,
5
- "esModuleInterop": true,
6
- "target": "es2023",
7
- "module": "ESNext",
8
- "moduleResolution": "Bundler",
9
- "allowImportingTsExtensions": true,
10
- "skipLibCheck": false,
11
- "rootDirs": ["./src", "../.cedar/types/mirror/api/src"],
12
- "paths": {
13
- "src/*": ["./src/*", "../.cedar/types/mirror/api/src/*"],
14
- "types/*": ["./types/*", "../types/*"],
15
- "@cedarjs/testing": ["../node_modules/@cedarjs/testing/api"]
16
- },
17
- "typeRoots": ["../node_modules/@types", "./node_modules/@types"],
18
- "types": ["jest"],
19
- "jsx": "react-jsx"
20
- },
21
- "include": [
22
- "src",
23
- "../.cedar/types/includes/all-*",
24
- "../.cedar/types/includes/api-*",
25
- "../types"
26
- ]
27
- }
@@ -1,26 +0,0 @@
1
- #:schema https://raw.githubusercontent.com/cedarjs/cedar/main/packages/project-config/cedar-toml-schema-2.0.json
2
- #:tombi format.disabled = true
3
-
4
- # This file contains the configuration settings for your Cedar app.
5
- # This file is also what makes your Cedar app a Cedar app.
6
- # If you remove it and try to run `yarn cedar dev`, you'll get an error.
7
- #
8
- # For the full list of options, see the "App Configuration: cedar.toml" doc:
9
- # https://cedarjs.com/docs/app-configuration-cedar-toml
10
-
11
- [web]
12
- title = "Cedar App"
13
- port = 8910
14
- apiUrl = "/.api/functions"
15
- includeEnvironmentVariables = [
16
- # Add any ENV vars that should be available to the web side to this array
17
- # See https://cedarjs.com/docs/environment-variables#web
18
- ]
19
- [api]
20
- port = 8911
21
- [browser]
22
- # Only applies to interactive sessions
23
- # Override with `--fwd="--open=true"` (including for CI/agent runs)
24
- open = true
25
- [notifications]
26
- versionUpdates = ["latest"]
@@ -1,3 +0,0 @@
1
- import cedarConfig from '@cedarjs/eslint-config'
2
-
3
- export default await cedarConfig()
@@ -1,27 +0,0 @@
1
- .idea
2
- .DS_Store
3
- .env*
4
- !.env.example
5
- !.env.defaults
6
- .netlify
7
- .cedar/*
8
- !.cedar/README.md
9
- dev.db*
10
- api/db/pglite-data
11
- api/db/generated/prisma
12
- dist
13
- dist-babel
14
- node_modules
15
- tsconfig.tsbuildinfo
16
- yarn-error.log
17
- web/public/mockServiceWorker.js
18
- web/types/graphql.d.ts
19
- api/types/graphql.d.ts
20
- api/src/lib/generateGraphiQLHeader.*
21
- .pnp.*
22
- .yarn/*
23
- !.yarn/patches
24
- !.yarn/plugins
25
- !.yarn/releases
26
- !.yarn/sdks
27
- !.yarn/versions
@@ -1,11 +0,0 @@
1
- // This file is used by the VSCode GraphQL extension
2
-
3
- const { getPaths } = require('@cedarjs/project-config')
4
-
5
- /** @type {import('graphql-config').IGraphQLConfig} */
6
- const config = {
7
- schema: getPaths().generated.schema,
8
- documents: './web/src/**/!(*.d).{ts,tsx,js,jsx}',
9
- }
10
-
11
- module.exports = config
@@ -1,33 +0,0 @@
1
- {
2
- "private": true,
3
- "type": "module",
4
- "workspaces": [
5
- "api",
6
- "web"
7
- ],
8
- "scripts": {
9
- "build": "cedar build",
10
- "dev": "cedar dev",
11
- "start": "cedarjs-server",
12
- "start:api": "cedarjs-server api",
13
- "start:web": "cedarjs-server web"
14
- },
15
- "dependencies": {
16
- "@cedarjs/api-server": "7.0.0"
17
- },
18
- "devDependencies": {
19
- "@cedarjs/core": "7.0.0",
20
- "@cedarjs/eslint-config": "7.0.0",
21
- "@cedarjs/project-config": "7.0.0",
22
- "@cedarjs/testing": "7.0.0",
23
- "vitest": "4.1.10"
24
- },
25
- "engines": {
26
- "node": "24.x"
27
- },
28
- "packageManager": "yarn@4.14.1",
29
- "resolutions": {
30
- "react-is": "19.2.3",
31
- "vite": "7.3.6"
32
- }
33
- }
@@ -1,18 +0,0 @@
1
- // https://prettier.io/docs/en/options.html
2
- /** @type {import('prettier').RequiredOptions} */
3
- module.exports = {
4
- trailingComma: 'es5',
5
- bracketSpacing: true,
6
- tabWidth: 2,
7
- semi: false,
8
- singleQuote: true,
9
- arrowParens: 'always',
10
- overrides: [
11
- {
12
- files: 'Routes.*',
13
- options: {
14
- printWidth: 999,
15
- },
16
- },
17
- ],
18
- }
File without changes
@@ -1,27 +0,0 @@
1
- // import { db } from 'api/src/lib/db.js'
2
-
3
- // Manually apply seeds via the `{{CEDAR_CLI}} prisma db seed` command.
4
- //
5
- // Seeds automatically run the first time you run the `{{CEDAR_CLI}} prisma migrate dev`
6
- // command and every time you run the `{{CEDAR_CLI}} prisma migrate reset` command.
7
- //
8
- // See https://cedarjs.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.ts to start seeding your database!\n'
23
- )
24
- } catch (error) {
25
- console.error(error)
26
- }
27
- }
@@ -1,35 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "noEmit": true,
4
- "allowJs": true,
5
- "esModuleInterop": true,
6
- "target": "es2023",
7
- "module": "node20",
8
- "moduleResolution": "node16",
9
- "rootDirs": [
10
- "../api/src",
11
- "../.cedar/types/mirror/api/src",
12
- "../web/src",
13
- "../.cedar/types/mirror/web/src"
14
- ],
15
- "paths": {
16
- "$api/*": ["../api/*"],
17
- "api/*": ["../api/*"],
18
- "$api/src/*": ["../api/src/*", "../.cedar/types/mirror/api/src/*"],
19
- "api/src/*": ["../api/src/*", "../.cedar/types/mirror/api/src/*"],
20
- "$web/*": ["../web/*"],
21
- "web/*": ["../web/*"],
22
- "$web/src/*": ["../web/src/*", "../.cedar/types/mirror/web/src/*"],
23
- "web/src/*": ["../web/src/*", "../.cedar/types/mirror/web/src/*"],
24
- "types/*": ["../types/*", "../web/types/*", "../api/types/*"]
25
- },
26
- "typeRoots": ["../node_modules/@types"],
27
- "jsx": "preserve"
28
- },
29
- "include": [
30
- ".",
31
- "../.cedar/types/includes/all-*",
32
- "../.cedar/types/includes/web-*",
33
- "../types"
34
- ]
35
- }
@@ -1,15 +0,0 @@
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="cedar-app"></div>
13
- </body>
14
-
15
- </html>
@@ -1,30 +0,0 @@
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": "7.0.0",
16
- "@cedarjs/router": "7.0.0",
17
- "@cedarjs/web": "7.0.0",
18
- "react": "18.3.1",
19
- "react-dom": "18.3.1"
20
- },
21
- "devDependencies": {
22
- "@cedarjs/vite": "7.0.0",
23
- "@types/react": "^18.2.55",
24
- "@types/react-dom": "^18.2.19",
25
- "@cedarjs/testing": "7.0.0",
26
- "@testing-library/jest-dom": "6.9.1",
27
- "@testing-library/react": "16.3.2",
28
- "vite": "7.3.6"
29
- }
30
- }
@@ -1,43 +0,0 @@
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 cedar 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)
@@ -1,2 +0,0 @@
1
- User-agent: *
2
- Disallow:
@@ -1,22 +0,0 @@
1
- import type { ReactNode } from 'react'
2
-
3
- import { FatalErrorBoundary, CedarProvider } from '@cedarjs/web'
4
- import { CedarApolloProvider } from '@cedarjs/web/apollo/CedarApolloProvider'
5
-
6
- import FatalErrorPage from 'src/pages/FatalErrorPage'
7
-
8
- import './index.css'
9
-
10
- interface AppProps {
11
- children?: ReactNode
12
- }
13
-
14
- const App = ({ children }: AppProps) => (
15
- <FatalErrorBoundary page={FatalErrorPage}>
16
- <CedarProvider titleTemplate="%PageTitle | %AppTitle">
17
- <CedarApolloProvider>{children}</CedarApolloProvider>
18
- </CedarProvider>
19
- </FatalErrorBoundary>
20
- )
21
-
22
- export default App
@@ -1,20 +0,0 @@
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
@@ -1,35 +0,0 @@
1
- import { hydrateRoot, createRoot } from 'react-dom/client'
2
-
3
- import App from './App'
4
- import Routes from './Routes'
5
-
6
- /**
7
- * When `#cedar-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 cedarAppElement = document.getElementById('cedar-app')
13
-
14
- if (!cedarAppElement) {
15
- throw new Error(
16
- 'Could not find an element with ID "cedar-app". Please ensure it exists ' +
17
- 'in your `web/index.html` file.'
18
- )
19
- }
20
-
21
- if (cedarAppElement.children?.length > 0) {
22
- hydrateRoot(
23
- cedarAppElement,
24
- <App>
25
- <Routes />
26
- </App>
27
- )
28
- } else {
29
- const root = createRoot(cedarAppElement)
30
- root.render(
31
- <App>
32
- <Routes />
33
- </App>
34
- )
35
- }
File without changes
File without changes
@@ -1,57 +0,0 @@
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, Cedar 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
- ))