@cedarjs/cli 7.1.0-rc.34 → 7.1.1-next.468
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/build/buildHandler.js +2 -1
- package/dist/commands/build.js +1 -1
- package/dist/commands/check.js +2 -1
- package/dist/commands/deploy/baremetal/baremetalHandler.js +364 -73
- package/dist/commands/deploy/baremetal/monitors.js +66 -0
- package/dist/commands/deploy/baremetal.js +7 -1
- package/dist/commands/deploy/flightcontrolHandler.js +1 -1
- package/dist/commands/deploy/helpers/deployHandler.js +1 -1
- package/dist/commands/deploy/netlify.js +1 -1
- package/dist/commands/deploy/renderHandler.js +1 -1
- package/dist/commands/deploy/serverlessHandler.js +2 -1
- package/dist/commands/deploy/vercel.js +1 -1
- package/dist/commands/destroy/handlerHelpers.js +1 -1
- package/dist/commands/destroy/page/pageHandler.js +2 -1
- package/dist/commands/destroy/scaffold/scaffoldHandler.js +65 -26
- package/dist/commands/destroy/sdl/sdlHandler.js +2 -1
- package/dist/commands/dev/devHandler.js +3 -4
- package/dist/commands/dev/packageWatchCommands.js +8 -3
- package/dist/commands/dev.js +1 -1
- package/dist/commands/execHandler.js +2 -1
- package/dist/commands/experimental/live-queries/liveQueries.js +1 -1
- package/dist/commands/experimental/live-queries/liveQueriesHandler.js +3 -3
- package/dist/commands/experimental/setupInngest.js +1 -1
- package/dist/commands/experimental/setupInngestHandler.js +1 -1
- package/dist/commands/experimental/setupOpentelemetry.js +1 -1
- package/dist/commands/experimental/setupOpentelemetryHandler.js +2 -1
- package/dist/commands/experimental/setupReactCompiler.js +1 -1
- package/dist/commands/experimental/setupReactCompilerHandler.js +4 -4
- package/dist/commands/experimental/setupRsc.js +1 -1
- package/dist/commands/experimental/setupRscHandler.js +2 -1
- package/dist/commands/experimental/setupStreamingSsr.js +1 -1
- package/dist/commands/experimental/setupStreamingSsrHandler.js +3 -2
- package/dist/commands/generate/cell/cell.js +20 -0
- package/dist/commands/generate/cell/cellHandler.js +68 -20
- 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/dataMigration/dataMigration.js +2 -1
- package/dist/commands/generate/dbAuth/dbAuth.js +6 -2
- package/dist/commands/generate/dbAuth/dbAuthHandler.js +80 -17
- package/dist/commands/generate/dbAuth/templates/changePassword.tsx.template +131 -0
- package/dist/commands/generate/dbAuth/templates/login.oauth.tsx.template +164 -0
- package/dist/commands/generate/dbAuth/templates/login.webAuthn.tsx.template +20 -12
- package/dist/commands/generate/dbAuth/templates/signup.oauth.tsx.template +147 -0
- package/dist/commands/generate/directive/directiveHandler.js +2 -1
- package/dist/commands/generate/function/functionHandler.js +2 -1
- package/dist/commands/generate/helpers.js +26 -0
- package/dist/commands/generate/job/jobHandler.js +2 -1
- package/dist/commands/generate/model/modelHandler.js +2 -1
- package/dist/commands/generate/ogImage/ogImageHandler.js +2 -1
- package/dist/commands/generate/ogImage/templates/ogImage.og.tsx.template +1 -1
- package/dist/commands/generate/package/filesTask.js +9 -12
- package/dist/commands/generate/package/packageHandler.js +3 -4
- package/dist/commands/generate/package/templates/tsconfig.json.template +1 -0
- package/dist/commands/generate/page/pageHandler.js +2 -1
- package/dist/commands/generate/realtime/realtime.js +1 -1
- package/dist/commands/generate/realtime/realtimeHandler.js +2 -9
- package/dist/commands/generate/realtime/templates/liveQueries/blank/blank.service.ts.template +12 -4
- package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.service.ts.template +2 -2
- package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.ts.template +4 -4
- package/dist/commands/generate/scaffold/scaffold.js +1 -1
- package/dist/commands/generate/scaffold/scaffoldHandler.js +93 -49
- package/dist/commands/generate/scaffold/templates/assets/scaffold.tailwind.css.template +12 -7
- package/dist/commands/generate/scaffold/templates/components/EditNameCell.tsx.template +5 -7
- package/dist/commands/generate/scaffold/templates/components/NameForm.tsx.template +10 -9
- package/dist/commands/generate/scaffold/templates/layouts/NamesScaffoldLayout.tsx.template +18 -0
- package/dist/commands/generate/scaffold/templates/lib/formatters.test.tsx.template +11 -0
- package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +16 -4
- package/dist/commands/generate/script/scriptHandler.js +2 -1
- package/dist/commands/generate/script/templates/tsconfig.json.template +1 -0
- package/dist/commands/generate/sdl/sdlHandler.js +10 -4
- package/dist/commands/generate/secret/secret.js +1 -1
- package/dist/commands/generate/service/serviceHandler.js +79 -49
- package/dist/commands/generate/service/templates/service.ts.template +40 -13
- package/dist/commands/generate/service/templates/test.ts.template +8 -6
- package/dist/commands/generate/yargsCommandHelpers.js +1 -1
- package/dist/commands/generate/yargsHandlerHelpers.js +2 -1
- package/dist/commands/generate.js +1 -1
- package/dist/commands/info.js +1 -1
- package/dist/commands/jobsHandler.js +5 -3
- package/dist/commands/lint.js +1 -1
- package/dist/commands/prerenderHandler.js +11 -4
- package/dist/commands/prismaHandler.js +7 -2
- package/dist/commands/record/init.js +1 -1
- package/dist/commands/serve.js +2 -1
- package/dist/commands/setup/auth/auth.js +2 -4
- package/dist/commands/setup/cache/cache.js +1 -1
- package/dist/commands/setup/cache/cacheHandler.js +2 -1
- package/dist/commands/setup/cache/templates/memcached.ts.template +14 -17
- package/dist/commands/setup/cache/templates/redis.ts.template +12 -20
- package/dist/commands/setup/database/postgres.js +1 -1
- package/dist/commands/setup/database/postgresHandler.js +3 -1
- package/dist/commands/setup/deploy/providers/baremetal.js +7 -0
- package/dist/commands/setup/deploy/providers/baremetalHandler.js +130 -21
- package/dist/commands/setup/deploy/providers/coherence.js +1 -1
- package/dist/commands/setup/deploy/providers/coherenceHandler.js +7 -6
- package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +2 -1
- package/dist/commands/setup/deploy/providers/netlifyHandler.js +2 -1
- package/dist/commands/setup/deploy/providers/renderHandler.js +2 -1
- package/dist/commands/setup/deploy/providers/serverlessHandler.js +2 -1
- package/dist/commands/setup/deploy/providers/universalDeployHandler.js +4 -6
- package/dist/commands/setup/deploy/providers/vercelHandler.js +2 -1
- package/dist/commands/setup/deploy/templates/baremetal.js +119 -9
- package/dist/commands/setup/deploy/templates/netlifyUD.js +3 -0
- package/dist/commands/setup/docker/docker.js +1 -1
- package/dist/commands/setup/docker/dockerHandler.js +2 -1
- package/dist/commands/setup/generator/generator.js +1 -1
- package/dist/commands/setup/generator/generatorHandler.js +1 -1
- package/dist/commands/setup/graphql/features/fragments/fragments.js +1 -1
- package/dist/commands/setup/graphql/features/fragments/fragmentsHandler.js +3 -5
- package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocuments.js +1 -1
- package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocumentsHandler.js +2 -1
- package/dist/commands/setup/i18n/i18n.js +1 -1
- package/dist/commands/setup/i18n/i18nHandler.js +1 -1
- package/dist/commands/setup/jobs/jobs.js +1 -1
- package/dist/commands/setup/jobs/jobsHandler.js +4 -1
- package/dist/commands/setup/mailer/mailer.js +1 -1
- package/dist/commands/setup/mailer/mailerHandler.js +2 -1
- 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 +13 -9
- package/dist/commands/setup/monitoring/sentry/templates/sentryApi.ts.template +1 -4
- package/dist/commands/setup/monitoring/sentry/templates/sentryWeb.ts.template +7 -4
- package/dist/commands/setup/neon/neon.js +1 -1
- package/dist/commands/setup/neon/neonHandler.js +5 -9
- package/dist/commands/setup/package/package.js +1 -1
- package/dist/commands/setup/package/packageHandler.js +4 -4
- 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 +4 -16
- package/dist/commands/setup/realtime/templates/defer/fastAndSlowFields/fastAndSlowFields.ts.template +4 -1
- package/dist/commands/setup/realtime/templates/liveQueries/auctions/auctions.ts.template +12 -4
- package/dist/commands/setup/realtime/templates/subscriptions/countdown/countdown.ts.template +1 -1
- package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +2 -2
- package/dist/commands/setup/server-file/serverFile.js +1 -1
- package/dist/commands/setup/server-file/serverFileHandler.js +2 -1
- 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 +154 -0
- package/dist/commands/setup/tenancy/templates/InvitePage.tsx.template +72 -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 +57 -0
- package/dist/commands/setup/tenancy/templates/organizations.sdl.ts.template +89 -0
- package/dist/commands/setup/tenancy/templates/organizations.test.ts.template +381 -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/libraries/chakra-uiHandler.js +2 -1
- package/dist/commands/setup/ui/libraries/mantineHandler.js +2 -1
- package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +63 -82
- package/dist/commands/setup/uploads/gitignore.js +17 -0
- package/dist/commands/setup/uploads/schemaPrisma.js +41 -0
- package/dist/commands/setup/uploads/serverFile.js +217 -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 +98 -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 +277 -69
- package/dist/commands/setup.js +2 -1
- package/dist/commands/studio.js +1 -1
- package/dist/commands/test/testHandler.js +25 -71
- package/dist/commands/test/viteVersionCheck.js +75 -0
- package/dist/commands/test.js +10 -18
- package/dist/commands/type-checkHandler.js +1 -1
- package/dist/commands/upgrade/preUpgradeScripts.js +3 -3
- package/dist/commands/upgrade/upgrade.js +1 -1
- package/dist/commands/upgrade/upgradeHandler.js +2 -1
- package/dist/index.js +5 -8
- package/dist/lib/exit.js +1 -1
- package/dist/lib/index.js +16 -31
- package/dist/lib/loadEnvFiles.js +1 -1
- package/dist/lib/plugin.js +1 -1
- package/dist/lib/test.js +1 -1
- package/dist/lib/updateCheck.js +4 -4
- package/dist/middleware/checkNodeVersion.js +4 -4
- package/package.json +27 -27
- package/dist/commands/setup/ui/templates/postcss.config.cjs.template +0 -9
- package/dist/commands/setup/uploads/dbCodemod.js +0 -28
- package/dist/commands/setup/uploads/templates/signedUrl.ts.template +0 -21
- package/dist/commands/test/testHandlerEsm.js +0 -109
- package/dist/commands/testEsm.js +0 -41
|
@@ -2,45 +2,144 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
4
|
import prompts from "prompts";
|
|
5
|
-
import {
|
|
5
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
6
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
6
7
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
7
8
|
import {
|
|
8
9
|
addPackagesTask,
|
|
9
10
|
getPaths,
|
|
10
11
|
printSetupNotes
|
|
11
12
|
} from "../../../../lib/index.js";
|
|
13
|
+
import { MONITORS, isMonitor } from "../../../deploy/baremetal/monitors.js";
|
|
12
14
|
import { addFilesTask } from "../helpers/index.js";
|
|
13
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
MAINTENANCE,
|
|
17
|
+
SYSTEMD_DIR,
|
|
18
|
+
deployToml,
|
|
19
|
+
ecosystemConfig,
|
|
20
|
+
systemdJobsUnit,
|
|
21
|
+
systemdServiceUnit
|
|
22
|
+
} from "../templates/baremetal.js";
|
|
14
23
|
const configFilename = "deploy.toml";
|
|
15
|
-
const
|
|
24
|
+
const MONITOR_CHOICES = [
|
|
16
25
|
{
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
title: "pm2",
|
|
27
|
+
description: "Node process manager, configured in ecosystem.config.js",
|
|
28
|
+
value: "pm2"
|
|
19
29
|
},
|
|
20
30
|
{
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
title: "systemd (user units)",
|
|
32
|
+
description: "Units in ~/.config/systemd/user, managed by the deploy user without sudo",
|
|
33
|
+
value: "systemd-user"
|
|
23
34
|
},
|
|
24
35
|
{
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
title: "systemd (system units)",
|
|
37
|
+
description: "Units in /etc/systemd/system, managed with sudo systemctl",
|
|
38
|
+
value: "systemd-system"
|
|
27
39
|
}
|
|
28
40
|
];
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
""
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
const appNameFromPath = (projectPath) => {
|
|
42
|
+
const name = path.basename(projectPath).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
43
|
+
return name || "cedar";
|
|
44
|
+
};
|
|
45
|
+
const setupFiles = ({
|
|
46
|
+
monitor,
|
|
47
|
+
jobs,
|
|
48
|
+
appName,
|
|
49
|
+
basePath,
|
|
50
|
+
webSrcPath
|
|
51
|
+
}) => {
|
|
52
|
+
const files = [];
|
|
53
|
+
let processNames;
|
|
54
|
+
if (monitor === "pm2") {
|
|
55
|
+
processNames = jobs ? ["serve", "jobs"] : ["serve"];
|
|
56
|
+
files.push({
|
|
57
|
+
path: path.join(basePath, "ecosystem.config.js"),
|
|
58
|
+
content: ecosystemConfig({ jobs })
|
|
59
|
+
});
|
|
60
|
+
} else {
|
|
61
|
+
const jobsUnit = `${appName}-jobs`;
|
|
62
|
+
processNames = jobs ? [appName, `${jobsUnit}@0`] : [appName];
|
|
63
|
+
files.push({
|
|
64
|
+
path: path.join(basePath, SYSTEMD_DIR, `${appName}.service`),
|
|
65
|
+
content: systemdServiceUnit({ appName, monitor })
|
|
66
|
+
});
|
|
67
|
+
if (jobs) {
|
|
68
|
+
files.push({
|
|
69
|
+
path: path.join(basePath, SYSTEMD_DIR, `${jobsUnit}@.service`),
|
|
70
|
+
content: systemdJobsUnit({ appName, monitor })
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
files.unshift({
|
|
75
|
+
path: path.join(basePath, configFilename),
|
|
76
|
+
content: deployToml({ monitor, processNames })
|
|
77
|
+
});
|
|
78
|
+
files.push({
|
|
79
|
+
path: path.join(webSrcPath, "maintenance.html"),
|
|
80
|
+
content: MAINTENANCE
|
|
81
|
+
});
|
|
82
|
+
return { files, processNames };
|
|
83
|
+
};
|
|
84
|
+
const notesFor = (monitor, jobs, processNames) => {
|
|
85
|
+
const notes = ["You are almost ready to go BAREMETAL!", ""];
|
|
86
|
+
if (monitor !== "pm2") {
|
|
87
|
+
notes.push(
|
|
88
|
+
`Copy the unit files in ${SYSTEMD_DIR}/ to the server before your first`,
|
|
89
|
+
"deploy. The comments at the top of each file say where they go.",
|
|
90
|
+
""
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
if (jobs) {
|
|
94
|
+
notes.push(
|
|
95
|
+
`Background jobs are set up, so deploy.toml lists a jobs worker process`,
|
|
96
|
+
`(${processNames[processNames.length - 1]}). Add one per entry in the`,
|
|
97
|
+
"`workers` array of api/src/lib/jobs.ts.",
|
|
98
|
+
""
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
notes.push(
|
|
102
|
+
"See https://cedarjs.com/docs/deploy/baremetal for the remaining",
|
|
103
|
+
"config and setup required before you can perform your first deploy."
|
|
104
|
+
);
|
|
105
|
+
return notes;
|
|
106
|
+
};
|
|
107
|
+
const promptForMonitor = async () => {
|
|
108
|
+
const { monitor } = await prompts({
|
|
109
|
+
type: "select",
|
|
110
|
+
name: "monitor",
|
|
111
|
+
message: "Which process monitor will run your app on the server?",
|
|
112
|
+
choices: MONITOR_CHOICES
|
|
113
|
+
});
|
|
114
|
+
return isMonitor(monitor) ? monitor : void 0;
|
|
115
|
+
};
|
|
116
|
+
const handler = async ({
|
|
117
|
+
force,
|
|
118
|
+
monitor: monitorOption
|
|
119
|
+
}) => {
|
|
36
120
|
recordTelemetryAttributes({
|
|
37
121
|
command: "setup deploy baremetal",
|
|
38
|
-
force
|
|
122
|
+
force,
|
|
123
|
+
monitor: monitorOption
|
|
39
124
|
});
|
|
40
|
-
if (
|
|
125
|
+
if (monitorOption !== void 0 && !isMonitor(monitorOption)) {
|
|
126
|
+
console.error(
|
|
127
|
+
c.error(
|
|
128
|
+
`Unknown monitor "${monitorOption}". Use one of ${MONITORS.join(", ")}.`
|
|
129
|
+
)
|
|
130
|
+
);
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
const monitor = monitorOption ?? await promptForMonitor();
|
|
134
|
+
if (!monitor) {
|
|
135
|
+
console.log("Aborting baremetal setup.");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const paths = getPaths();
|
|
139
|
+
if (fs.existsSync(path.join(paths.base, ".pnp.cjs"))) {
|
|
41
140
|
console.warn(
|
|
42
141
|
c.warning(
|
|
43
|
-
"Your project uses Yarn PnP (Plug'n'Play), which is not officially supported for Baremetal deployments. The generated
|
|
142
|
+
"Your project uses Yarn PnP (Plug'n'Play), which is not officially supported for Baremetal deployments. The generated process config starts the app with node_modules/.bin/cedar, which will most likely not work under PnP.\n\nYou will need to manually configure the server. See also the packageManagerCommand field in deploy.toml."
|
|
44
143
|
)
|
|
45
144
|
);
|
|
46
145
|
console.log();
|
|
@@ -55,6 +154,14 @@ const handler = async ({ force }) => {
|
|
|
55
154
|
}
|
|
56
155
|
console.log();
|
|
57
156
|
}
|
|
157
|
+
const jobs = Boolean(paths.api.jobsConfig);
|
|
158
|
+
const { files, processNames } = setupFiles({
|
|
159
|
+
monitor,
|
|
160
|
+
jobs,
|
|
161
|
+
appName: appNameFromPath(paths.base),
|
|
162
|
+
basePath: paths.base,
|
|
163
|
+
webSrcPath: paths.web.src
|
|
164
|
+
});
|
|
58
165
|
const tasks = new Listr(
|
|
59
166
|
[
|
|
60
167
|
await addPackagesTask({
|
|
@@ -65,7 +172,7 @@ const handler = async ({ force }) => {
|
|
|
65
172
|
files,
|
|
66
173
|
force
|
|
67
174
|
}),
|
|
68
|
-
printSetupNotes(
|
|
175
|
+
printSetupNotes(notesFor(monitor, jobs, processNames))
|
|
69
176
|
],
|
|
70
177
|
{ rendererOptions: { collapseSubtasks: false } }
|
|
71
178
|
);
|
|
@@ -80,6 +187,8 @@ const handler = async ({ force }) => {
|
|
|
80
187
|
}
|
|
81
188
|
};
|
|
82
189
|
export {
|
|
190
|
+
appNameFromPath,
|
|
83
191
|
configFilename,
|
|
84
|
-
handler
|
|
192
|
+
handler,
|
|
193
|
+
setupFiles
|
|
85
194
|
};
|
|
@@ -3,16 +3,17 @@ import path from "path";
|
|
|
3
3
|
import prismaInternals from "@prisma/internals";
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
5
|
import * as toml from "smol-toml";
|
|
6
|
-
import {
|
|
7
|
-
colors as c,
|
|
8
|
-
isTypeScriptProject,
|
|
9
|
-
getConfigPath
|
|
10
|
-
} from "@cedarjs/cli-helpers";
|
|
6
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
11
7
|
import {
|
|
12
8
|
formatCedarCommand,
|
|
13
9
|
formatRunBinCommand
|
|
14
10
|
} from "@cedarjs/cli-helpers/packageManager/display";
|
|
15
|
-
import {
|
|
11
|
+
import { isTypeScriptProject } from "@cedarjs/cli-helpers/project";
|
|
12
|
+
import {
|
|
13
|
+
getConfigPath,
|
|
14
|
+
getPaths,
|
|
15
|
+
getPrismaSchemas
|
|
16
|
+
} from "@cedarjs/project-config";
|
|
16
17
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
17
18
|
import { printSetupNotes } from "../../../../lib/index.js";
|
|
18
19
|
import { serverFileExists } from "../../../../lib/project.js";
|
|
@@ -3,8 +3,9 @@ import { EOL } from "os";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import prismaInternals from "@prisma/internals";
|
|
5
5
|
import { Listr } from "listr2";
|
|
6
|
-
import {
|
|
6
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
7
7
|
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
8
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
8
9
|
import { getPaths, getPrismaSchemas } from "@cedarjs/project-config";
|
|
9
10
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
10
11
|
import { writeFilesTask, printSetupNotes } from "../../../../lib/index.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
|
-
import {
|
|
4
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
5
5
|
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
6
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
6
7
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
7
8
|
import {
|
|
8
9
|
addPackagesTask,
|
|
@@ -2,7 +2,8 @@ import path from "path";
|
|
|
2
2
|
import prismaInternals from "@prisma/internals";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
4
|
import prompts from "prompts";
|
|
5
|
-
import {
|
|
5
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
6
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
6
7
|
import { getPaths, getPrismaSchemas } from "@cedarjs/project-config";
|
|
7
8
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
8
9
|
import { writeFilesTask, printSetupNotes } from "../../../../lib/index.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
|
-
import {
|
|
4
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
5
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
5
6
|
import { getSchemaPath, getConfigPath } from "@cedarjs/project-config";
|
|
6
7
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
7
8
|
import {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
recordTelemetryAttributes
|
|
9
|
-
} from "@cedarjs/cli-helpers";
|
|
4
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
5
|
+
import { getPaths } from "@cedarjs/cli-helpers/paths";
|
|
6
|
+
import { isTypeScriptProject } from "@cedarjs/cli-helpers/project";
|
|
7
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
10
8
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
11
9
|
import { printSetupNotes } from "../../../../lib/index.js";
|
|
12
10
|
const notes = [
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
|
-
import {
|
|
4
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
5
5
|
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
6
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
6
7
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
7
8
|
import {
|
|
8
9
|
addPackagesTask,
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
2
|
-
const
|
|
2
|
+
const SYSTEMD_DIR = "systemd";
|
|
3
|
+
const JOBS_WORKER_BIN = "api/node_modules/.bin/cedar-jobs-worker";
|
|
4
|
+
const WORKER_STOP_TIMEOUT_SECONDS = 600;
|
|
5
|
+
const JOBS_WORKER_COMMENT = `# Runs one background jobs worker. \`--index\` picks the entry of the \`workers\`
|
|
6
|
+
# array in api/src/lib/jobs.ts and \`--id\` numbers the worker within that
|
|
7
|
+
# entry, so an entry with \`count: 2\` needs a second worker with \`--id=1\`.`;
|
|
8
|
+
const ecosystemConfig = ({ jobs }) => {
|
|
9
|
+
const jobsApp = jobs ? `
|
|
10
|
+
{
|
|
11
|
+
// Runs one background jobs worker. \`--index\` picks the entry of the
|
|
12
|
+
// \`workers\` array in api/src/lib/jobs.ts and \`--id\` numbers the worker
|
|
13
|
+
// within that entry, so an entry with \`count: 2\` needs a second app
|
|
14
|
+
// with \`--id=1\`.
|
|
15
|
+
name: 'jobs',
|
|
16
|
+
cwd: 'current',
|
|
17
|
+
script: '${JOBS_WORKER_BIN}',
|
|
18
|
+
args: '--index=0 --id=0',
|
|
19
|
+
// pm2 stops the worker with SIGINT, which lets it finish the job it is
|
|
20
|
+
// running. This is how long pm2 waits for that (in ms) before killing it.
|
|
21
|
+
kill_timeout: ${WORKER_STOP_TIMEOUT_SECONDS * 1e3},
|
|
22
|
+
},` : "";
|
|
23
|
+
return `module.exports = {
|
|
3
24
|
apps: [
|
|
4
25
|
{
|
|
5
26
|
name: 'serve',
|
|
@@ -10,10 +31,79 @@ const ECOSYSTEM = `module.exports = {
|
|
|
10
31
|
exec_mode: 'cluster',
|
|
11
32
|
wait_ready: true,
|
|
12
33
|
listen_timeout: 10000,
|
|
13
|
-
}
|
|
34
|
+
},${jobsApp}
|
|
14
35
|
],
|
|
15
|
-
}
|
|
16
|
-
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
const unitHeader = (appName, monitor) => {
|
|
40
|
+
const install = monitor === "systemd-system" ? `# sudo cp ${SYSTEMD_DIR}/*.service /etc/systemd/system/` : `# mkdir -p ~/.config/systemd/user && cp ${SYSTEMD_DIR}/*.service ~/.config/systemd/user/`;
|
|
41
|
+
const linger = monitor === "systemd-system" ? "" : `#
|
|
42
|
+
# User units only run while the user has a session, so let them run after a
|
|
43
|
+
# reboot too:
|
|
44
|
+
# sudo loginctl enable-linger $(whoami)
|
|
45
|
+
`;
|
|
46
|
+
return `# systemd unit for the ${appName} Cedar app, generated by \`cedar setup deploy baremetal\`.
|
|
47
|
+
#
|
|
48
|
+
# Copy the unit files to the server once, before the first deploy:
|
|
49
|
+
${install}
|
|
50
|
+
${linger}#
|
|
51
|
+
# Then deploy with \`--first-run\`, which reloads the unit files and enables and
|
|
52
|
+
# starts every process listed in deploy.toml.
|
|
53
|
+
#
|
|
54
|
+
# WorkingDirectory must be the \`path\` from deploy.toml followed by \`/current\`.`;
|
|
55
|
+
};
|
|
56
|
+
const unitService = (monitor, execStart, extraDirectives = "") => {
|
|
57
|
+
const user = monitor === "systemd-system" ? "\nUser=deploy" : "";
|
|
58
|
+
return `[Service]
|
|
59
|
+
WorkingDirectory=/var/www/app/current
|
|
60
|
+
# A login shell puts node and ${getPackageManager()} from a version manager such as nvm on the PATH
|
|
61
|
+
ExecStart=/bin/bash -lc '${execStart}'
|
|
62
|
+
Restart=always
|
|
63
|
+
RestartSec=5
|
|
64
|
+
Environment=NODE_ENV=production${user}${extraDirectives}`;
|
|
65
|
+
};
|
|
66
|
+
const JOBS_STOP_DIRECTIVES = `
|
|
67
|
+
# Stopping sends SIGINT so the worker finishes the job it is running before it
|
|
68
|
+
# exits. systemd waits this long for that before killing the worker.
|
|
69
|
+
KillSignal=SIGINT
|
|
70
|
+
TimeoutStopSec=${WORKER_STOP_TIMEOUT_SECONDS}`;
|
|
71
|
+
const unitInstall = (monitor) => `[Install]
|
|
72
|
+
WantedBy=${monitor === "systemd-system" ? "multi-user.target" : "default.target"}`;
|
|
73
|
+
const systemdServiceUnit = ({
|
|
74
|
+
appName,
|
|
75
|
+
monitor
|
|
76
|
+
}) => `${unitHeader(appName, monitor)}
|
|
77
|
+
|
|
78
|
+
[Unit]
|
|
79
|
+
Description=${appName} (Cedar)
|
|
80
|
+
After=network.target
|
|
81
|
+
|
|
82
|
+
${unitService(monitor, "exec node_modules/.bin/cedar serve")}
|
|
83
|
+
|
|
84
|
+
${unitInstall(monitor)}
|
|
85
|
+
`;
|
|
86
|
+
const systemdJobsUnit = ({
|
|
87
|
+
appName,
|
|
88
|
+
monitor
|
|
89
|
+
}) => `${unitHeader(appName, monitor)}
|
|
90
|
+
#
|
|
91
|
+
${JOBS_WORKER_COMMENT}
|
|
92
|
+
# Start one instance per \`workers\` entry: \`${appName}-jobs@0\`, \`${appName}-jobs@1\`
|
|
93
|
+
# and so on, and list each one in \`processNames\` in deploy.toml.
|
|
94
|
+
|
|
95
|
+
[Unit]
|
|
96
|
+
Description=${appName} background jobs worker %i (Cedar)
|
|
97
|
+
After=network.target
|
|
98
|
+
|
|
99
|
+
${unitService(monitor, `exec ${JOBS_WORKER_BIN} --index=%i --id=0`, JOBS_STOP_DIRECTIVES)}
|
|
100
|
+
|
|
101
|
+
${unitInstall(monitor)}
|
|
102
|
+
`;
|
|
103
|
+
const deployToml = ({
|
|
104
|
+
monitor,
|
|
105
|
+
processNames
|
|
106
|
+
}) => `# This file contains config for a baremetal deployment
|
|
17
107
|
#
|
|
18
108
|
# SSH connection options include:
|
|
19
109
|
#
|
|
@@ -26,6 +116,22 @@ const DEPLOY = `# This file contains config for a baremetal deployment
|
|
|
26
116
|
# * passphrase - used if your private key has a passphrase
|
|
27
117
|
# * agentForward - set to \`true\` to forward the client machine's ssh credentials
|
|
28
118
|
#
|
|
119
|
+
# Process monitor options:
|
|
120
|
+
#
|
|
121
|
+
# * monitor - "pm2", "systemd-user" or "systemd-system". Decides how processes
|
|
122
|
+
# are started for the first time, restarted and stopped
|
|
123
|
+
# * monitorCommand - overrides the command the monitor is invoked with. Defaults
|
|
124
|
+
# to \`pm2\`, \`systemctl --user\` or \`sudo systemctl\` depending on \`monitor\`,
|
|
125
|
+
# for example \`doppler run -- pm2\`
|
|
126
|
+
# * processNames - the pm2 app names or systemd unit names to (re)start
|
|
127
|
+
#
|
|
128
|
+
# After restarting the processes, the deploy requests the api side's health
|
|
129
|
+
# check endpoint on the server and fails if it doesn't respond in time:
|
|
130
|
+
#
|
|
131
|
+
# * healthCheckUrl - defaults to http://localhost:<[api].port>/graphql/health
|
|
132
|
+
# on servers that host the api side. Set to \`false\` to skip the check
|
|
133
|
+
# * healthCheckTimeout - seconds to keep retrying, defaults to 30
|
|
134
|
+
#
|
|
29
135
|
# See https://cedarjs.com/docs/deploy/baremetal for more info
|
|
30
136
|
|
|
31
137
|
[[production.servers]]
|
|
@@ -34,13 +140,14 @@ username = "user"
|
|
|
34
140
|
agentForward = true
|
|
35
141
|
sides = ["api","web"]
|
|
36
142
|
packageManagerCommand = "${getPackageManager()}"
|
|
37
|
-
|
|
143
|
+
monitor = "${monitor}"
|
|
38
144
|
path = "/var/www/app"
|
|
39
|
-
processNames = ["
|
|
145
|
+
processNames = [${processNames.map((name) => `"${name}"`).join(", ")}]
|
|
40
146
|
repo = "git@github.com:myorg/myapp.git"
|
|
41
147
|
branch = "main"
|
|
42
148
|
keepReleases = 5
|
|
43
149
|
freeSpaceRequired = 2048
|
|
150
|
+
healthCheckTimeout = 30
|
|
44
151
|
|
|
45
152
|
# If you have separate api and web servers:
|
|
46
153
|
#
|
|
@@ -123,7 +230,10 @@ And take it back down with:
|
|
|
123
230
|
</html>
|
|
124
231
|
`;
|
|
125
232
|
export {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
233
|
+
MAINTENANCE,
|
|
234
|
+
SYSTEMD_DIR,
|
|
235
|
+
deployToml,
|
|
236
|
+
ecosystemConfig,
|
|
237
|
+
systemdJobsUnit,
|
|
238
|
+
systemdServiceUnit
|
|
129
239
|
};
|
|
@@ -10,6 +10,9 @@ NODE_VERSION = "24"
|
|
|
10
10
|
|
|
11
11
|
[functions]
|
|
12
12
|
directory = "api/dist/ud"
|
|
13
|
+
# Sandboxed child scripts (\`@cedarjs/api/sandbox\`) and the packages they
|
|
14
|
+
# import. Nothing imports them, so Netlify's file tracing can't find them
|
|
15
|
+
included_files = ["api/dist/ud/sandbox-children/**"]
|
|
13
16
|
|
|
14
17
|
# To use Netlify Dev, install Netlify's CLI (\`netlify-cli\`) from NPM and use
|
|
15
18
|
# \`netlify link\` to connect your local project to a site on Netlify. Then run
|
|
@@ -3,7 +3,8 @@ 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";
|
|
7
8
|
import { dedupe } from "@cedarjs/cli-helpers/packageManager";
|
|
8
9
|
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
9
10
|
import { addWorkspacePackages } from "@cedarjs/cli-helpers/packageManager/packages";
|
|
@@ -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"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
|
-
import { colors as c } from "@cedarjs/cli-helpers";
|
|
4
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
5
5
|
import { getPaths } from "../../../lib/index.js";
|
|
6
6
|
const SIDE_MAP = {
|
|
7
7
|
web: ["cell", "component", "layout", "page", "scaffold"],
|
|
@@ -2,12 +2,10 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
4
|
import { format } from "prettier";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
getPrettierOptions,
|
|
8
|
-
setTomlSetting
|
|
9
|
-
} from "@cedarjs/cli-helpers";
|
|
5
|
+
import { colors } from "@cedarjs/cli-helpers/colors";
|
|
6
|
+
import { getPrettierOptions } from "@cedarjs/cli-helpers/fileHelpers";
|
|
10
7
|
import { runBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
8
|
+
import { setTomlSetting } from "@cedarjs/cli-helpers/project";
|
|
11
9
|
import { getConfig, getPaths } from "@cedarjs/project-config";
|
|
12
10
|
import { runTransform } from "../../../../../lib/runTransform.js";
|
|
13
11
|
const command = "fragments";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
2
2
|
const command = "trusted-documents";
|
|
3
3
|
const description = "Set up Trusted Documents for GraphQL";
|
|
4
4
|
function builder(yargs) {
|
|
@@ -2,8 +2,9 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
4
|
import { format } from "prettier";
|
|
5
|
-
import { getPrettierOptions
|
|
5
|
+
import { getPrettierOptions } from "@cedarjs/cli-helpers/fileHelpers";
|
|
6
6
|
import { runBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
7
|
+
import { setTomlSetting } from "@cedarjs/cli-helpers/project";
|
|
7
8
|
import { getConfig, getPaths, resolveFile } from "@cedarjs/project-config";
|
|
8
9
|
import { runTransform } from "../../../../../lib/runTransform.js";
|
|
9
10
|
async function handler({ force }) {
|
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
4
|
import { terminalLink } from "termi-link";
|
|
5
|
-
import { colors as c } from "@cedarjs/cli-helpers";
|
|
5
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
6
6
|
import { addWorkspacePackages } from "@cedarjs/cli-helpers/packageManager/packages";
|
|
7
7
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
8
8
|
import extendStorybookConfiguration from "../../../lib/configureStorybook.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { terminalLink } from "termi-link";
|
|
2
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
2
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
3
3
|
const command = "jobs";
|
|
4
4
|
const description = "Sets up the config file and parent directory for background jobs";
|
|
5
5
|
const builder = (yargs) => {
|
|
@@ -3,7 +3,8 @@ import * as path from "node:path";
|
|
|
3
3
|
import prismaInternals from "@prisma/internals";
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
5
|
import { terminalLink } from "termi-link";
|
|
6
|
-
import {
|
|
6
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
7
|
+
import { addApiPackages } from "@cedarjs/cli-helpers/installHelpers";
|
|
7
8
|
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
8
9
|
import { getSchemaPath, getPrismaSchemas } from "@cedarjs/project-config";
|
|
9
10
|
import { getPaths, transformTSToJS, writeFile } from "../../../lib/index.js";
|
|
@@ -22,6 +23,8 @@ model BackgroundJob {
|
|
|
22
23
|
lockedBy String?
|
|
23
24
|
lastError String?
|
|
24
25
|
failedAt DateTime?
|
|
26
|
+
key String? @unique
|
|
27
|
+
pausedAt DateTime?
|
|
25
28
|
createdAt DateTime @default(now())
|
|
26
29
|
updatedAt DateTime @updatedAt
|
|
27
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
2
2
|
const command = "mailer";
|
|
3
3
|
const description = "Setup the Cedar mailer. This will install the required packages and add the required initial configuration to your Cedar app.";
|
|
4
4
|
const builder = (yargs) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
|
-
import {
|
|
4
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
5
|
+
import { addApiPackages } from "@cedarjs/cli-helpers/installHelpers";
|
|
5
6
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
6
7
|
import { getPaths, transformTSToJS, writeFile } from "../../../lib/index.js";
|
|
7
8
|
import { isTypeScriptProject } from "../../../lib/project.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
2
2
|
const command = "og-image";
|
|
3
3
|
const aliases = ["ogImage", "ogimage"];
|
|
4
4
|
const description = "Set up OG Image generation middleware";
|
|
@@ -2,7 +2,8 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
4
|
import { format } from "prettier";
|
|
5
|
-
import {
|
|
5
|
+
import { getPrettierOptions } from "@cedarjs/cli-helpers/fileHelpers";
|
|
6
|
+
import { addWebPackages } from "@cedarjs/cli-helpers/installHelpers";
|
|
6
7
|
import { getConfig, getPaths } from "@cedarjs/project-config";
|
|
7
8
|
import { runTransform } from "../../../../lib/runTransform.js";
|
|
8
9
|
async function handler({ force }) {
|