@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 execa from "execa";
|
|
2
1
|
import { Listr } from "listr2";
|
|
2
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
3
|
+
import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
4
|
+
import { addRootPackages } from "@cedarjs/cli-helpers/packageManager/packages";
|
|
3
5
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
4
|
-
import c from "../../lib/colors.js";
|
|
5
6
|
import { getPaths } from "../../lib/index.js";
|
|
6
7
|
import { command, description, EXPERIMENTAL_TOPIC_ID } from "./setupInngest.js";
|
|
7
8
|
import { printTaskEpilogue } from "./util.js";
|
|
@@ -10,18 +11,16 @@ const handler = async ({ force }) => {
|
|
|
10
11
|
{
|
|
11
12
|
title: `Adding Inngest setup packages for RedwoodJS ...`,
|
|
12
13
|
task: async () => {
|
|
13
|
-
await
|
|
14
|
-
cwd: getPaths().base
|
|
14
|
+
await addRootPackages(["inngest-setup-redwoodjs"], {
|
|
15
|
+
cwd: getPaths().base,
|
|
16
|
+
dev: true
|
|
15
17
|
});
|
|
16
18
|
}
|
|
17
19
|
},
|
|
18
20
|
{
|
|
19
21
|
task: async () => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
pluginCommands.push("--force");
|
|
23
|
-
}
|
|
24
|
-
await execa("yarn", [...pluginCommands], {
|
|
22
|
+
const pluginArgs = force ? ["--force"] : [];
|
|
23
|
+
await runBin("inngest-setup-redwoodjs", ["plugin", ...pluginArgs], {
|
|
25
24
|
stdout: "inherit",
|
|
26
25
|
cwd: getPaths().base
|
|
27
26
|
});
|
|
@@ -36,9 +35,11 @@ const handler = async ({ force }) => {
|
|
|
36
35
|
try {
|
|
37
36
|
await tasks.run();
|
|
38
37
|
} catch (e) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
process.
|
|
38
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
39
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
40
|
+
errorTelemetry(process.argv, message);
|
|
41
|
+
console.error(c.error(message));
|
|
42
|
+
process.exit(exitCode);
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
2
2
|
import { getEpilogue } from "./util.js";
|
|
3
3
|
const command = "setup-opentelemetry";
|
|
4
4
|
const description = "Setup OpenTelemetry within the API side";
|
|
5
|
-
const EXPERIMENTAL_TOPIC_ID = 4772;
|
|
5
|
+
const EXPERIMENTAL_TOPIC_ID = "4772";
|
|
6
6
|
const builder = (yargs) => {
|
|
7
7
|
yargs.option("force", {
|
|
8
8
|
alias: "f",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
|
|
4
|
-
import execa from "execa";
|
|
5
4
|
import { Listr } from "listr2";
|
|
6
|
-
import {
|
|
5
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
6
|
+
import { addApiPackages } from "@cedarjs/cli-helpers/installHelpers";
|
|
7
|
+
import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
7
8
|
import {
|
|
8
9
|
getConfigPath,
|
|
9
10
|
resolveFile,
|
|
10
11
|
getSchemaPath
|
|
11
12
|
} from "@cedarjs/project-config";
|
|
12
13
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
13
|
-
import c from "../../lib/colors.js";
|
|
14
14
|
import { getPaths, transformTSToJS, writeFile } from "../../lib/index.js";
|
|
15
15
|
import { isTypeScriptProject } from "../../lib/project.js";
|
|
16
16
|
import {
|
|
@@ -19,7 +19,10 @@ import {
|
|
|
19
19
|
EXPERIMENTAL_TOPIC_ID
|
|
20
20
|
} from "./setupOpentelemetry.js";
|
|
21
21
|
import { printTaskEpilogue } from "./util.js";
|
|
22
|
-
const handler = async ({
|
|
22
|
+
const handler = async ({
|
|
23
|
+
force,
|
|
24
|
+
verbose
|
|
25
|
+
}) => {
|
|
23
26
|
const ts = isTypeScriptProject();
|
|
24
27
|
const configTomlPath = getConfigPath();
|
|
25
28
|
const configFileName = path.basename(configTomlPath);
|
|
@@ -112,7 +115,7 @@ const handler = async ({ force, verbose }) => {
|
|
|
112
115
|
},
|
|
113
116
|
task: (_ctx, task) => {
|
|
114
117
|
task.output = [
|
|
115
|
-
"Please add the following to your '
|
|
118
|
+
"Please add the following to your 'cedarFastifyGraphQLServer' plugin options to enable OTel for your graphql",
|
|
116
119
|
"openTelemetryOptions: {",
|
|
117
120
|
" resolvers: true,",
|
|
118
121
|
" result: true,",
|
|
@@ -171,9 +174,8 @@ const handler = async ({ force, verbose }) => {
|
|
|
171
174
|
{
|
|
172
175
|
title: "Regenerate the Prisma client...",
|
|
173
176
|
task: (_ctx, _task) => {
|
|
174
|
-
return
|
|
177
|
+
return runBin("cedar", ["prisma", "generate"], {
|
|
175
178
|
stdio: "inherit",
|
|
176
|
-
shell: true,
|
|
177
179
|
cwd: getPaths().web.base
|
|
178
180
|
});
|
|
179
181
|
}
|
|
@@ -210,9 +212,11 @@ const handler = async ({ force, verbose }) => {
|
|
|
210
212
|
try {
|
|
211
213
|
await tasks.run();
|
|
212
214
|
} catch (e) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
process.
|
|
215
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
216
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
217
|
+
errorTelemetry(process.argv, message);
|
|
218
|
+
console.error(c.error(message));
|
|
219
|
+
process.exit(exitCode);
|
|
216
220
|
}
|
|
217
221
|
};
|
|
218
222
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
2
2
|
import { getEpilogue } from "./util.js";
|
|
3
3
|
const command = "setup-react-compiler";
|
|
4
4
|
const description = "Enable the experimental React Compiler";
|
|
5
|
-
const EXPERIMENTAL_TOPIC_ID = 7128;
|
|
5
|
+
const EXPERIMENTAL_TOPIC_ID = "7128";
|
|
6
6
|
const builder = (yargs) => {
|
|
7
7
|
yargs.option("force", {
|
|
8
8
|
alias: "f",
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import execa from "execa";
|
|
4
3
|
import { Listr } from "listr2";
|
|
5
|
-
import
|
|
4
|
+
import { coerce, isGreaterOrEqual } from "verkit";
|
|
5
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
6
|
+
import {
|
|
7
|
+
addRootPackages,
|
|
8
|
+
addWorkspacePackages
|
|
9
|
+
} from "@cedarjs/cli-helpers/packageManager/packages";
|
|
6
10
|
import { getConfigPath } from "@cedarjs/project-config";
|
|
7
11
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
8
|
-
import c from "../../lib/colors.js";
|
|
9
12
|
import { getPaths, writeFile } from "../../lib/index.js";
|
|
10
13
|
import {
|
|
11
14
|
command,
|
|
@@ -13,16 +16,16 @@ import {
|
|
|
13
16
|
EXPERIMENTAL_TOPIC_ID
|
|
14
17
|
} from "./setupReactCompiler.js";
|
|
15
18
|
import { printTaskEpilogue } from "./util.js";
|
|
16
|
-
const handler = async (
|
|
19
|
+
const handler = async (options) => {
|
|
17
20
|
const rwPaths = getPaths();
|
|
18
21
|
const configTomlPath = getConfigPath();
|
|
19
22
|
const configFileName = path.basename(configTomlPath);
|
|
20
23
|
const configContent = fs.readFileSync(configTomlPath, "utf-8");
|
|
21
|
-
|
|
22
|
-
[
|
|
24
|
+
function buildTaskData() {
|
|
25
|
+
return [
|
|
23
26
|
{
|
|
24
27
|
title: "Check prerequisites",
|
|
25
|
-
skip: force,
|
|
28
|
+
skip: options.force,
|
|
26
29
|
task: () => {
|
|
27
30
|
if (!rwPaths.web.entryClient || !rwPaths.web.viteConfig) {
|
|
28
31
|
throw new Error(
|
|
@@ -36,8 +39,8 @@ const handler = async ({ force, verbose }) => {
|
|
|
36
39
|
)
|
|
37
40
|
);
|
|
38
41
|
const reactVersion = webPkgJson["dependencies"]["react"];
|
|
39
|
-
const coercedReactVersion =
|
|
40
|
-
if (!
|
|
42
|
+
const coercedReactVersion = coerce(reactVersion);
|
|
43
|
+
if (!coercedReactVersion || !isGreaterOrEqual(coercedReactVersion, "19.0.0")) {
|
|
41
44
|
throw new Error(
|
|
42
45
|
"You need to be using at least React version 19 to enable the React Compiler"
|
|
43
46
|
);
|
|
@@ -59,7 +62,7 @@ const handler = async ({ force, verbose }) => {
|
|
|
59
62
|
}
|
|
60
63
|
);
|
|
61
64
|
} else {
|
|
62
|
-
if (force) {
|
|
65
|
+
if (options.force) {
|
|
63
66
|
task.output = `Overwriting config in ${configFileName}`;
|
|
64
67
|
writeFile(
|
|
65
68
|
configTomlPath,
|
|
@@ -79,29 +82,27 @@ const handler = async ({ force, verbose }) => {
|
|
|
79
82
|
);
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
|
-
}
|
|
83
|
-
rendererOptions: { persistentOutput: true }
|
|
85
|
+
}
|
|
84
86
|
},
|
|
85
|
-
// We are using two different
|
|
86
|
-
// workspaces - web and the
|
|
87
|
+
// We are using two different package manager commands here which is
|
|
88
|
+
// fine because they're operating on different workspaces - web and the
|
|
89
|
+
// root
|
|
87
90
|
{
|
|
88
91
|
title: "Installing eslint-plugin-react-compiler",
|
|
89
92
|
task: async () => {
|
|
90
|
-
await
|
|
91
|
-
cwd: getPaths().base
|
|
93
|
+
await addRootPackages(["eslint-plugin-react-compiler"], {
|
|
94
|
+
cwd: getPaths().base,
|
|
95
|
+
dev: true
|
|
92
96
|
});
|
|
93
97
|
}
|
|
94
98
|
},
|
|
95
99
|
{
|
|
96
100
|
title: "Installing babel-plugin-react-compiler",
|
|
97
101
|
task: async () => {
|
|
98
|
-
await
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
cwd: getPaths().base
|
|
103
|
-
}
|
|
104
|
-
);
|
|
102
|
+
await addWorkspacePackages("web", ["babel-plugin-react-compiler"], {
|
|
103
|
+
cwd: getPaths().base,
|
|
104
|
+
dev: true
|
|
105
|
+
});
|
|
105
106
|
}
|
|
106
107
|
},
|
|
107
108
|
{
|
|
@@ -109,18 +110,32 @@ const handler = async ({ force, verbose }) => {
|
|
|
109
110
|
printTaskEpilogue(command, description, EXPERIMENTAL_TOPIC_ID);
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
]
|
|
113
|
-
|
|
114
|
-
rendererOptions: { collapseSubtasks: false, persistentOutput: true },
|
|
115
|
-
renderer: verbose ? "verbose" : "default"
|
|
116
|
-
}
|
|
117
|
-
);
|
|
113
|
+
];
|
|
114
|
+
}
|
|
118
115
|
try {
|
|
119
|
-
|
|
116
|
+
if (options.verbose) {
|
|
117
|
+
await new Listr(buildTaskData(), {
|
|
118
|
+
exitOnError: true,
|
|
119
|
+
renderer: "verbose"
|
|
120
|
+
}).run();
|
|
121
|
+
} else {
|
|
122
|
+
await new Listr(
|
|
123
|
+
buildTaskData().map((t) => ({
|
|
124
|
+
...t,
|
|
125
|
+
rendererOptions: { persistentOutput: true }
|
|
126
|
+
})),
|
|
127
|
+
{
|
|
128
|
+
exitOnError: true,
|
|
129
|
+
rendererOptions: { collapseSubtasks: false }
|
|
130
|
+
}
|
|
131
|
+
).run();
|
|
132
|
+
}
|
|
120
133
|
} catch (e) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
process.
|
|
134
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
135
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
136
|
+
errorTelemetry(process.argv, message);
|
|
137
|
+
console.error(c.error(message));
|
|
138
|
+
process.exit(exitCode);
|
|
124
139
|
}
|
|
125
140
|
};
|
|
126
141
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
2
2
|
import { getEpilogue } from "./util.js";
|
|
3
3
|
const command = "setup-rsc";
|
|
4
4
|
const description = "Enable React Server Components (RSC)";
|
|
@@ -2,15 +2,20 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import execa from "execa";
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
|
-
import {
|
|
5
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
6
|
+
import { prettify } from "@cedarjs/cli-helpers/fileHelpers";
|
|
7
|
+
import { install } from "@cedarjs/cli-helpers/packageManager";
|
|
6
8
|
import { getConfig, getConfigPath } from "@cedarjs/project-config";
|
|
9
|
+
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
7
10
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
8
|
-
import c from "../../lib/colors.js";
|
|
9
11
|
import { getPaths, transformTSToJS, writeFile } from "../../lib/index.js";
|
|
10
12
|
import { isTypeScriptProject } from "../../lib/project.js";
|
|
11
13
|
import { command, description, EXPERIMENTAL_TOPIC_ID } from "./setupRsc.js";
|
|
12
14
|
import { printTaskEpilogue } from "./util.js";
|
|
13
|
-
const handler = async ({
|
|
15
|
+
const handler = async ({
|
|
16
|
+
force,
|
|
17
|
+
verbose
|
|
18
|
+
}) => {
|
|
14
19
|
const rwPaths = getPaths();
|
|
15
20
|
const configTomlPath = getConfigPath();
|
|
16
21
|
const configContent = fs.readFileSync(configTomlPath, "utf-8");
|
|
@@ -83,11 +88,9 @@ const handler = async ({ force, verbose }) => {
|
|
|
83
88
|
),
|
|
84
89
|
"utf-8"
|
|
85
90
|
);
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
);
|
|
90
|
-
writeFile(rwPaths.web.entryClient, entryClientContent, {
|
|
91
|
+
const entryClient = rwPaths.web.entryClient ?? "";
|
|
92
|
+
const entryClientContent = isTypeScriptProject() ? entryClientTemplate : await transformTSToJS(entryClient, entryClientTemplate);
|
|
93
|
+
writeFile(entryClient, entryClientContent, {
|
|
91
94
|
overwriteExisting: true
|
|
92
95
|
});
|
|
93
96
|
}
|
|
@@ -219,7 +222,7 @@ const handler = async ({ force, verbose }) => {
|
|
|
219
222
|
{
|
|
220
223
|
title: "Adding CSS files...",
|
|
221
224
|
task: async () => {
|
|
222
|
-
const
|
|
225
|
+
const cssFiles = [
|
|
223
226
|
{
|
|
224
227
|
template: "Counter.css.template",
|
|
225
228
|
path: ["components", "Counter", "Counter.css"]
|
|
@@ -241,7 +244,7 @@ const handler = async ({ force, verbose }) => {
|
|
|
241
244
|
path: ["pages", "AboutPage", "AboutPage.css"]
|
|
242
245
|
}
|
|
243
246
|
];
|
|
244
|
-
|
|
247
|
+
cssFiles.forEach((file) => {
|
|
245
248
|
const template = fs.readFileSync(
|
|
246
249
|
path.resolve(
|
|
247
250
|
import.meta.dirname,
|
|
@@ -379,9 +382,8 @@ const handler = async ({ force, verbose }) => {
|
|
|
379
382
|
overwriteExisting: true
|
|
380
383
|
}
|
|
381
384
|
);
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
});
|
|
385
|
+
const pm = getPackageManager();
|
|
386
|
+
await execa(pm, [install()], { cwd: getPaths().web.base });
|
|
385
387
|
}
|
|
386
388
|
},
|
|
387
389
|
{
|
|
@@ -398,9 +400,11 @@ const handler = async ({ force, verbose }) => {
|
|
|
398
400
|
try {
|
|
399
401
|
await tasks.run();
|
|
400
402
|
} catch (e) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
process.
|
|
403
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
404
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
405
|
+
errorTelemetry(process.argv, message);
|
|
406
|
+
console.error(c.error(message));
|
|
407
|
+
process.exit(exitCode);
|
|
404
408
|
}
|
|
405
409
|
};
|
|
406
410
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
2
2
|
import { getEpilogue } from "./util.js";
|
|
3
3
|
const command = "setup-streaming-ssr";
|
|
4
4
|
const description = "Enable React Streaming and Server Side Rendering (SSR)";
|
|
5
|
-
const EXPERIMENTAL_TOPIC_ID = 5052;
|
|
5
|
+
const EXPERIMENTAL_TOPIC_ID = "5052";
|
|
6
6
|
const builder = (yargs) => {
|
|
7
7
|
yargs.option("force", {
|
|
8
8
|
alias: "f",
|
|
@@ -2,10 +2,10 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
|
-
import {
|
|
5
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
6
|
+
import { addWebPackages } from "@cedarjs/cli-helpers/installHelpers";
|
|
6
7
|
import { getConfigPath } from "@cedarjs/project-config";
|
|
7
8
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
8
|
-
import c from "../../lib/colors.js";
|
|
9
9
|
import { getPaths, transformTSToJS, writeFile } from "../../lib/index.js";
|
|
10
10
|
import { isTypeScriptProject } from "../../lib/project.js";
|
|
11
11
|
import {
|
|
@@ -14,18 +14,18 @@ import {
|
|
|
14
14
|
EXPERIMENTAL_TOPIC_ID
|
|
15
15
|
} from "./setupStreamingSsr.js";
|
|
16
16
|
import { printTaskEpilogue } from "./util.js";
|
|
17
|
-
const handler = async (
|
|
18
|
-
const
|
|
17
|
+
const handler = async (options) => {
|
|
18
|
+
const cedarPaths = getPaths();
|
|
19
19
|
const configPath = getConfigPath();
|
|
20
20
|
const configContent = fs.readFileSync(configPath, "utf-8");
|
|
21
21
|
const ts = isTypeScriptProject();
|
|
22
|
-
const ext = path.extname(
|
|
23
|
-
|
|
24
|
-
[
|
|
22
|
+
const ext = path.extname(cedarPaths.web.entryClient || "");
|
|
23
|
+
function buildTaskData() {
|
|
24
|
+
return [
|
|
25
25
|
{
|
|
26
26
|
title: "Check prerequisites",
|
|
27
27
|
task: () => {
|
|
28
|
-
if (!
|
|
28
|
+
if (!cedarPaths.web.entryClient || !cedarPaths.web.viteConfig) {
|
|
29
29
|
throw new Error(
|
|
30
30
|
"Vite needs to be setup before you can enable Streaming SSR"
|
|
31
31
|
);
|
|
@@ -50,7 +50,7 @@ const handler = async ({ force, verbose }) => {
|
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
52
|
} else {
|
|
53
|
-
if (force) {
|
|
53
|
+
if (options.force) {
|
|
54
54
|
task.output = "Overwriting config in cedar.toml";
|
|
55
55
|
writeFile(
|
|
56
56
|
configPath,
|
|
@@ -76,8 +76,7 @@ const handler = async ({ force, verbose }) => {
|
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
}
|
|
80
|
-
rendererOptions: { persistentOutput: true }
|
|
79
|
+
}
|
|
81
80
|
},
|
|
82
81
|
{
|
|
83
82
|
title: `Adding entry.client${ext}...`,
|
|
@@ -91,10 +90,13 @@ const handler = async ({ force, verbose }) => {
|
|
|
91
90
|
),
|
|
92
91
|
"utf-8"
|
|
93
92
|
);
|
|
94
|
-
let entryClientPath =
|
|
93
|
+
let entryClientPath = cedarPaths.web.entryClient;
|
|
94
|
+
if (!entryClientPath) {
|
|
95
|
+
throw new Error("entryClient is not set");
|
|
96
|
+
}
|
|
95
97
|
const entryClientContent = ts ? entryClientTemplate : await transformTSToJS(entryClientPath, entryClientTemplate);
|
|
96
|
-
let overwriteExisting = force;
|
|
97
|
-
if (!force) {
|
|
98
|
+
let overwriteExisting = options.force;
|
|
99
|
+
if (!options.force) {
|
|
98
100
|
const prompt = task.prompt(ListrEnquirerPromptAdapter);
|
|
99
101
|
overwriteExisting = await prompt.run({
|
|
100
102
|
type: "Confirm",
|
|
@@ -107,8 +109,7 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
|
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
writeFile(entryClientPath, entryClientContent, { overwriteExisting });
|
|
110
|
-
}
|
|
111
|
-
rendererOptions: { persistentOutput: true }
|
|
112
|
+
}
|
|
112
113
|
},
|
|
113
114
|
{
|
|
114
115
|
title: `Adding entry.server${ext}...`,
|
|
@@ -123,12 +124,12 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
|
|
|
123
124
|
"utf-8"
|
|
124
125
|
);
|
|
125
126
|
const entryServerPath = path.join(
|
|
126
|
-
|
|
127
|
+
cedarPaths.web.src,
|
|
127
128
|
`entry.server${ext}`
|
|
128
129
|
);
|
|
129
130
|
const entryServerContent = ts ? entryServerTemplate : await transformTSToJS(entryServerPath, entryServerTemplate);
|
|
130
131
|
writeFile(entryServerPath, entryServerContent, {
|
|
131
|
-
overwriteExisting: force
|
|
132
|
+
overwriteExisting: options.force
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
135
|
},
|
|
@@ -144,10 +145,10 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
|
|
|
144
145
|
),
|
|
145
146
|
"utf-8"
|
|
146
147
|
);
|
|
147
|
-
const documentPath = path.join(
|
|
148
|
+
const documentPath = path.join(cedarPaths.web.src, `Document${ext}`);
|
|
148
149
|
const documentContent = ts ? documentTemplate : await transformTSToJS(documentPath, documentTemplate);
|
|
149
150
|
writeFile(documentPath, documentContent, {
|
|
150
|
-
overwriteExisting: force
|
|
151
|
+
overwriteExisting: options.force
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
},
|
|
@@ -164,18 +165,18 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
|
|
|
164
165
|
"utf-8"
|
|
165
166
|
);
|
|
166
167
|
const tsconfigPath = path.join(
|
|
167
|
-
|
|
168
|
+
cedarPaths.web.base,
|
|
168
169
|
ts ? "tsconfig.json" : "jsconfig.json"
|
|
169
170
|
);
|
|
170
171
|
writeFile(tsconfigPath, tsconfigTemplate, {
|
|
171
|
-
overwriteExisting: force
|
|
172
|
+
overwriteExisting: options.force
|
|
172
173
|
});
|
|
173
174
|
}
|
|
174
175
|
},
|
|
175
176
|
{
|
|
176
177
|
title: 'Adding resolution for "@apollo/client-react-streaming/superjson"',
|
|
177
178
|
task: () => {
|
|
178
|
-
const pkgJsonPath = path.join(
|
|
179
|
+
const pkgJsonPath = path.join(cedarPaths.base, "package.json");
|
|
179
180
|
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
180
181
|
const resolutions = pkgJson.resolutions || {};
|
|
181
182
|
resolutions["@apollo/client-react-streaming/superjson"] = "^1.12.2";
|
|
@@ -183,24 +184,38 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
|
|
|
183
184
|
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
184
185
|
}
|
|
185
186
|
},
|
|
186
|
-
addWebPackages(["@apollo/client-react-streaming@0.
|
|
187
|
+
addWebPackages(["@apollo/client-react-streaming@0.14.5"]),
|
|
187
188
|
{
|
|
188
189
|
task: () => {
|
|
189
190
|
printTaskEpilogue(command, description, EXPERIMENTAL_TOPIC_ID);
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
|
-
]
|
|
193
|
-
|
|
194
|
-
rendererOptions: { collapseSubtasks: false, persistentOutput: true },
|
|
195
|
-
renderer: verbose ? "verbose" : "default"
|
|
196
|
-
}
|
|
197
|
-
);
|
|
193
|
+
];
|
|
194
|
+
}
|
|
198
195
|
try {
|
|
199
|
-
|
|
196
|
+
if (options.verbose) {
|
|
197
|
+
await new Listr(buildTaskData(), {
|
|
198
|
+
exitOnError: true,
|
|
199
|
+
renderer: "verbose"
|
|
200
|
+
}).run();
|
|
201
|
+
} else {
|
|
202
|
+
await new Listr(
|
|
203
|
+
buildTaskData().map((t) => ({
|
|
204
|
+
...t,
|
|
205
|
+
rendererOptions: { persistentOutput: true }
|
|
206
|
+
})),
|
|
207
|
+
{
|
|
208
|
+
exitOnError: true,
|
|
209
|
+
rendererOptions: { collapseSubtasks: false }
|
|
210
|
+
}
|
|
211
|
+
).run();
|
|
212
|
+
}
|
|
200
213
|
} catch (e) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
process.
|
|
214
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
215
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
216
|
+
errorTelemetry(process.argv, message);
|
|
217
|
+
console.error(c.error(message));
|
|
218
|
+
process.exit(exitCode);
|
|
204
219
|
}
|
|
205
220
|
};
|
|
206
221
|
export {
|
|
@@ -24,11 +24,12 @@ const resource = Resource.default().merge(
|
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
const studioPort = getConfig().studio.basePort
|
|
27
|
+
const apiUrl = getConfig().web.apiUrl.replace(/\/$/, '')
|
|
27
28
|
const exporter = new OTLPTraceExporter({
|
|
28
29
|
// Update this URL to point to where your OTLP compatible collector is listening
|
|
29
30
|
// The redwood development studio (`yarn cedar exp studio`) can collect your
|
|
30
31
|
// telemetry at `http://127.0.0.1:<PORT>/v1/traces` (default PORT is 4318)
|
|
31
|
-
url: `http://127.0.0.1:${studioPort}
|
|
32
|
+
url: `http://127.0.0.1:${studioPort}${apiUrl}/otel-trace`,
|
|
32
33
|
concurrencyLimit: 64,
|
|
33
34
|
})
|
|
34
35
|
|
|
@@ -4,29 +4,29 @@ import App from './App'
|
|
|
4
4
|
import Routes from './Routes'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* When `#
|
|
7
|
+
* When `#cedar-app` isn't empty then it's very likely that you're using
|
|
8
8
|
* pre-rendering. So React attaches event listeners to the existing markup
|
|
9
9
|
* rather than replacing it.
|
|
10
10
|
* https://react.dev/reference/react-dom/client/hydrateRoot
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
12
|
+
const cedarAppElement = document.getElementById('cedar-app')
|
|
13
13
|
|
|
14
|
-
if (!
|
|
14
|
+
if (!cedarAppElement) {
|
|
15
15
|
throw new Error(
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
'Could not find an element with ID "cedar-app". Please ensure it exists ' +
|
|
17
|
+
'in your `web/index.html` file.'
|
|
18
18
|
)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
if (
|
|
21
|
+
if (cedarAppElement.children?.length > 0) {
|
|
22
22
|
hydrateRoot(
|
|
23
|
-
|
|
23
|
+
cedarAppElement,
|
|
24
24
|
<App>
|
|
25
25
|
<Routes />
|
|
26
26
|
</App>
|
|
27
27
|
)
|
|
28
28
|
} else {
|
|
29
|
-
const root = createRoot(
|
|
29
|
+
const root = createRoot(cedarAppElement)
|
|
30
30
|
root.render(
|
|
31
31
|
<App>
|
|
32
32
|
<Routes />
|