@cedarjs/cli 7.0.1-next.467 → 7.1.0-rc.34
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 +1 -2
- package/dist/commands/build.js +1 -1
- package/dist/commands/check.js +1 -2
- package/dist/commands/deploy/baremetal/baremetalHandler.js +73 -364
- package/dist/commands/deploy/baremetal.js +1 -7
- 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 +1 -2
- package/dist/commands/deploy/vercel.js +1 -1
- package/dist/commands/destroy/handlerHelpers.js +1 -1
- package/dist/commands/destroy/page/pageHandler.js +1 -2
- package/dist/commands/destroy/scaffold/scaffoldHandler.js +26 -65
- package/dist/commands/destroy/sdl/sdlHandler.js +1 -2
- package/dist/commands/dev/devHandler.js +4 -3
- package/dist/commands/dev/packageWatchCommands.js +3 -8
- package/dist/commands/dev.js +1 -1
- package/dist/commands/execHandler.js +1 -2
- 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 +1 -2
- 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 +1 -2
- package/dist/commands/experimental/setupStreamingSsr.js +1 -1
- package/dist/commands/experimental/setupStreamingSsrHandler.js +2 -3
- package/dist/commands/generate/cell/cell.js +0 -20
- package/dist/commands/generate/cell/cellHandler.js +20 -68
- package/dist/commands/generate/cell/templates/cell.tsx.template +2 -21
- package/dist/commands/generate/cell/templates/cellList.tsx.template +2 -21
- package/dist/commands/generate/cell/templates/test.js.template +1 -1
- package/dist/commands/generate/dataMigration/dataMigration.js +1 -2
- package/dist/commands/generate/dbAuth/dbAuth.js +2 -6
- package/dist/commands/generate/dbAuth/dbAuthHandler.js +17 -80
- package/dist/commands/generate/dbAuth/templates/login.webAuthn.tsx.template +12 -20
- package/dist/commands/generate/directive/directiveHandler.js +1 -2
- package/dist/commands/generate/function/functionHandler.js +1 -2
- package/dist/commands/generate/helpers.js +0 -26
- package/dist/commands/generate/job/jobHandler.js +1 -2
- package/dist/commands/generate/model/modelHandler.js +1 -2
- package/dist/commands/generate/ogImage/ogImageHandler.js +1 -2
- package/dist/commands/generate/ogImage/templates/ogImage.og.tsx.template +1 -1
- package/dist/commands/generate/package/filesTask.js +12 -9
- package/dist/commands/generate/package/packageHandler.js +4 -3
- package/dist/commands/generate/package/templates/tsconfig.json.template +0 -1
- package/dist/commands/generate/page/pageHandler.js +1 -2
- package/dist/commands/generate/realtime/realtime.js +1 -1
- package/dist/commands/generate/realtime/realtimeHandler.js +9 -2
- package/dist/commands/generate/realtime/templates/liveQueries/blank/blank.service.ts.template +4 -12
- 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 +49 -93
- package/dist/commands/generate/scaffold/templates/assets/scaffold.tailwind.css.template +7 -12
- package/dist/commands/generate/scaffold/templates/components/EditNameCell.tsx.template +7 -5
- package/dist/commands/generate/scaffold/templates/components/NameForm.tsx.template +9 -10
- package/dist/commands/generate/scaffold/templates/lib/formatters.test.tsx.template +0 -11
- package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +4 -16
- package/dist/commands/generate/script/scriptHandler.js +1 -2
- package/dist/commands/generate/script/templates/tsconfig.json.template +0 -1
- package/dist/commands/generate/sdl/sdlHandler.js +4 -10
- package/dist/commands/generate/secret/secret.js +1 -1
- package/dist/commands/generate/service/serviceHandler.js +49 -79
- package/dist/commands/generate/service/templates/service.ts.template +13 -40
- package/dist/commands/generate/service/templates/test.ts.template +6 -8
- package/dist/commands/generate/yargsCommandHelpers.js +1 -1
- package/dist/commands/generate/yargsHandlerHelpers.js +1 -2
- package/dist/commands/generate.js +1 -1
- package/dist/commands/info.js +1 -1
- package/dist/commands/jobsHandler.js +3 -5
- package/dist/commands/lint.js +1 -1
- package/dist/commands/prerenderHandler.js +4 -11
- package/dist/commands/prismaHandler.js +2 -7
- package/dist/commands/record/init.js +1 -1
- package/dist/commands/serve.js +1 -2
- package/dist/commands/setup/auth/auth.js +4 -2
- package/dist/commands/setup/cache/cache.js +1 -1
- package/dist/commands/setup/cache/cacheHandler.js +1 -2
- package/dist/commands/setup/cache/templates/memcached.ts.template +17 -14
- package/dist/commands/setup/cache/templates/redis.ts.template +20 -12
- package/dist/commands/setup/database/postgres.js +1 -1
- package/dist/commands/setup/database/postgresHandler.js +1 -3
- package/dist/commands/setup/deploy/providers/baremetal.js +0 -7
- package/dist/commands/setup/deploy/providers/baremetalHandler.js +21 -130
- package/dist/commands/setup/deploy/providers/coherence.js +1 -1
- package/dist/commands/setup/deploy/providers/coherenceHandler.js +6 -7
- package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +1 -2
- package/dist/commands/setup/deploy/providers/netlifyHandler.js +1 -2
- package/dist/commands/setup/deploy/providers/renderHandler.js +1 -2
- package/dist/commands/setup/deploy/providers/serverlessHandler.js +1 -2
- package/dist/commands/setup/deploy/providers/universalDeployHandler.js +6 -4
- package/dist/commands/setup/deploy/providers/vercelHandler.js +1 -2
- package/dist/commands/setup/deploy/templates/baremetal.js +9 -119
- package/dist/commands/setup/deploy/templates/netlifyUD.js +0 -3
- package/dist/commands/setup/docker/docker.js +1 -1
- package/dist/commands/setup/docker/dockerHandler.js +1 -2
- 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 +5 -3
- package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocuments.js +1 -1
- package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocumentsHandler.js +1 -2
- 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 +1 -4
- package/dist/commands/setup/mailer/mailer.js +1 -1
- package/dist/commands/setup/mailer/mailerHandler.js +1 -2
- package/dist/commands/setup/middleware/ogImage/ogImage.js +1 -1
- package/dist/commands/setup/middleware/ogImage/ogImageHandler.js +1 -2
- package/dist/commands/setup/monitoring/sentry/sentry.js +1 -1
- package/dist/commands/setup/monitoring/sentry/sentryHandler.js +9 -13
- package/dist/commands/setup/monitoring/sentry/templates/sentryApi.ts.template +4 -1
- package/dist/commands/setup/monitoring/sentry/templates/sentryWeb.ts.template +4 -7
- package/dist/commands/setup/neon/neon.js +1 -1
- package/dist/commands/setup/neon/neonHandler.js +9 -5
- 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 +16 -4
- package/dist/commands/setup/realtime/templates/defer/fastAndSlowFields/fastAndSlowFields.ts.template +1 -4
- package/dist/commands/setup/realtime/templates/liveQueries/auctions/auctions.ts.template +4 -12
- 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 +1 -2
- package/dist/commands/setup/ui/libraries/chakra-uiHandler.js +1 -2
- package/dist/commands/setup/ui/libraries/mantineHandler.js +1 -2
- package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +82 -63
- package/dist/commands/setup/ui/templates/postcss.config.cjs.template +9 -0
- package/dist/commands/setup/uploads/dbCodemod.js +28 -0
- package/dist/commands/setup/uploads/templates/signedUrl.ts.template +21 -0
- package/dist/commands/setup/uploads/templates/srcLibUploads.ts.template +24 -23
- package/dist/commands/setup/uploads/uploads.js +7 -49
- package/dist/commands/setup/uploads/uploadsHandler.js +69 -277
- package/dist/commands/setup.js +1 -2
- package/dist/commands/studio.js +1 -1
- package/dist/commands/test/testHandler.js +71 -25
- package/dist/commands/test/testHandlerEsm.js +109 -0
- package/dist/commands/test.js +18 -10
- package/dist/commands/testEsm.js +41 -0
- 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 +1 -2
- package/dist/index.js +8 -5
- package/dist/lib/exit.js +1 -1
- package/dist/lib/index.js +31 -16
- 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/deploy/baremetal/monitors.js +0 -66
- package/dist/commands/generate/cell/templates/cellFragment.tsx.template +0 -43
- package/dist/commands/generate/cell/templates/storiesFragment.tsx.template +0 -23
- package/dist/commands/generate/cell/templates/testFragment.js.template +0 -30
- package/dist/commands/generate/dbAuth/templates/changePassword.tsx.template +0 -131
- package/dist/commands/generate/dbAuth/templates/login.oauth.tsx.template +0 -164
- package/dist/commands/generate/dbAuth/templates/signup.oauth.tsx.template +0 -147
- package/dist/commands/generate/scaffold/templates/layouts/NamesScaffoldLayout.tsx.template +0 -18
- package/dist/commands/setup/tenancy/authCodemod.js +0 -66
- package/dist/commands/setup/tenancy/dbCodemod.js +0 -64
- package/dist/commands/setup/tenancy/graphqlCodemod.js +0 -88
- package/dist/commands/setup/tenancy/preflight.js +0 -49
- package/dist/commands/setup/tenancy/schemaPrisma.js +0 -81
- package/dist/commands/setup/tenancy/signupCodemod.js +0 -154
- package/dist/commands/setup/tenancy/templates/InvitePage.tsx.template +0 -72
- package/dist/commands/setup/tenancy/templates/OrgScope.tsx.template +0 -40
- package/dist/commands/setup/tenancy/templates/ensureDefaultOrganizations.dataMigration.ts.template +0 -39
- package/dist/commands/setup/tenancy/templates/organizations.scenarios.ts.template +0 -57
- package/dist/commands/setup/tenancy/templates/organizations.sdl.ts.template +0 -89
- package/dist/commands/setup/tenancy/templates/organizations.test.ts.template +0 -381
- package/dist/commands/setup/tenancy/templates/organizations.ts.template +0 -394
- package/dist/commands/setup/tenancy/templates/requireMembership.test.ts.template +0 -35
- package/dist/commands/setup/tenancy/templates/requireMembership.ts.template +0 -25
- package/dist/commands/setup/tenancy/tenancy.js +0 -30
- package/dist/commands/setup/tenancy/tenancyHandler.js +0 -425
- package/dist/commands/setup/uploads/gitignore.js +0 -17
- package/dist/commands/setup/uploads/schemaPrisma.js +0 -41
- package/dist/commands/setup/uploads/serverFile.js +0 -217
- package/dist/commands/setup/uploads/templates/requireUploadToken.ts.template +0 -15
- package/dist/commands/setup/uploads/templates/uploads.sdl.ts.template +0 -79
- package/dist/commands/setup/uploads/templates/uploads.ts.template +0 -98
- package/dist/commands/setup/uploads/templates/withDataUri.ts.template +0 -14
- package/dist/commands/setup/uploads/templates/withSignedUrl.ts.template +0 -16
- package/dist/commands/test/viteVersionCheck.js +0 -75
|
@@ -3,14 +3,7 @@ import camelcase from "camelcase";
|
|
|
3
3
|
import { pluralize, singularize } from "@cedarjs/utils/cedarPluralize";
|
|
4
4
|
import { transformTSToJS } from "../../../lib/index.js";
|
|
5
5
|
import { getSchema, verifyModelName } from "../../../lib/schemaHelpers.js";
|
|
6
|
-
import {
|
|
7
|
-
DEFAULT_IGNORE_FIELDS_FOR_INPUT,
|
|
8
|
-
nullableJsonFieldsInInput,
|
|
9
|
-
nullableRelationsForModel,
|
|
10
|
-
redactedModelFields,
|
|
11
|
-
relationsForModel,
|
|
12
|
-
requiredFieldsInUpdateInput
|
|
13
|
-
} from "../helpers.js";
|
|
6
|
+
import { redactedModelFields, relationsForModel } from "../helpers.js";
|
|
14
7
|
import { createHandler, templateForFile } from "../yargsHandlerHelpers.js";
|
|
15
8
|
function isServiceModel(schema) {
|
|
16
9
|
return typeof schema === "object" && schema !== null && "fields" in schema && "name" in schema;
|
|
@@ -66,13 +59,11 @@ function scenarioFieldValue(field) {
|
|
|
66
59
|
return randInt;
|
|
67
60
|
case "Json":
|
|
68
61
|
return { foo: "bar" };
|
|
69
|
-
case "String":
|
|
70
|
-
const isUnique = field.isUnique || field.isId;
|
|
62
|
+
case "String":
|
|
71
63
|
if (field.name?.toLowerCase().includes("email")) {
|
|
72
|
-
return isUnique ? `foo${randInt}@bar.com` : "foo@bar.com";
|
|
64
|
+
return field.isUnique ? `foo${randInt}@bar.com` : "foo@bar.com";
|
|
73
65
|
}
|
|
74
|
-
return isUnique ? `String${randInt}` : "String";
|
|
75
|
-
}
|
|
66
|
+
return field.isUnique ? `String${randInt}` : "String";
|
|
76
67
|
case "Bytes":
|
|
77
68
|
return `new Uint8Array([${randIntArray}])`;
|
|
78
69
|
default: {
|
|
@@ -161,14 +152,11 @@ const fieldsToInput = async (model) => {
|
|
|
161
152
|
const modelName = camelcase(singularize(model));
|
|
162
153
|
const inputObj = {};
|
|
163
154
|
if (scalarFields.some(
|
|
164
|
-
(field) => redactedFields.includes(field.name)
|
|
155
|
+
(field) => redactedFields.includes(field.name)
|
|
165
156
|
)) {
|
|
166
157
|
return false;
|
|
167
158
|
}
|
|
168
159
|
scalarFields.forEach((field) => {
|
|
169
|
-
if (DEFAULT_IGNORE_FIELDS_FOR_INPUT.includes(field.name)) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
160
|
if (foreignKeys.includes(field.name)) {
|
|
173
161
|
inputObj[field.name] = `scenario.${modelName}.two.${field.name}`;
|
|
174
162
|
} else {
|
|
@@ -186,7 +174,7 @@ const fieldsToUpdate = async (model) => {
|
|
|
186
174
|
const modelName = camelcase(singularize(model));
|
|
187
175
|
let field, newValue, fieldName;
|
|
188
176
|
const updatableFields = scalarFields.filter(
|
|
189
|
-
(scalar) => !redactedFields.includes(scalar.name)
|
|
177
|
+
(scalar) => !redactedFields.includes(scalar.name)
|
|
190
178
|
);
|
|
191
179
|
field = updatableFields.find(
|
|
192
180
|
(scalar) => !foreignKeys.includes(scalar.name)
|
|
@@ -262,10 +250,6 @@ const getIdName = async (model) => {
|
|
|
262
250
|
if (!isServiceModel(schemaResult)) {
|
|
263
251
|
return void 0;
|
|
264
252
|
}
|
|
265
|
-
if (schemaResult.primaryKey?.fields.length) {
|
|
266
|
-
const { fields, name } = schemaResult.primaryKey;
|
|
267
|
-
return { fields, whereArg: name || fields.join("_") };
|
|
268
|
-
}
|
|
269
253
|
return schemaResult.fields.find((field) => field.isId)?.name;
|
|
270
254
|
};
|
|
271
255
|
const files = async ({
|
|
@@ -278,26 +262,15 @@ const files = async ({
|
|
|
278
262
|
const componentName = camelcase(pluralize(name));
|
|
279
263
|
const model = name;
|
|
280
264
|
const idName = await getIdName(model);
|
|
281
|
-
if (tests && rest.crud && idName !== void 0 && typeof idName !== "string") {
|
|
282
|
-
throw new Error(
|
|
283
|
-
`Cannot generate CRUD tests for "${model}": it has a compound primary key (@@id([${idName.fields.join(", ")}])), which isn't supported by the generated test file yet. Re-run with \`--tests=false\`.`
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
265
|
const prismaImportSource = "src/lib/db";
|
|
287
266
|
let modelRelations;
|
|
288
|
-
let updateInputRequiredFields = [];
|
|
289
|
-
let nullableJsonFields = [];
|
|
290
|
-
let nullableRelations = [];
|
|
291
|
-
const schemaResult = await getSchema(model);
|
|
292
|
-
if (isServiceModel(schemaResult)) {
|
|
293
|
-
updateInputRequiredFields = requiredFieldsInUpdateInput(schemaResult);
|
|
294
|
-
nullableJsonFields = nullableJsonFieldsInInput(schemaResult);
|
|
295
|
-
nullableRelations = nullableRelationsForModel(schemaResult);
|
|
296
|
-
}
|
|
297
267
|
if (relations) {
|
|
298
268
|
modelRelations = relations;
|
|
299
|
-
} else
|
|
300
|
-
|
|
269
|
+
} else {
|
|
270
|
+
const schemaResult = await getSchema(model);
|
|
271
|
+
if (isServiceModel(schemaResult)) {
|
|
272
|
+
modelRelations = relationsForModel(schemaResult);
|
|
273
|
+
}
|
|
301
274
|
}
|
|
302
275
|
const serviceFile = await templateForFile({
|
|
303
276
|
name,
|
|
@@ -310,52 +283,49 @@ const files = async ({
|
|
|
310
283
|
relations: modelRelations,
|
|
311
284
|
idName,
|
|
312
285
|
prismaImportSource,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
286
|
+
...rest
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
const testFile = await templateForFile({
|
|
290
|
+
name,
|
|
291
|
+
side: "api",
|
|
292
|
+
sidePathSection: "services",
|
|
293
|
+
generator: "service",
|
|
294
|
+
outputPath: path.join(componentName, componentName + ".test.ts"),
|
|
295
|
+
templatePath: "test.ts.template",
|
|
296
|
+
templateVars: {
|
|
297
|
+
relations: relations || [],
|
|
298
|
+
create: await fieldsToInput(model),
|
|
299
|
+
update: await fieldsToUpdate(model),
|
|
300
|
+
types: await fieldTypes(model),
|
|
301
|
+
prismaImport: (await parseSchema(model)).scalarFields.some(
|
|
302
|
+
(field) => field.type === "Decimal"
|
|
303
|
+
),
|
|
304
|
+
prismaModel: model,
|
|
305
|
+
idName,
|
|
306
|
+
prismaImportSource,
|
|
307
|
+
...rest
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
const scenariosFile = await templateForFile({
|
|
311
|
+
name,
|
|
312
|
+
side: "api",
|
|
313
|
+
sidePathSection: "services",
|
|
314
|
+
generator: "service",
|
|
315
|
+
outputPath: path.join(componentName, componentName + ".scenarios.ts"),
|
|
316
|
+
templatePath: "scenarios.ts.template",
|
|
317
|
+
templateVars: {
|
|
318
|
+
scenario: await buildScenario(model),
|
|
319
|
+
stringifiedScenario: await buildStringifiedScenario(model),
|
|
320
|
+
prismaModel: model,
|
|
321
|
+
idName,
|
|
322
|
+
relations: modelRelations,
|
|
323
|
+
prismaImportSource,
|
|
316
324
|
...rest
|
|
317
325
|
}
|
|
318
326
|
});
|
|
319
327
|
const files2 = [serviceFile];
|
|
320
328
|
if (tests) {
|
|
321
|
-
const testFile = await templateForFile({
|
|
322
|
-
name,
|
|
323
|
-
side: "api",
|
|
324
|
-
sidePathSection: "services",
|
|
325
|
-
generator: "service",
|
|
326
|
-
outputPath: path.join(componentName, componentName + ".test.ts"),
|
|
327
|
-
templatePath: "test.ts.template",
|
|
328
|
-
templateVars: {
|
|
329
|
-
relations: relations || [],
|
|
330
|
-
create: await fieldsToInput(model),
|
|
331
|
-
update: await fieldsToUpdate(model),
|
|
332
|
-
types: await fieldTypes(model),
|
|
333
|
-
prismaImport: (await parseSchema(model)).scalarFields.some(
|
|
334
|
-
(field) => field.type === "Decimal"
|
|
335
|
-
),
|
|
336
|
-
prismaModel: model,
|
|
337
|
-
idName,
|
|
338
|
-
prismaImportSource,
|
|
339
|
-
...rest
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
const scenariosFile = await templateForFile({
|
|
343
|
-
name,
|
|
344
|
-
side: "api",
|
|
345
|
-
sidePathSection: "services",
|
|
346
|
-
generator: "service",
|
|
347
|
-
outputPath: path.join(componentName, componentName + ".scenarios.ts"),
|
|
348
|
-
templatePath: "scenarios.ts.template",
|
|
349
|
-
templateVars: {
|
|
350
|
-
scenario: await buildScenario(model),
|
|
351
|
-
stringifiedScenario: await buildStringifiedScenario(model),
|
|
352
|
-
prismaModel: model,
|
|
353
|
-
idName,
|
|
354
|
-
relations: modelRelations,
|
|
355
|
-
prismaImportSource,
|
|
356
|
-
...rest
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
329
|
files2.push(testFile);
|
|
360
330
|
files2.push(scenariosFile);
|
|
361
331
|
}
|
|
@@ -1,65 +1,38 @@
|
|
|
1
1
|
import type { QueryResolvers<% if (crud) { %>, MutationResolvers<% } %><% if (relations.length) { %>, ${singularPascalName}RelationResolvers<% } %> } from 'types/graphql'
|
|
2
2
|
|
|
3
|
-
import { db
|
|
4
|
-
|
|
5
|
-
// A compound `@@id([...])` key comes through as `{ fields, whereArg }`
|
|
6
|
-
// instead of a single field name -- build the destructure/where-clause
|
|
7
|
-
// snippets for both shapes here so the rest of the template can stay
|
|
8
|
-
// shape-agnostic.
|
|
9
|
-
const idIsComposite = idName != null && typeof idName === 'object'
|
|
10
|
-
const idFields = idIsComposite ? idName.fields : [idName]
|
|
11
|
-
const idArgs = idFields.join(', ')
|
|
12
|
-
const idWhere = idIsComposite
|
|
13
|
-
? `${idName.whereArg}: { ${idFields.join(', ')} }`
|
|
14
|
-
: idName
|
|
15
|
-
const idWhereFromRoot = idIsComposite
|
|
16
|
-
? `${idName.whereArg}: { ${idFields.map((f) => `${f}: root.${f}`).join(', ')} }`
|
|
17
|
-
: `${idName}: root.${idName}`
|
|
18
|
-
%>
|
|
3
|
+
import { db } from 'src/lib/db'
|
|
4
|
+
|
|
19
5
|
export const ${pluralCamelName}: QueryResolvers['${pluralCamelName}'] = () => {
|
|
20
6
|
return db.${singularCamelName}.findMany()
|
|
21
7
|
}<% if (crud || relations.length) { %>
|
|
22
8
|
|
|
23
|
-
export const ${singularCamelName}: QueryResolvers['${singularCamelName}'] = ({ ${
|
|
9
|
+
export const ${singularCamelName}: QueryResolvers['${singularCamelName}'] = ({ ${idName} }) => {
|
|
24
10
|
return db.${singularCamelName}.findUnique({
|
|
25
|
-
where: { ${
|
|
11
|
+
where: { ${idName} },
|
|
26
12
|
})
|
|
27
13
|
}<% } %><% if (crud) { %>
|
|
28
14
|
|
|
29
15
|
export const create${singularPascalName}: MutationResolvers['create${singularPascalName}'] = ({ input }) => {
|
|
30
|
-
return db.${singularCamelName}.create({
|
|
31
|
-
data:
|
|
32
|
-
...input,
|
|
33
|
-
// Prisma uses Prisma.DbNull, not null, to set a Json field to NULL<% nullableJsonFields.forEach((field) => { %>
|
|
34
|
-
${field}: input.${field} === null ? Prisma.DbNull : input.${field},<% }) %>
|
|
35
|
-
},<% } else { %>
|
|
36
|
-
data: input,<% } %>
|
|
16
|
+
return db.${singularCamelName}.create({
|
|
17
|
+
data: input,
|
|
37
18
|
})
|
|
38
19
|
}
|
|
39
20
|
|
|
40
|
-
export const update${singularPascalName}: MutationResolvers['update${singularPascalName}'] = ({ ${
|
|
41
|
-
return db.${singularCamelName}.update({
|
|
42
|
-
data:
|
|
43
|
-
|
|
44
|
-
// Every field in the GraphQL input is nullable, but Prisma doesn't
|
|
45
|
-
// accept null for required fields. undefined leaves the field unchanged<% updateInputRequiredFields.forEach((field) => { %>
|
|
46
|
-
${field}: input.${field} ?? undefined,<% }) %><% } %><% if (nullableJsonFields.length) { %>
|
|
47
|
-
// Prisma uses Prisma.DbNull, not null, to set a Json field to NULL<% nullableJsonFields.forEach((field) => { %>
|
|
48
|
-
${field}: input.${field} === null ? Prisma.DbNull : input.${field},<% }) %><% } %>
|
|
49
|
-
},<% } else { %>
|
|
50
|
-
data: input,<% } %>
|
|
51
|
-
where: { ${idWhere} },
|
|
21
|
+
export const update${singularPascalName}: MutationResolvers['update${singularPascalName}'] = ({ ${idName}, input }) => {
|
|
22
|
+
return db.${singularCamelName}.update({
|
|
23
|
+
data: input,
|
|
24
|
+
where: { ${idName} },
|
|
52
25
|
})
|
|
53
26
|
}
|
|
54
27
|
|
|
55
|
-
export const delete${singularPascalName}: MutationResolvers['delete${singularPascalName}'] = ({ ${
|
|
28
|
+
export const delete${singularPascalName}: MutationResolvers['delete${singularPascalName}'] = ({ ${idName} }) => {
|
|
56
29
|
return db.${singularCamelName}.delete({
|
|
57
|
-
where: { ${
|
|
30
|
+
where: { ${idName} },
|
|
58
31
|
})
|
|
59
32
|
}<% } %><% if (relations.length) { %>
|
|
60
33
|
|
|
61
34
|
export const ${singularPascalName}: ${singularPascalName}RelationResolvers = {<% relations.forEach(relation => { %>
|
|
62
35
|
${relation}: (_obj, { root }) => {
|
|
63
|
-
return db.${singularCamelName}.findUnique
|
|
36
|
+
return db.${singularCamelName}.findUnique({ where: { ${idName}: root?.${idName} } }).${relation}()
|
|
64
37
|
},<% }) %>
|
|
65
38
|
}<% } %>
|
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
// Looks for quoted strings, either by single (') or double (") quotes.
|
|
8
8
|
// When found
|
|
9
9
|
// - Removes the quotes around `scenario` variables.
|
|
10
|
-
// - Removes the quotes around `BigInt` fields.
|
|
11
|
-
|
|
12
|
-
// set
|
|
13
|
-
const transformValue = (obj, type, asInput = false) => {
|
|
10
|
+
// - Removes the quotes around `BigInt` fields.
|
|
11
|
+
const transformValue = (obj, type) => {
|
|
14
12
|
if (type === 'DateTime') {
|
|
15
13
|
return `new Date('${obj.toISOString()}')`
|
|
16
14
|
} else if (type === 'Decimal') {
|
|
@@ -24,7 +22,7 @@
|
|
|
24
22
|
|
|
25
23
|
// BigInt
|
|
26
24
|
if (string.match(/^\"\d+n\"$/)) {
|
|
27
|
-
return string.slice(1, string.length -
|
|
25
|
+
return string.slice(1, string.length - 1)
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
return string
|
|
@@ -42,7 +40,7 @@ import type { StandardScenario } from './${pluralCamelName}.scenarios.js'
|
|
|
42
40
|
// and can fail without adjustments, e.g. Float.
|
|
43
41
|
// Please refer to the RedwoodJS Testing Docs:
|
|
44
42
|
// https://cedarjs.com/docs/testing#testing-services
|
|
45
|
-
// https://cedarjs.com/docs/testing#expect-type-considerations
|
|
43
|
+
// https://cedarjs.com/docs/testing#jest-expect-type-considerations
|
|
46
44
|
|
|
47
45
|
describe('${pluralCamelName}', () => {
|
|
48
46
|
scenario('returns all ${pluralCamelName}', async (scenario: StandardScenario) => {
|
|
@@ -59,7 +57,7 @@ describe('${pluralCamelName}', () => {
|
|
|
59
57
|
|
|
60
58
|
<% if (create) { %>scenario('creates a ${singularCamelName}', async (${transformValue(create).includes('scenario.') ? 'scenario: StandardScenario' : ''}) => {
|
|
61
59
|
const result = await create${singularPascalName}({
|
|
62
|
-
input: ${transformValue(create
|
|
60
|
+
input: ${transformValue(create)},
|
|
63
61
|
})
|
|
64
62
|
|
|
65
63
|
<% for (const [name, value] of Object.entries(create)) { %>
|
|
@@ -70,7 +68,7 @@ describe('${pluralCamelName}', () => {
|
|
|
70
68
|
const original = await (${singularCamelName}({ ${idName}: scenario.${singularCamelName}.one.${idName} })) as ${prismaModel}
|
|
71
69
|
const result = await update${singularPascalName}({
|
|
72
70
|
${idName}: original.${idName},
|
|
73
|
-
input: ${transformValue(update
|
|
71
|
+
input: ${transformValue(update)},
|
|
74
72
|
})
|
|
75
73
|
|
|
76
74
|
<% for (const [name, value] of Object.entries(update)) { %>
|
|
@@ -3,8 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import { camelCase } from "change-case";
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
5
|
import pascalcase from "pascalcase";
|
|
6
|
-
import { colors as c } from "@cedarjs/cli-helpers
|
|
7
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
6
|
+
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
8
7
|
import { ensurePosixPath, getConfig } from "@cedarjs/project-config";
|
|
9
8
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
10
9
|
import { generateTemplate, getPaths, writeFilesTask } from "../../lib/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { terminalLink } from "termi-link";
|
|
2
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
2
3
|
import { runBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
3
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
4
4
|
import * as generateCell from "./generate/cell/cell.js";
|
|
5
5
|
import * as generateComponent from "./generate/component/component.js";
|
|
6
6
|
import * as generateDataMigration from "./generate/dataMigration/dataMigration.js";
|
package/dist/commands/info.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import envinfo from "envinfo";
|
|
4
4
|
import { terminalLink } from "termi-link";
|
|
5
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers
|
|
5
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
6
6
|
import { getConfigPath } from "@cedarjs/project-config";
|
|
7
7
|
const command = "info";
|
|
8
8
|
const description = "Print your system environment information";
|
|
@@ -7,11 +7,9 @@ const handler = async ({
|
|
|
7
7
|
commands: _commands,
|
|
8
8
|
...options
|
|
9
9
|
}) => {
|
|
10
|
-
const positionalArgs =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
const args = positionalArgs.length > 0 ? positionalArgs : [""];
|
|
10
|
+
const positionalArgs = Array.isArray(_) ? [..._] : [];
|
|
11
|
+
const commandArg = positionalArgs.pop();
|
|
12
|
+
const args = [commandArg == null ? "" : String(commandArg)];
|
|
15
13
|
for (const [name, value] of Object.entries(options)) {
|
|
16
14
|
args.push(name.length > 1 ? `--${name}` : `-${name}`);
|
|
17
15
|
args.push(String(value));
|
package/dist/commands/lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import { terminalLink } from "termi-link";
|
|
3
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
3
4
|
import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
4
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
5
5
|
import { getPaths } from "@cedarjs/project-config";
|
|
6
6
|
const command = "lint [paths..]";
|
|
7
7
|
const description = "Lint your files";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
|
-
import { colors as c } from "@cedarjs/cli-helpers
|
|
4
|
+
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
5
5
|
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
6
|
-
import {
|
|
7
|
-
import { getConfig, getParsedScalars, getPaths } from "@cedarjs/project-config";
|
|
6
|
+
import { getConfig, getPaths, projectIsEsm } from "@cedarjs/project-config";
|
|
8
7
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
9
8
|
import { runScriptFunction } from "../lib/exec.js";
|
|
10
9
|
import { configureBabel } from "../lib/execBabel.js";
|
|
@@ -94,7 +93,7 @@ async function expandRouteParameters(route) {
|
|
|
94
93
|
return [route];
|
|
95
94
|
}
|
|
96
95
|
const getTasks = async (dryrun, routerPathFilter = null) => {
|
|
97
|
-
const detector = await import("@cedarjs/prerender/detection");
|
|
96
|
+
const detector = projectIsEsm() ? await import("@cedarjs/prerender/detection") : await import("@cedarjs/prerender/cjs/detection");
|
|
98
97
|
const detectedRoutes = detector.detectPrerenderRoutes();
|
|
99
98
|
const prerenderRoutes = detectedRoutes.filter(hasPath).map(normalizeRoute);
|
|
100
99
|
if (prerenderRoutes.length === 0) {
|
|
@@ -106,12 +105,6 @@ const getTasks = async (dryrun, routerPathFilter = null) => {
|
|
|
106
105
|
);
|
|
107
106
|
return [];
|
|
108
107
|
}
|
|
109
|
-
const parsedScalars = Object.keys(getParsedScalars());
|
|
110
|
-
if (parsedScalars.length > 0) {
|
|
111
|
-
throw new Error(
|
|
112
|
-
"Prerendering does not support `graphql.parsedScalars` yet. A prerendered Cell gets the raw GraphQL response, so " + parsedScalars.join(", ") + " would be a string when prerendering and parsed in the browser. Either remove the `prerender` prop from your routes, or remove `graphql.parsedScalars` from cedar.toml."
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
108
|
const indexHtmlPath = path.join(getPaths().web.dist, "index.html");
|
|
116
109
|
if (!fs.existsSync(indexHtmlPath)) {
|
|
117
110
|
console.error(
|
|
@@ -123,7 +116,7 @@ const getTasks = async (dryrun, routerPathFilter = null) => {
|
|
|
123
116
|
const expandedRouteParameters = await Promise.all(
|
|
124
117
|
prerenderRoutes.map((route) => expandRouteParameters(route))
|
|
125
118
|
);
|
|
126
|
-
const prerenderer = await import("@cedarjs/prerender");
|
|
119
|
+
const prerenderer = projectIsEsm() ? await import("@cedarjs/prerender") : await import("@cedarjs/prerender/cjs");
|
|
127
120
|
const listrTasks = expandedRouteParameters.flatMap((routesToPrerender) => {
|
|
128
121
|
const queryCache = {};
|
|
129
122
|
const shouldFold = routesToPrerender.length > 16;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import boxen from "boxen";
|
|
3
|
-
import { colors as c } from "@cedarjs/cli-helpers
|
|
3
|
+
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
4
4
|
import {
|
|
5
5
|
formatCedarCommand,
|
|
6
6
|
formatRunBinCommand,
|
|
7
7
|
formatRunTransitiveBinCommand
|
|
8
8
|
} from "@cedarjs/cli-helpers/packageManager/display";
|
|
9
9
|
import { runTransitiveBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
10
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
11
10
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
12
11
|
import { getPaths } from "../lib/index.js";
|
|
13
12
|
const getErrorMessage = (error) => {
|
|
@@ -63,11 +62,7 @@ const handler = async ({
|
|
|
63
62
|
try {
|
|
64
63
|
runTransitiveBinSync("prisma", args, {
|
|
65
64
|
cwd: cedarPaths.base,
|
|
66
|
-
stdio:
|
|
67
|
-
process.stdin.isTTY && !process.env.CI ? "inherit" : "pipe",
|
|
68
|
-
"inherit",
|
|
69
|
-
"inherit"
|
|
70
|
-
]
|
|
65
|
+
stdio: "inherit"
|
|
71
66
|
});
|
|
72
67
|
if (hasHelpOption || args.length === 0) {
|
|
73
68
|
printWrapInfo();
|
package/dist/commands/serve.js
CHANGED
|
@@ -5,8 +5,7 @@ import { serve as serveSrvx } from "srvx";
|
|
|
5
5
|
import { terminalLink } from "termi-link";
|
|
6
6
|
import * as apiServerCLIConfig from "@cedarjs/api-server/apiCliConfig";
|
|
7
7
|
import * as bothServerCLIConfig from "@cedarjs/api-server/bothCliConfig";
|
|
8
|
-
import { colors as c } from "@cedarjs/cli-helpers
|
|
9
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
8
|
+
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
10
9
|
import * as webServerCLIConfig from "@cedarjs/web-server";
|
|
11
10
|
import { getPaths, getConfig } from "../lib/index.js";
|
|
12
11
|
import { serverFileExists } from "../lib/project.js";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { terminalLink } from "termi-link";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
recordTelemetryAttributes,
|
|
6
|
+
standardAuthBuilder
|
|
7
|
+
} from "@cedarjs/cli-helpers";
|
|
5
8
|
import { addRootPackages } from "@cedarjs/cli-helpers/packageManager/packages";
|
|
6
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
7
9
|
import { getPaths } from "../../../lib/index.js";
|
|
8
10
|
const command = "auth <provider>";
|
|
9
11
|
const description = "Set up an auth configuration";
|
|
@@ -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";
|
|
3
3
|
const command = "cache <client>";
|
|
4
4
|
const description = "Sets up an init file for service caching";
|
|
5
5
|
const builder = (yargs) => {
|
|
@@ -2,8 +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
|
|
6
|
-
import { addEnvVarTask } from "@cedarjs/cli-helpers/project";
|
|
5
|
+
import { addEnvVarTask, colors as c } from "@cedarjs/cli-helpers";
|
|
7
6
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
8
7
|
import { addPackagesTask, getPaths, writeFile } from "../../../lib/index.js";
|
|
9
8
|
import { isTypeScriptProject } from "../../../lib/project.js";
|
|
@@ -10,18 +10,21 @@ const memJsFormattedLogger = {
|
|
|
10
10
|
log: (msg: string) => logger.error(msg),
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
// connect, the error is logged and `cache()` runs the uncached function
|
|
15
|
-
// instead
|
|
16
|
-
export const client =
|
|
17
|
-
process.env.NODE_ENV === 'test'
|
|
18
|
-
? new InMemoryClient()
|
|
19
|
-
: new MemcachedClient(process.env.CACHE_HOST, {
|
|
20
|
-
logger: memJsFormattedLogger,
|
|
21
|
-
})
|
|
13
|
+
export let client: InMemoryClient | MemcachedClient
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
if (process.env.NODE_ENV === 'test') {
|
|
16
|
+
client = new InMemoryClient()
|
|
17
|
+
} else {
|
|
18
|
+
try {
|
|
19
|
+
client = new MemcachedClient(process.env.CACHE_HOST, {
|
|
20
|
+
logger: memJsFormattedLogger,
|
|
21
|
+
})
|
|
22
|
+
} catch (e) {
|
|
23
|
+
logger.error(`Could not connect to cache: ${e.message}`)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const { cache, cacheFindMany, cacheClient, deleteCacheKey } = createCache(client, {
|
|
28
|
+
logger,
|
|
29
|
+
timeout: 500,
|
|
30
|
+
})
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createCache,
|
|
3
|
+
InMemoryClient,
|
|
4
|
+
RedisClient,
|
|
5
|
+
} from '@cedarjs/api/cache'
|
|
2
6
|
|
|
3
7
|
import { logger } from './logger'
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
// the error is logged and `cache()` runs the uncached function instead
|
|
7
|
-
export const client =
|
|
8
|
-
process.env.NODE_ENV === 'test'
|
|
9
|
-
? new InMemoryClient()
|
|
10
|
-
: new RedisClient({ url: process.env.CACHE_HOST, logger })
|
|
9
|
+
export let client: InMemoryClient | RedisClient
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
if (process.env.NODE_ENV === 'test') {
|
|
12
|
+
client = new InMemoryClient()
|
|
13
|
+
} else {
|
|
14
|
+
try {
|
|
15
|
+
client = new RedisClient({ url: process.env.CACHE_HOST, logger })
|
|
16
|
+
} catch (e) {
|
|
17
|
+
logger.error(`Could not connect to cache: ${e.message}`)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const { cache, cacheFindMany, cacheClient, deleteCacheKey } = createCache(client, {
|
|
22
|
+
logger,
|
|
23
|
+
timeout: 500,
|
|
24
|
+
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
2
2
|
const command = "postgres";
|
|
3
3
|
const description = "Switch your project from SQLite to PostgreSQL (schema, dependencies, and database adapter)";
|
|
4
4
|
function builder(yargs) {
|
|
@@ -2,11 +2,9 @@ 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 { colors } from "@cedarjs/cli-helpers
|
|
6
|
-
import { installPackages } from "@cedarjs/cli-helpers/installHelpers";
|
|
5
|
+
import { colors, getPaths, installPackages } from "@cedarjs/cli-helpers";
|
|
7
6
|
import { prettyPrintCedarCommand } from "@cedarjs/cli-helpers/packageManager";
|
|
8
7
|
import { addWorkspacePackages } from "@cedarjs/cli-helpers/packageManager/packages";
|
|
9
|
-
import { getPaths } from "@cedarjs/cli-helpers/paths";
|
|
10
8
|
import { resolveFile } from "@cedarjs/project-config";
|
|
11
9
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
12
10
|
function checkProjectShape(cedarPaths) {
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { MONITORS } from "../../../deploy/baremetal/monitors.js";
|
|
2
1
|
import { createHandler } from "../helpers/helpers.js";
|
|
3
2
|
const command = "baremetal";
|
|
4
3
|
const description = "Setup Baremetal deploy";
|
|
5
|
-
const builder = (yargs) => yargs.option("monitor", {
|
|
6
|
-
description: "Process monitor to generate config for. Asks when not given. pm2 gets an ecosystem.config.js, systemd gets unit files in systemd/",
|
|
7
|
-
choices: MONITORS,
|
|
8
|
-
type: "string"
|
|
9
|
-
});
|
|
10
4
|
const handler = createHandler("baremetal");
|
|
11
5
|
export {
|
|
12
|
-
builder,
|
|
13
6
|
command,
|
|
14
7
|
description,
|
|
15
8
|
handler
|