@cedarjs/cli 9.0.0-canary.1784 → 9.0.0-canary.3124
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/README.md +7 -10
- package/dist/cfw.js +10 -6
- package/dist/commands/build/buildHandler.js +220 -45
- package/dist/commands/build/buildPackagesTask.js +21 -20
- package/dist/commands/build.js +13 -2
- package/dist/commands/check.js +4 -6
- package/dist/commands/console.js +6 -4
- package/dist/commands/deploy/baremetal/SshExecutor.js +13 -4
- package/dist/commands/deploy/baremetal/baremetalHandler.js +116 -50
- package/dist/commands/deploy/baremetal.js +11 -4
- package/dist/commands/deploy/flightcontrolHandler.js +28 -15
- package/dist/commands/deploy/helpers/deployHandler.js +11 -6
- package/dist/commands/deploy/netlify.js +1 -1
- package/dist/commands/deploy/packing/nft.js +1 -2
- package/dist/commands/deploy/render.js +1 -1
- package/dist/commands/deploy/renderHandler.js +24 -13
- package/dist/commands/deploy/serverlessHandler.js +69 -27
- package/dist/commands/deploy/vercel.js +1 -1
- package/dist/commands/destroy/component/component.js +2 -3
- package/dist/commands/destroy/directive/directive.js +1 -3
- package/dist/commands/destroy/directive/directiveHandler.js +2 -4
- package/dist/commands/destroy/function/function.js +1 -3
- package/dist/commands/destroy/handlerHelpers.js +17 -17
- package/dist/commands/destroy/helpers.js +8 -2
- package/dist/commands/destroy/layout/layout.js +1 -2
- package/dist/commands/destroy/page/pageHandler.js +3 -3
- package/dist/commands/destroy/scaffold/scaffoldHandler.js +31 -12
- package/dist/commands/destroy/sdl/sdlHandler.js +3 -3
- package/dist/commands/dev/apiDebugFlag.js +5 -4
- package/dist/commands/dev/devHandler.js +219 -68
- package/dist/commands/dev/packageWatchCommands.js +8 -3
- package/dist/commands/dev.js +16 -6
- package/dist/commands/execHandler.js +49 -29
- package/dist/commands/experimental/live-queries/liveQueries.js +32 -0
- package/dist/commands/experimental/live-queries/liveQueriesHandler.js +448 -0
- package/dist/commands/experimental/live-queries/templates/liveQueriesListener.ts.template +153 -0
- package/dist/commands/experimental/live-queries/templates/migration.sql.template +100 -0
- package/dist/commands/experimental/setupInngest.js +2 -2
- package/dist/commands/experimental/setupInngestHandler.js +13 -12
- package/dist/commands/experimental/setupOpentelemetry.js +2 -2
- package/dist/commands/experimental/setupOpentelemetryHandler.js +14 -10
- package/dist/commands/experimental/setupReactCompiler.js +2 -2
- package/dist/commands/experimental/setupReactCompilerHandler.js +48 -33
- package/dist/commands/experimental/setupRsc.js +1 -1
- package/dist/commands/experimental/setupRscHandler.js +20 -16
- package/dist/commands/experimental/setupStreamingSsr.js +2 -2
- package/dist/commands/experimental/setupStreamingSsrHandler.js +49 -34
- package/dist/commands/experimental/templates/opentelemetry.ts.template +2 -1
- package/dist/commands/experimental/templates/rsc/Document.tsx.template +1 -1
- package/dist/commands/experimental/templates/rsc/entry.client.tsx.template +8 -8
- package/dist/commands/experimental/templates/streamingSsr/Document.tsx.template +1 -1
- package/dist/commands/experimental/templates/streamingSsr/entry.client.tsx.template +6 -6
- package/dist/commands/experimental/templates/streamingSsr/tsconfig.json.template +6 -6
- package/dist/commands/experimental/util.js +27 -25
- package/dist/commands/experimental.js +3 -2
- package/dist/commands/generate/cell/cell.js +20 -0
- package/dist/commands/generate/cell/cellHandler.js +89 -40
- package/dist/commands/generate/cell/templates/cell.tsx.template +21 -2
- package/dist/commands/generate/cell/templates/cellFragment.tsx.template +43 -0
- package/dist/commands/generate/cell/templates/cellList.tsx.template +21 -2
- package/dist/commands/generate/cell/templates/storiesFragment.tsx.template +23 -0
- package/dist/commands/generate/cell/templates/test.js.template +1 -1
- package/dist/commands/generate/cell/templates/testFragment.js.template +30 -0
- package/dist/commands/generate/component/componentHandler.js +14 -16
- package/dist/commands/generate/dataMigration/dataMigration.js +36 -18
- package/dist/commands/generate/dataMigration/templates/dataMigration.js.template +1 -1
- package/dist/commands/generate/dataMigration/templates/dataMigration.ts.template +1 -1
- package/dist/commands/generate/dbAuth/dbAuth.js +1 -0
- package/dist/commands/generate/dbAuth/dbAuthHandler.js +63 -34
- package/dist/commands/generate/dbAuth/templates/login.oauth.tsx.template +164 -0
- package/dist/commands/generate/dbAuth/templates/signup.oauth.tsx.template +147 -0
- package/dist/commands/generate/directive/directiveHandler.js +14 -16
- package/dist/commands/generate/function/function.js +1 -0
- package/dist/commands/generate/function/functionHandler.js +14 -19
- package/dist/commands/generate/helpers.js +34 -18
- package/dist/commands/generate/job/job.js +1 -0
- package/dist/commands/generate/job/jobHandler.js +20 -24
- package/dist/commands/generate/layout/layoutHandler.js +13 -16
- package/dist/commands/generate/model/model.js +1 -0
- package/dist/commands/generate/model/modelHandler.js +11 -5
- package/dist/commands/generate/ogImage/ogImage.js +1 -0
- package/dist/commands/generate/ogImage/ogImageHandler.js +18 -11
- package/dist/commands/generate/package/filesTask.js +9 -0
- package/dist/commands/generate/package/packageHandler.js +50 -61
- package/dist/commands/generate/package/templates/test.ts.template +2 -2
- package/dist/commands/generate/package/templates/vitest.config.ts.template +9 -0
- package/dist/commands/generate/page/pageHandler.js +27 -24
- package/dist/commands/generate/realtime/realtime.js +2 -2
- package/dist/commands/generate/realtime/realtimeHandler.js +51 -32
- package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.ts.template +1 -1
- package/dist/commands/generate/scaffold/scaffold.js +1 -0
- package/dist/commands/generate/scaffold/scaffoldHandler.js +176 -49
- package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +1 -1
- package/dist/commands/generate/script/script.js +1 -0
- package/dist/commands/generate/script/scriptHandler.js +10 -6
- package/dist/commands/generate/script/templates/script.ts.template +9 -4
- package/dist/commands/generate/script/templates/tsconfig.json.template +16 -2
- package/dist/commands/generate/sdl/sdl.js +4 -3
- package/dist/commands/generate/sdl/sdlHandler.js +135 -46
- package/dist/commands/generate/sdl/stubFiles.js +132 -0
- package/dist/commands/generate/sdl/templates/sdl.js.template +2 -1
- package/dist/commands/generate/sdl/templates/sdl.ts.template +2 -1
- package/dist/commands/generate/secret/secret.js +20 -20
- package/dist/commands/generate/service/service.js +5 -5
- package/dist/commands/generate/service/serviceHandler.js +126 -61
- package/dist/commands/generate/service/templates/scenarios.ts.template +4 -2
- package/dist/commands/generate/service/templates/service.ts.template +22 -8
- package/dist/commands/generate/service/templates/test.ts.template +2 -2
- package/dist/commands/generate/yargsCommandHelpers.js +7 -2
- package/dist/commands/generate/yargsHandlerHelpers.js +20 -18
- package/dist/commands/generate.js +4 -4
- package/dist/commands/info.js +2 -2
- package/dist/commands/jobsHandler.js +7 -4
- package/dist/commands/lint.js +26 -69
- package/dist/commands/prerenderHandler.js +95 -58
- package/dist/commands/prismaHandler.js +51 -26
- package/dist/commands/record/init.js +2 -2
- package/dist/commands/record.js +4 -3
- package/dist/commands/serve.js +245 -31
- package/dist/commands/serveApiHandler.js +7 -6
- package/dist/commands/serveBothHandler.js +22 -13
- package/dist/commands/serveWebHandler.js +3 -2
- package/dist/commands/setup/auth/auth.js +15 -11
- package/dist/commands/setup/cache/cache.js +1 -1
- package/dist/commands/setup/cache/cacheHandler.js +15 -9
- package/dist/commands/setup/database/database.js +15 -0
- package/dist/commands/setup/database/postgres.js +19 -0
- package/dist/commands/setup/database/postgresHandler.js +196 -0
- package/dist/commands/setup/database/templates/db.ts.template +32 -0
- package/dist/commands/setup/deploy/deploy.js +4 -3
- package/dist/commands/setup/deploy/helpers/helpers.js +5 -1
- package/dist/commands/setup/deploy/helpers/index.js +132 -6
- package/dist/commands/setup/deploy/providers/baremetalHandler.js +28 -6
- package/dist/commands/setup/deploy/providers/coherence.js +1 -1
- package/dist/commands/setup/deploy/providers/coherenceHandler.js +60 -31
- package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +69 -51
- package/dist/commands/setup/deploy/providers/netlify.js +6 -0
- package/dist/commands/setup/deploy/providers/netlifyHandler.js +114 -13
- package/dist/commands/setup/deploy/providers/renderHandler.js +44 -41
- package/dist/commands/setup/deploy/providers/serverlessHandler.js +7 -5
- package/dist/commands/setup/deploy/providers/universal-deploy.js +11 -0
- package/dist/commands/setup/deploy/providers/universalDeployHandler.js +186 -0
- package/dist/commands/setup/deploy/providers/vercel.js +6 -0
- package/dist/commands/setup/deploy/providers/vercelHandler.js +115 -14
- package/dist/commands/setup/deploy/templates/baremetal.js +3 -2
- package/dist/commands/setup/deploy/templates/flightcontrol.js +60 -49
- package/dist/commands/setup/deploy/templates/netlify.js +2 -1
- package/dist/commands/setup/deploy/templates/netlifyUD.js +31 -0
- package/dist/commands/setup/deploy/templates/render.js +32 -17
- package/dist/commands/setup/docker/docker.js +2 -2
- package/dist/commands/setup/docker/dockerHandler.js +74 -39
- package/dist/commands/setup/docker/templates/Dockerfile.npm +119 -0
- package/dist/commands/setup/docker/templates/Dockerfile.pnpm +112 -0
- package/dist/commands/setup/docker/templates/{Dockerfile → Dockerfile.yarn} +4 -7
- package/dist/commands/setup/docker/templates/docker-compose.dev.yml +3 -3
- package/dist/commands/setup/docker/templates/docker-compose.prod.yml +2 -5
- package/dist/commands/setup/docker/templates/dockerignore +1 -0
- package/dist/commands/setup/generator/generator.js +1 -1
- package/dist/commands/setup/generator/generatorHandler.js +5 -4
- package/dist/commands/setup/graphql/features/fragments/appGqlConfigTransform.js +6 -3
- package/dist/commands/setup/graphql/features/fragments/fragments.js +1 -1
- package/dist/commands/setup/graphql/features/fragments/fragmentsHandler.js +5 -7
- package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocuments.js +1 -1
- package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocumentsHandler.js +4 -3
- package/dist/commands/setup/i18n/i18n.js +1 -1
- package/dist/commands/setup/i18n/i18nHandler.js +21 -17
- package/dist/commands/setup/jobs/jobs.js +1 -1
- package/dist/commands/setup/jobs/jobsHandler.js +17 -12
- package/dist/commands/setup/mailer/mailer.js +1 -1
- package/dist/commands/setup/mailer/mailerHandler.js +13 -11
- package/dist/commands/setup/middleware/ogImage/ogImage.js +1 -1
- package/dist/commands/setup/middleware/ogImage/ogImageHandler.js +2 -1
- package/dist/commands/setup/monitoring/sentry/sentry.js +1 -1
- package/dist/commands/setup/monitoring/sentry/sentryHandler.js +18 -12
- package/dist/commands/setup/neon/neon.js +35 -0
- package/dist/commands/setup/neon/neonHandler.js +264 -0
- package/dist/commands/setup/package/package.js +1 -1
- package/dist/commands/setup/package/packageHandler.js +18 -14
- package/dist/commands/setup/realtime/addRealtimeToGraphql.js +1 -1
- package/dist/commands/setup/realtime/realtime.js +1 -1
- package/dist/commands/setup/realtime/realtimeHandler.js +26 -37
- package/dist/commands/setup/realtime/templates/realtime.ts.template +1 -1
- package/dist/commands/setup/realtime/templates/subscriptions/countdown/countdown.ts.template +1 -1
- package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +1 -1
- package/dist/commands/setup/server-file/serverFile.js +1 -1
- package/dist/commands/setup/server-file/serverFileHandler.js +18 -10
- package/dist/commands/setup/tenancy/authCodemod.js +66 -0
- package/dist/commands/setup/tenancy/dbCodemod.js +64 -0
- package/dist/commands/setup/tenancy/graphqlCodemod.js +88 -0
- package/dist/commands/setup/tenancy/preflight.js +49 -0
- package/dist/commands/setup/tenancy/schemaPrisma.js +81 -0
- package/dist/commands/setup/tenancy/signupCodemod.js +153 -0
- package/dist/commands/setup/tenancy/templates/InvitePage.tsx.template +63 -0
- package/dist/commands/setup/tenancy/templates/OrgScope.tsx.template +40 -0
- package/dist/commands/setup/tenancy/templates/ensureDefaultOrganizations.dataMigration.ts.template +39 -0
- package/dist/commands/setup/tenancy/templates/organizations.scenarios.ts.template +59 -0
- package/dist/commands/setup/tenancy/templates/organizations.sdl.ts.template +89 -0
- package/dist/commands/setup/tenancy/templates/organizations.test.ts.template +389 -0
- package/dist/commands/setup/tenancy/templates/organizations.ts.template +394 -0
- package/dist/commands/setup/tenancy/templates/requireMembership.test.ts.template +35 -0
- package/dist/commands/setup/tenancy/templates/requireMembership.ts.template +25 -0
- package/dist/commands/setup/tenancy/tenancy.js +30 -0
- package/dist/commands/setup/tenancy/tenancyHandler.js +425 -0
- package/dist/commands/setup/ui/helpers/helpers.js +5 -1
- package/dist/commands/setup/ui/libraries/chakra-uiHandler.js +16 -8
- package/dist/commands/setup/ui/libraries/mantineHandler.js +26 -16
- package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +40 -29
- package/dist/commands/setup/uploads/schemaPrisma.js +41 -0
- package/dist/commands/setup/uploads/serverFile.js +151 -0
- package/dist/commands/setup/uploads/templates/requireUploadToken.ts.template +15 -0
- package/dist/commands/setup/uploads/templates/srcLibUploads.ts.template +23 -24
- package/dist/commands/setup/uploads/templates/uploads.sdl.ts.template +79 -0
- package/dist/commands/setup/uploads/templates/uploads.ts.template +89 -0
- package/dist/commands/setup/uploads/templates/withDataUri.ts.template +14 -0
- package/dist/commands/setup/uploads/templates/withSignedUrl.ts.template +16 -0
- package/dist/commands/setup/uploads/uploads.js +49 -7
- package/dist/commands/setup/uploads/uploadsHandler.js +266 -72
- package/dist/commands/setup.js +5 -4
- package/dist/commands/studio.js +1 -1
- package/dist/commands/studioHandler.js +2 -2
- package/dist/commands/test/datasourceWarning.js +42 -0
- package/dist/commands/test/testHandler.js +104 -0
- package/dist/commands/test/viteVersionCheck.js +75 -0
- package/dist/commands/test.js +16 -19
- package/dist/commands/type-check.js +2 -1
- package/dist/commands/type-checkHandler.js +25 -18
- package/dist/commands/upgrade/preUpgradeScripts.js +11 -11
- package/dist/commands/upgrade/upgrade.js +4 -2
- package/dist/commands/upgrade/upgradeHandler.js +97 -73
- package/dist/index.js +15 -11
- package/dist/lib/background.js +22 -1
- package/dist/lib/configureStorybook.js +2 -2
- package/dist/lib/exec.js +68 -63
- package/dist/lib/exit.js +20 -5
- package/dist/lib/extendFile.js +23 -13
- package/dist/lib/generatePrismaClient.js +48 -12
- package/dist/lib/index.js +137 -106
- package/dist/lib/loadEnvFiles.js +1 -1
- package/dist/lib/locking.js +8 -4
- package/dist/lib/merge/algorithms.js +4 -1
- package/dist/lib/merge/index.js +78 -41
- package/dist/lib/merge/semanticIdentity.js +18 -6
- package/dist/lib/merge/strategy.js +86 -36
- package/dist/lib/packages.js +23 -13
- package/dist/lib/plugin.js +13 -7
- package/dist/lib/pluralHelpers.js +6 -2
- package/dist/lib/project.js +3 -1
- package/dist/lib/rollback.js +7 -7
- package/dist/lib/schemaHelpers.js +16 -19
- package/dist/lib/test.js +20 -5
- package/dist/lib/updateCheck.js +47 -18
- package/dist/middleware/checkNodeVersion.js +9 -4
- package/dist/middleware/{detectProjectRxVersion.js → detectProjectCedarVersion.js} +2 -2
- package/dist/plugin.js +18 -12
- package/dist/telemetry/exporter.js +12 -5
- package/dist/telemetry/index.js +4 -3
- package/dist/telemetry/resource.js +9 -12
- package/dist/telemetry/send.js +14 -10
- package/dist/testLib/cells.js +5 -3
- package/package.json +44 -41
- package/LICENSE +0 -21
- package/dist/commands/consoleHandler.js +0 -68
- package/dist/commands/setup/tsconfig/tsconfig.js +0 -25
- package/dist/commands/setup/tsconfig/tsconfigHandler.js +0 -59
- package/dist/commands/setup/uploads/dbCodemod.js +0 -28
- package/dist/commands/setup/uploads/templates/signedUrl.ts.template +0 -21
- package/dist/commands/setup/vite/templates/vite.config.ts.template +0 -19
- package/dist/commands/setup/vite/vite.js +0 -38
- package/dist/commands/setup/vite/viteHandler.js +0 -83
- package/dist/commands/testEsm.js +0 -36
- package/dist/commands/testHandler.js +0 -137
- package/dist/commands/testHandlerEsm.js +0 -85
- package/dist/commands/ts-to-js.js +0 -20
- package/dist/lib/cedarPluralize.js +0 -56
- package/dist/lib/colors.js +0 -18
- package/dist/testLib/getFilesWithPattern.js +0 -21
- /package/dist/{index.d.js → global.d.js} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
1
2
|
import { getConfig } from "../../../../lib/index.js";
|
|
2
3
|
const config = getConfig();
|
|
3
4
|
const NETLIFY_TOML = `[build]
|
|
4
|
-
command = "
|
|
5
|
+
command = "${formatCedarCommand(["deploy", "netlify"])}"
|
|
5
6
|
publish = "web/dist"
|
|
6
7
|
functions = "api/dist/functions"
|
|
7
8
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
2
|
+
import { getConfig } from "../../../../lib/index.js";
|
|
3
|
+
const config = getConfig();
|
|
4
|
+
const NETLIFY_UD_TOML = `[build]
|
|
5
|
+
command = "${formatCedarCommand(["build", "--ud", "--apiRootPath=/.api/functions"])} && ${formatCedarCommand(["prisma", "migrate", "deploy"])} && ${formatCedarCommand(["data-migrate", "up"])}"
|
|
6
|
+
publish = "web/dist"
|
|
7
|
+
|
|
8
|
+
[build.environment]
|
|
9
|
+
NODE_VERSION = "24"
|
|
10
|
+
|
|
11
|
+
[functions]
|
|
12
|
+
directory = "api/dist/ud"
|
|
13
|
+
|
|
14
|
+
# To use Netlify Dev, install Netlify's CLI (\`netlify-cli\`) from NPM and use
|
|
15
|
+
# \`netlify link\` to connect your local project to a site on Netlify. Then run
|
|
16
|
+
# \`netlify dev\`.
|
|
17
|
+
#
|
|
18
|
+
# Quick links to the docs:
|
|
19
|
+
# - Netlify Dev https://docs.netlify.com/api-and-cli-guides/cli-guides/local-development
|
|
20
|
+
# - Netlify's CLI https://docs.netlify.com/api-and-cli-guides/cli-guides/get-started-with-cli/
|
|
21
|
+
# - \`netlify link\` https://cli.netlify.com/commands/link/
|
|
22
|
+
[dev]
|
|
23
|
+
framework = "cedarjs"
|
|
24
|
+
# Make sure \`targetPort\` matches \`web.port\` in your cedar.toml file
|
|
25
|
+
targetPort = ${config.web.port}
|
|
26
|
+
# Point your browser to this port to access your app
|
|
27
|
+
port = 8888
|
|
28
|
+
`;
|
|
29
|
+
export {
|
|
30
|
+
NETLIFY_UD_TOML
|
|
31
|
+
};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { getPaths } from "../../../../lib/index.js";
|
|
3
|
+
import { getUserApiUrl } from "../helpers/index.js";
|
|
3
4
|
const PROJECT_NAME = path.basename(getPaths().base);
|
|
4
|
-
const RENDER_YAML = (database) => {
|
|
5
|
+
const RENDER_YAML = (database, plan = "free") => {
|
|
6
|
+
const apiUrl = getUserApiUrl().replace(/\/$/, "");
|
|
5
7
|
return `# Quick links to the docs:
|
|
6
|
-
# -
|
|
7
|
-
# - Render's
|
|
8
|
+
# - Deploying Cedar: https://cedarjs.com/docs/deploy/render
|
|
9
|
+
# - Render's own walkthrough (uses \`yarn rw\`, but just swap in \`yarn cedar\`):
|
|
10
|
+
# https://render.com/docs/deploy-redwood
|
|
11
|
+
# - Render's Blueprint spec: https://render.com/docs/blueprint-spec
|
|
8
12
|
|
|
9
13
|
services:
|
|
10
14
|
- name: ${PROJECT_NAME}-web
|
|
11
15
|
type: web
|
|
12
|
-
|
|
16
|
+
runtime: static
|
|
13
17
|
buildCommand: npm install --global corepack && yarn install && yarn cedar deploy render web
|
|
14
18
|
staticPublishPath: ./web/dist
|
|
15
19
|
|
|
@@ -19,12 +23,17 @@ services:
|
|
|
19
23
|
|
|
20
24
|
routes:
|
|
21
25
|
- type: rewrite
|
|
22
|
-
source:
|
|
23
|
-
# Replace \`destination\`
|
|
26
|
+
source: ${apiUrl}/*
|
|
27
|
+
# Replace \`destination\` after your first deploy, with the api service's
|
|
28
|
+
# URL from the Render dashboard:
|
|
24
29
|
#
|
|
25
30
|
# \`\`\`
|
|
26
|
-
# destination: https
|
|
31
|
+
# destination: https://${PROJECT_NAME}-api.onrender.com/*
|
|
27
32
|
# \`\`\`
|
|
33
|
+
#
|
|
34
|
+
# This can't be filled in automatically \u2014 Render's \`fromService\` only
|
|
35
|
+
# resolves service hosts into \`envVars\`, not into a static site's route
|
|
36
|
+
# destination.
|
|
28
37
|
destination: replace_with_api_url/*
|
|
29
38
|
- type: rewrite
|
|
30
39
|
source: /*
|
|
@@ -32,12 +41,23 @@ services:
|
|
|
32
41
|
|
|
33
42
|
- name: ${PROJECT_NAME}-api
|
|
34
43
|
type: web
|
|
35
|
-
plan:
|
|
36
|
-
|
|
44
|
+
plan: ${plan}
|
|
45
|
+
runtime: node
|
|
37
46
|
region: oregon
|
|
38
47
|
buildCommand: npm install --global corepack && yarn install && yarn cedar build api
|
|
39
48
|
startCommand: yarn cedar deploy render api
|
|
40
49
|
|
|
50
|
+
# Proves the GraphQL server is actually serving, not just that the process
|
|
51
|
+
# is alive. Returns 200 with an \`x-yoga-id\` response header.
|
|
52
|
+
#
|
|
53
|
+
# The route is \`<apiRootPath><graphiQLEndpoint>/health\`, and the value below
|
|
54
|
+
# assumes both defaults (\`/\` and \`/graphql\`). Update it to match if you
|
|
55
|
+
# customize either \u2014 by setting \`CEDAR_API_ROOT_PATH\` in the envVars below,
|
|
56
|
+
# by passing \`apiRootPath\` to \`createServer\` in \`api/src/server.ts\`, or by
|
|
57
|
+
# setting \`graphiQLEndpoint\` in \`api/src/functions/graphql.ts\`. A mismatch
|
|
58
|
+
# here 404s, and Render will not promote the deploy.
|
|
59
|
+
healthCheckPath: /graphql/health
|
|
60
|
+
|
|
41
61
|
envVars:
|
|
42
62
|
${database}
|
|
43
63
|
`;
|
|
@@ -49,24 +69,19 @@ const POSTGRES_YAML = ` - key: DATABASE_URL
|
|
|
49
69
|
|
|
50
70
|
databases:
|
|
51
71
|
- name: ${PROJECT_NAME}-db
|
|
72
|
+
plan: free
|
|
52
73
|
region: oregon`;
|
|
53
74
|
const SQLITE_YAML = ` - key: DATABASE_URL
|
|
54
75
|
value: file:./data/sqlite.db
|
|
76
|
+
# Persistent disks aren't available on Render's free plan, which is why
|
|
77
|
+
# the api service above is on a paid plan when SQLite is selected.
|
|
55
78
|
disk:
|
|
56
79
|
name: sqlite-data
|
|
57
80
|
mountPath: /opt/render/project/src/api/db/data
|
|
58
81
|
sizeGB: 1`;
|
|
59
|
-
const RENDER_HEALTH_CHECK = `// render-health-check
|
|
60
|
-
export const handler = async () => {
|
|
61
|
-
return {
|
|
62
|
-
statusCode: 200,
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
82
|
export {
|
|
67
83
|
POSTGRES_YAML,
|
|
68
84
|
PROJECT_NAME,
|
|
69
|
-
RENDER_HEALTH_CHECK,
|
|
70
85
|
RENDER_YAML,
|
|
71
86
|
SQLITE_YAML
|
|
72
87
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
2
2
|
const command = "docker";
|
|
3
|
-
const description = "Setup the default
|
|
3
|
+
const description = "Setup the default Cedar Dockerfile";
|
|
4
4
|
function builder(yargs) {
|
|
5
5
|
yargs.option("force", {
|
|
6
6
|
alias: "f",
|
|
@@ -3,17 +3,22 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import execa from "execa";
|
|
5
5
|
import { Listr } from "listr2";
|
|
6
|
-
import {
|
|
6
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
7
|
+
import { writeFile } from "@cedarjs/cli-helpers/fileHelpers";
|
|
8
|
+
import { dedupe } from "@cedarjs/cli-helpers/packageManager";
|
|
9
|
+
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
10
|
+
import { addWorkspacePackages } from "@cedarjs/cli-helpers/packageManager/packages";
|
|
7
11
|
import { getConfig, getConfigPath, getPaths } from "@cedarjs/project-config";
|
|
12
|
+
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
8
13
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
9
|
-
import c from "../../../lib/colors.js";
|
|
10
14
|
async function handler({ force }) {
|
|
11
15
|
const TEMPLATE_DIR = path.join(import.meta.dirname, "templates");
|
|
16
|
+
const pm = getPackageManager();
|
|
12
17
|
let dockerfileTemplateContent = fs.readFileSync(
|
|
13
|
-
path.resolve(TEMPLATE_DIR,
|
|
18
|
+
path.resolve(TEMPLATE_DIR, `Dockerfile.${pm}`),
|
|
14
19
|
"utf-8"
|
|
15
20
|
);
|
|
16
|
-
|
|
21
|
+
let dockerComposeDevTemplateContent = fs.readFileSync(
|
|
17
22
|
path.resolve(TEMPLATE_DIR, "docker-compose.dev.yml"),
|
|
18
23
|
"utf-8"
|
|
19
24
|
);
|
|
@@ -37,31 +42,46 @@ async function handler({ force }) {
|
|
|
37
42
|
const dockerignoreFilePath = path.join(getPaths().base, ".dockerignore");
|
|
38
43
|
const configTomlPath = getConfigPath();
|
|
39
44
|
const configFileName = path.basename(configTomlPath);
|
|
45
|
+
dockerComposeDevTemplateContent = dockerComposeDevTemplateContent.replace(/'{{DEV_CMD}}'/g, formatCedarCommand(["dev"])).replace(/{{CEDAR_CMD}}/g, formatCedarCommand([]));
|
|
40
46
|
const tasks = new Listr(
|
|
41
47
|
[
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
// The yarn workspace-tools plugin only exists for yarn.
|
|
49
|
+
// For pnpm, pnpm install --prod --filter api is built-in. Workspaces are
|
|
50
|
+
// a first-class feature with no plugin needed. For npm, there's no
|
|
51
|
+
// workspace-focus equivalent at all, so npm ci --omit=dev installs
|
|
52
|
+
// production deps for all workspaces (slightly less optimized but
|
|
53
|
+
// functionally correct).
|
|
54
|
+
...pm === "yarn" ? [
|
|
55
|
+
{
|
|
56
|
+
title: "Adding the official yarn workspace-tools plugin...",
|
|
57
|
+
task: async (_, task) => {
|
|
58
|
+
const { stdout } = await execa(
|
|
59
|
+
"yarn",
|
|
60
|
+
["plugin", "runtime", "--json"],
|
|
61
|
+
{
|
|
62
|
+
cwd: getPaths().base
|
|
63
|
+
}
|
|
52
64
|
);
|
|
53
|
-
|
|
65
|
+
const hasWorkspaceToolsPlugin = stdout.trim().split("\n").map((line) => JSON.parse(line)).some(
|
|
66
|
+
({ name }) => name === "@yarnpkg/plugin-workspace-tools"
|
|
67
|
+
);
|
|
68
|
+
if (hasWorkspaceToolsPlugin) {
|
|
69
|
+
task.skip(
|
|
70
|
+
"The official yarn workspace-tools plugin is already installed"
|
|
71
|
+
);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
return execa("yarn", ["plugin", "import", "workspace-tools"], {
|
|
75
|
+
cwd: getPaths().base
|
|
76
|
+
}).stdout;
|
|
54
77
|
}
|
|
55
|
-
return execa.command("yarn plugin import workspace-tools", {
|
|
56
|
-
cwd: getPaths().base
|
|
57
|
-
}).stdout;
|
|
58
78
|
}
|
|
59
|
-
|
|
79
|
+
] : [],
|
|
60
80
|
{
|
|
61
81
|
title: "Adding @cedarjs/api-server and @cedarjs/web-server...",
|
|
62
82
|
task: async (_ctx, task) => {
|
|
63
83
|
const apiServerPackageName = "@cedarjs/api-server";
|
|
64
|
-
const { dependencies: apiDependencies } = JSON.parse(
|
|
84
|
+
const { dependencies: apiDependencies = {} } = JSON.parse(
|
|
65
85
|
fs.readFileSync(
|
|
66
86
|
path.join(getPaths().api.base, "package.json"),
|
|
67
87
|
"utf-8"
|
|
@@ -69,7 +89,7 @@ async function handler({ force }) {
|
|
|
69
89
|
);
|
|
70
90
|
const hasApiServerPackage = Object.keys(apiDependencies).includes(apiServerPackageName);
|
|
71
91
|
const webServerPackageName = "@cedarjs/web-server";
|
|
72
|
-
const { dependencies: webDependencies } = JSON.parse(
|
|
92
|
+
const { dependencies: webDependencies = {} } = JSON.parse(
|
|
73
93
|
fs.readFileSync(
|
|
74
94
|
path.join(getPaths().web.base, "package.json"),
|
|
75
95
|
"utf-8"
|
|
@@ -84,25 +104,26 @@ async function handler({ force }) {
|
|
|
84
104
|
}
|
|
85
105
|
if (!hasApiServerPackage) {
|
|
86
106
|
const apiServerPackageVersion = await getVersionOfRedwoodPackageToInstall(apiServerPackageName);
|
|
87
|
-
await
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
}
|
|
107
|
+
await addWorkspacePackages(
|
|
108
|
+
"api",
|
|
109
|
+
[`${apiServerPackageName}@${apiServerPackageVersion}`],
|
|
110
|
+
{ cwd: getPaths().base }
|
|
92
111
|
);
|
|
93
112
|
}
|
|
94
113
|
if (!hasWebServerPackage) {
|
|
95
114
|
const webServerPackageVersion = await getVersionOfRedwoodPackageToInstall(webServerPackageName);
|
|
96
|
-
await
|
|
97
|
-
|
|
98
|
-
{
|
|
99
|
-
|
|
100
|
-
}
|
|
115
|
+
await addWorkspacePackages(
|
|
116
|
+
"web",
|
|
117
|
+
[`${webServerPackageName}@${webServerPackageVersion}`],
|
|
118
|
+
{ cwd: getPaths().base }
|
|
101
119
|
);
|
|
102
120
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
121
|
+
const dedupeCommand = dedupe();
|
|
122
|
+
if (dedupeCommand) {
|
|
123
|
+
await execa(getPackageManager(), [dedupeCommand], {
|
|
124
|
+
cwd: getPaths().base
|
|
125
|
+
});
|
|
126
|
+
}
|
|
106
127
|
}
|
|
107
128
|
},
|
|
108
129
|
{
|
|
@@ -234,7 +255,7 @@ async function handler({ force }) {
|
|
|
234
255
|
"Then, connect to the container and migrate your database:",
|
|
235
256
|
"",
|
|
236
257
|
" docker compose -f ./docker-compose.dev.yml run --rm -it console /bin/bash",
|
|
237
|
-
" root@...:/home/node/app#
|
|
258
|
+
" root@...:/home/node/app# " + formatCedarCommand(["prisma", "migrate", "dev"]),
|
|
238
259
|
"",
|
|
239
260
|
"We assume you're using Postgres. If you're not, you'll need to make other changes to switch over.",
|
|
240
261
|
"Lastly, ensure you have Docker. If you don't, see https://docs.docker.com/desktop/",
|
|
@@ -244,9 +265,11 @@ async function handler({ force }) {
|
|
|
244
265
|
].join("\n")
|
|
245
266
|
);
|
|
246
267
|
} catch (e) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
process.
|
|
268
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
269
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
270
|
+
errorTelemetry(process.argv, msg);
|
|
271
|
+
console.error(c.error(msg));
|
|
272
|
+
process.exit(exitCode);
|
|
250
273
|
}
|
|
251
274
|
}
|
|
252
275
|
async function getVersionOfRedwoodPackageToInstall(module) {
|
|
@@ -254,9 +277,21 @@ async function getVersionOfRedwoodPackageToInstall(module) {
|
|
|
254
277
|
const packageJsonPath = createdRequire.resolve("@cedarjs/cli/package.json", {
|
|
255
278
|
paths: [getPaths().base]
|
|
256
279
|
});
|
|
257
|
-
let { version } = JSON.parse(
|
|
280
|
+
let { version = "" } = JSON.parse(
|
|
281
|
+
fs.readFileSync(packageJsonPath, "utf8")
|
|
282
|
+
);
|
|
258
283
|
const packumentP = await fetch(`https://registry.npmjs.org/${module}`);
|
|
259
284
|
const packument = await packumentP.json();
|
|
285
|
+
if (packument.error) {
|
|
286
|
+
throw new Error(
|
|
287
|
+
`Couldn't fetch packument for ${module}: ${packument.error}`
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
if (!packument.versions || typeof packument.versions !== "object" || Array.isArray(packument.versions)) {
|
|
291
|
+
throw new Error(
|
|
292
|
+
`Couldn't fetch packument for ${module}: invalid versions field`
|
|
293
|
+
);
|
|
294
|
+
}
|
|
260
295
|
if (version.includes("+")) {
|
|
261
296
|
version = version.split("+")[0];
|
|
262
297
|
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# base
|
|
2
|
+
# ----
|
|
3
|
+
FROM node:24-bookworm-slim as base
|
|
4
|
+
|
|
5
|
+
RUN npm install --global corepack
|
|
6
|
+
|
|
7
|
+
# We tried to make the Dockerfile as lean as possible. In some cases, that
|
|
8
|
+
# means we excluded a dependency your project needs.
|
|
9
|
+
# By far the most common is Python. If you're running into build errors
|
|
10
|
+
# because `python3` isn't available, add `python3 make gcc \` before the
|
|
11
|
+
# `openssl \` line below and in other stages as necessary:
|
|
12
|
+
RUN apt-get update && apt-get install -y \
|
|
13
|
+
openssl \
|
|
14
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
15
|
+
|
|
16
|
+
USER node
|
|
17
|
+
WORKDIR /home/node/app
|
|
18
|
+
|
|
19
|
+
COPY --chown=node:node package*.json .
|
|
20
|
+
COPY --chown=node:node api/package.json api/
|
|
21
|
+
COPY --chown=node:node web/package.json web/
|
|
22
|
+
|
|
23
|
+
RUN --mount=type=cache,target=/home/node/.npm,uid=1000 \
|
|
24
|
+
npm ci
|
|
25
|
+
|
|
26
|
+
COPY --chown=node:node cedar.toml* redwood.toml* ./
|
|
27
|
+
COPY --chown=node:node graphql.config.cjs .
|
|
28
|
+
COPY --chown=node:node .env.defaults .env.defaults
|
|
29
|
+
|
|
30
|
+
# api build
|
|
31
|
+
# ---------
|
|
32
|
+
FROM base as api_build
|
|
33
|
+
|
|
34
|
+
COPY --chown=node:node api api
|
|
35
|
+
RUN npx --yes cedar build api
|
|
36
|
+
|
|
37
|
+
# web prerender build
|
|
38
|
+
# -------------------
|
|
39
|
+
FROM api_build as web_build_with_prerender
|
|
40
|
+
|
|
41
|
+
COPY --chown=node:node web web
|
|
42
|
+
RUN npx --yes cedar build web
|
|
43
|
+
|
|
44
|
+
# web build
|
|
45
|
+
# ---------
|
|
46
|
+
FROM base as web_build
|
|
47
|
+
|
|
48
|
+
COPY --chown=node:node web web
|
|
49
|
+
RUN npx --yes cedar build web --no-prerender
|
|
50
|
+
|
|
51
|
+
# api serve
|
|
52
|
+
# ---------
|
|
53
|
+
FROM node:24-bookworm-slim as api_serve
|
|
54
|
+
|
|
55
|
+
RUN npm install --global corepack
|
|
56
|
+
|
|
57
|
+
RUN apt-get update && apt-get install -y \
|
|
58
|
+
openssl \
|
|
59
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
60
|
+
|
|
61
|
+
USER node
|
|
62
|
+
WORKDIR /home/node/app
|
|
63
|
+
|
|
64
|
+
# npm doesn't have a workspace focus command, so we copy all workspace
|
|
65
|
+
# package.json files and install production deps for all workspaces.
|
|
66
|
+
COPY --chown=node:node package*.json .
|
|
67
|
+
COPY --chown=node:node api/package.json api/
|
|
68
|
+
COPY --chown=node:node web/package.json web/
|
|
69
|
+
|
|
70
|
+
RUN --mount=type=cache,target=/home/node/.npm,uid=1000 \
|
|
71
|
+
npm ci --omit=dev
|
|
72
|
+
|
|
73
|
+
COPY --chown=node:node cedar.toml* redwood.toml* ./
|
|
74
|
+
COPY --chown=node:node graphql.config.cjs .
|
|
75
|
+
COPY --chown=node:node .env.defaults .env.defaults
|
|
76
|
+
|
|
77
|
+
COPY --chown=node:node --from=api_build /home/node/app/api/dist /home/node/app/api/dist
|
|
78
|
+
COPY --chown=node:node --from=api_build /home/node/app/api/db /home/node/app/api/db
|
|
79
|
+
COPY --chown=node:node --from=api_build /home/node/app/node_modules/.prisma /home/node/app/node_modules/.prisma
|
|
80
|
+
|
|
81
|
+
ENV NODE_ENV=production
|
|
82
|
+
|
|
83
|
+
CMD ["node_modules/.bin/cedarjs-server", "api"]
|
|
84
|
+
|
|
85
|
+
# web serve
|
|
86
|
+
# ---------
|
|
87
|
+
FROM node:24-bookworm-slim as web_serve
|
|
88
|
+
|
|
89
|
+
RUN npm install --global corepack
|
|
90
|
+
|
|
91
|
+
USER node
|
|
92
|
+
WORKDIR /home/node/app
|
|
93
|
+
|
|
94
|
+
COPY --chown=node:node package*.json .
|
|
95
|
+
COPY --chown=node:node api/package.json api/
|
|
96
|
+
COPY --chown=node:node web/package.json web/
|
|
97
|
+
|
|
98
|
+
RUN --mount=type=cache,target=/home/node/.npm,uid=1000 \
|
|
99
|
+
npm ci --omit=dev
|
|
100
|
+
|
|
101
|
+
COPY --chown=node:node cedar.toml* redwood.toml* ./
|
|
102
|
+
COPY --chown=node:node graphql.config.cjs .
|
|
103
|
+
COPY --chown=node:node .env.defaults .env.defaults
|
|
104
|
+
|
|
105
|
+
COPY --chown=node:node --from=web_build /home/node/app/web/dist /home/node/app/web/dist
|
|
106
|
+
|
|
107
|
+
ENV NODE_ENV=production \
|
|
108
|
+
API_PROXY_TARGET=http://api:8911
|
|
109
|
+
|
|
110
|
+
# We use the shell form here for variable expansion.
|
|
111
|
+
CMD node_modules/.bin/cedar-web-server --api-proxy-target $API_PROXY_TARGET
|
|
112
|
+
|
|
113
|
+
# console
|
|
114
|
+
# -------
|
|
115
|
+
FROM base as console
|
|
116
|
+
|
|
117
|
+
COPY --chown=node:node api api
|
|
118
|
+
COPY --chown=node:node web web
|
|
119
|
+
COPY --chown=node:node scripts scripts
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# base
|
|
2
|
+
# ----
|
|
3
|
+
FROM node:24-bookworm-slim as base
|
|
4
|
+
|
|
5
|
+
RUN npm install --global corepack
|
|
6
|
+
|
|
7
|
+
RUN apt-get update && apt-get install -y \
|
|
8
|
+
openssl \
|
|
9
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
10
|
+
|
|
11
|
+
USER node
|
|
12
|
+
WORKDIR /home/node/app
|
|
13
|
+
|
|
14
|
+
COPY --chown=node:node package.json .
|
|
15
|
+
COPY --chown=node:node pnpm-lock.yaml .
|
|
16
|
+
COPY --chown=node:node pnpm-workspace.yaml .
|
|
17
|
+
COPY --chown=node:node api/package.json api/
|
|
18
|
+
COPY --chown=node:node web/package.json web/
|
|
19
|
+
|
|
20
|
+
RUN --mount=type=cache,id=pnpm,target=/home/node/.pnpm/store,uid=1000 \
|
|
21
|
+
pnpm install --frozen-lockfile --store-dir /home/node/.pnpm/store
|
|
22
|
+
|
|
23
|
+
COPY --chown=node:node cedar.toml* redwood.toml* ./
|
|
24
|
+
COPY --chown=node:node graphql.config.cjs .
|
|
25
|
+
COPY --chown=node:node .env.defaults .env.defaults
|
|
26
|
+
|
|
27
|
+
# api build
|
|
28
|
+
# ---------
|
|
29
|
+
FROM base as api_build
|
|
30
|
+
|
|
31
|
+
COPY --chown=node:node api api
|
|
32
|
+
RUN pnpm exec cedar build api
|
|
33
|
+
|
|
34
|
+
# web prerender build
|
|
35
|
+
# -------------------
|
|
36
|
+
FROM api_build as web_build_with_prerender
|
|
37
|
+
|
|
38
|
+
COPY --chown=node:node web web
|
|
39
|
+
RUN pnpm exec cedar build web
|
|
40
|
+
|
|
41
|
+
# web build
|
|
42
|
+
# ---------
|
|
43
|
+
FROM base as web_build
|
|
44
|
+
|
|
45
|
+
COPY --chown=node:node web web
|
|
46
|
+
RUN pnpm exec cedar build web --no-prerender
|
|
47
|
+
|
|
48
|
+
# deploy
|
|
49
|
+
# ------
|
|
50
|
+
FROM api_build as deploy
|
|
51
|
+
|
|
52
|
+
COPY --chown=node:node --from=web_build /home/node/app/web/dist /home/node/app/web/dist
|
|
53
|
+
|
|
54
|
+
RUN pnpm deploy --filter=api --prod /home/node/app/dist/api
|
|
55
|
+
RUN pnpm deploy --filter=web --prod /home/node/app/dist/web
|
|
56
|
+
|
|
57
|
+
# api serve
|
|
58
|
+
# ---------
|
|
59
|
+
FROM node:24-bookworm-slim as api_serve
|
|
60
|
+
|
|
61
|
+
RUN npm install --global corepack
|
|
62
|
+
|
|
63
|
+
RUN apt-get update && apt-get install -y \
|
|
64
|
+
openssl \
|
|
65
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
66
|
+
|
|
67
|
+
USER node
|
|
68
|
+
WORKDIR /home/node/app
|
|
69
|
+
|
|
70
|
+
COPY --chown=node:node cedar.toml* redwood.toml* ./
|
|
71
|
+
COPY --chown=node:node graphql.config.cjs .
|
|
72
|
+
COPY --chown=node:node .env.defaults .env.defaults
|
|
73
|
+
|
|
74
|
+
COPY --chown=node:node --from=deploy /home/node/app/dist/api /home/node/app
|
|
75
|
+
|
|
76
|
+
COPY --chown=node:node --from=api_build /home/node/app/api/dist /home/node/app/api/dist
|
|
77
|
+
COPY --chown=node:node --from=api_build /home/node/app/api/db /home/node/app/api/db
|
|
78
|
+
COPY --chown=node:node --from=api_build /home/node/app/node_modules/.prisma /home/node/app/node_modules/.prisma
|
|
79
|
+
|
|
80
|
+
ENV NODE_ENV=production
|
|
81
|
+
|
|
82
|
+
CMD ["node_modules/.bin/cedarjs-server", "api"]
|
|
83
|
+
|
|
84
|
+
# web serve
|
|
85
|
+
# ---------
|
|
86
|
+
FROM node:24-bookworm-slim as web_serve
|
|
87
|
+
|
|
88
|
+
RUN npm install --global corepack
|
|
89
|
+
|
|
90
|
+
USER node
|
|
91
|
+
WORKDIR /home/node/app
|
|
92
|
+
|
|
93
|
+
COPY --chown=node:node cedar.toml* redwood.toml* ./
|
|
94
|
+
COPY --chown=node:node graphql.config.cjs .
|
|
95
|
+
COPY --chown=node:node .env.defaults .env.defaults
|
|
96
|
+
|
|
97
|
+
COPY --chown=node:node --from=deploy /home/node/app/dist/web /home/node/app
|
|
98
|
+
|
|
99
|
+
COPY --chown=node:node --from=web_build /home/node/app/web/dist /home/node/app/web/dist
|
|
100
|
+
|
|
101
|
+
ENV NODE_ENV=production \
|
|
102
|
+
API_PROXY_TARGET=http://api:8911
|
|
103
|
+
|
|
104
|
+
CMD node_modules/.bin/cedar-web-server --api-proxy-target $API_PROXY_TARGET
|
|
105
|
+
|
|
106
|
+
# console
|
|
107
|
+
# -------
|
|
108
|
+
FROM base as console
|
|
109
|
+
|
|
110
|
+
COPY --chown=node:node api api
|
|
111
|
+
COPY --chown=node:node web web
|
|
112
|
+
COPY --chown=node:node scripts scripts
|
|
@@ -94,12 +94,9 @@ ENV NODE_ENV=production
|
|
|
94
94
|
|
|
95
95
|
# default api serve command
|
|
96
96
|
# ---------
|
|
97
|
-
#
|
|
98
|
-
#
|
|
99
|
-
|
|
100
|
-
#
|
|
101
|
-
# CMD [ "./api/dist/server.js" ]
|
|
102
|
-
CMD [ "node_modules/.bin/cedarjs-server", "api" ]
|
|
97
|
+
# See https://cedarjs.com/docs/server-file for customizing the api server
|
|
98
|
+
# (Realtime, custom Fastify plugins, etc).
|
|
99
|
+
CMD ["node_modules/.bin/cedarjs-server", "api"]
|
|
103
100
|
|
|
104
101
|
# web serve
|
|
105
102
|
# ---------
|
|
@@ -132,7 +129,7 @@ ENV NODE_ENV=production \
|
|
|
132
129
|
API_PROXY_TARGET=http://api:8911
|
|
133
130
|
|
|
134
131
|
# We use the shell form here for variable expansion.
|
|
135
|
-
CMD
|
|
132
|
+
CMD node_modules/.bin/cedar-web-server --api-proxy-target $API_PROXY_TARGET
|
|
136
133
|
|
|
137
134
|
# console
|
|
138
135
|
# -------
|
|
@@ -4,7 +4,7 @@ services:
|
|
|
4
4
|
context: .
|
|
5
5
|
dockerfile: ./Dockerfile
|
|
6
6
|
target: base
|
|
7
|
-
command:
|
|
7
|
+
command: '{{DEV_CMD}}'
|
|
8
8
|
volumes:
|
|
9
9
|
- .:/home/node/app
|
|
10
10
|
- node_modules:/home/node/app/node_modules
|
|
@@ -18,7 +18,7 @@ services:
|
|
|
18
18
|
- SESSION_SECRET=super_secret_session_key_change_me_in_production_please
|
|
19
19
|
- CI=
|
|
20
20
|
- NODE_ENV=development
|
|
21
|
-
-
|
|
21
|
+
- CEDAR_API_HOST=0.0.0.0
|
|
22
22
|
|
|
23
23
|
db:
|
|
24
24
|
image: postgres:18-bookworm
|
|
@@ -36,7 +36,7 @@ services:
|
|
|
36
36
|
#
|
|
37
37
|
# ```
|
|
38
38
|
# docker compose -f ./docker-compose.dev.yml run --rm -it console /bin/bash
|
|
39
|
-
# root@...:/home/node/app#
|
|
39
|
+
# root@...:/home/node/app# {{CEDAR_CMD}} prisma migrate dev
|
|
40
40
|
# ```
|
|
41
41
|
console:
|
|
42
42
|
user: root
|
|
@@ -4,11 +4,8 @@ services:
|
|
|
4
4
|
context: .
|
|
5
5
|
dockerfile: ./Dockerfile
|
|
6
6
|
target: api_serve
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
# command to launch your server or update the Dockerfile to do so.
|
|
10
|
-
# This is important if you intend to configure GraphQL to use Realtime.
|
|
11
|
-
# command: "./api/dist/server.js"
|
|
7
|
+
# See https://cedarjs.com/docs/server-file for customizing the api
|
|
8
|
+
# server (Realtime, custom Fastify plugins, etc).
|
|
12
9
|
ports:
|
|
13
10
|
- '8911:8911'
|
|
14
11
|
depends_on:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { terminalLink } from "termi-link";
|
|
4
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
4
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
5
5
|
const command = "generator <name>";
|
|
6
6
|
const description = "Copies generator templates locally for customization";
|
|
7
7
|
const EXCLUDE_GENERATORS = ["dataMigration", "dbAuth", "generator", "secret"];
|