@cedarjs/cli 7.1.0 → 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.1-next.468",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,27 +34,27 @@
|
|
|
34
34
|
"@babel/core": "^7.26.10",
|
|
35
35
|
"@babel/parser": "7.29.9",
|
|
36
36
|
"@babel/preset-typescript": "7.29.7",
|
|
37
|
-
"@babel/traverse": "7.29.
|
|
37
|
+
"@babel/traverse": "7.29.10",
|
|
38
38
|
"@babel/types": "7.29.8",
|
|
39
|
-
"@cedarjs/api-server": "7.1.
|
|
40
|
-
"@cedarjs/babel-config": "7.1.
|
|
41
|
-
"@cedarjs/cli-helpers": "7.1.
|
|
42
|
-
"@cedarjs/internal": "7.1.
|
|
43
|
-
"@cedarjs/prerender": "7.1.
|
|
44
|
-
"@cedarjs/project-config": "7.1.
|
|
45
|
-
"@cedarjs/structure": "7.1.
|
|
46
|
-
"@cedarjs/telemetry": "7.1.
|
|
47
|
-
"@cedarjs/utils": "7.1.
|
|
48
|
-
"@cedarjs/vite": "7.1.
|
|
49
|
-
"@cedarjs/web-server": "7.1.
|
|
50
|
-
"@listr2/prompt-adapter-enquirer": "4.3.
|
|
39
|
+
"@cedarjs/api-server": "7.1.1-next.468",
|
|
40
|
+
"@cedarjs/babel-config": "7.1.1-next.468",
|
|
41
|
+
"@cedarjs/cli-helpers": "7.1.1-next.468",
|
|
42
|
+
"@cedarjs/internal": "7.1.1-next.468",
|
|
43
|
+
"@cedarjs/prerender": "7.1.1-next.468",
|
|
44
|
+
"@cedarjs/project-config": "7.1.1-next.468",
|
|
45
|
+
"@cedarjs/structure": "7.1.1-next.468",
|
|
46
|
+
"@cedarjs/telemetry": "7.1.1-next.468",
|
|
47
|
+
"@cedarjs/utils": "7.1.1-next.468",
|
|
48
|
+
"@cedarjs/vite": "7.1.1-next.468",
|
|
49
|
+
"@cedarjs/web-server": "7.1.1-next.468",
|
|
50
|
+
"@listr2/prompt-adapter-enquirer": "4.3.3",
|
|
51
51
|
"@opentelemetry/api": "1.9.1",
|
|
52
|
-
"@opentelemetry/core": "2.
|
|
53
|
-
"@opentelemetry/exporter-trace-otlp-http": "0.
|
|
54
|
-
"@opentelemetry/resources": "2.
|
|
55
|
-
"@opentelemetry/sdk-trace-node": "2.
|
|
52
|
+
"@opentelemetry/core": "2.12.0",
|
|
53
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.223.0",
|
|
54
|
+
"@opentelemetry/resources": "2.12.0",
|
|
55
|
+
"@opentelemetry/sdk-trace-node": "2.12.0",
|
|
56
56
|
"@opentelemetry/semantic-conventions": "1.43.0",
|
|
57
|
-
"@prisma/internals": "7.
|
|
57
|
+
"@prisma/internals": "7.10.0",
|
|
58
58
|
"ansis": "4.4.0",
|
|
59
59
|
"archiver": "7.0.1",
|
|
60
60
|
"boxen": "5.1.2",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"camelcase": "6.3.0",
|
|
63
63
|
"change-case": "4.1.2",
|
|
64
64
|
"ci-info": "4.4.0",
|
|
65
|
-
"concurrently": "9.2.
|
|
65
|
+
"concurrently": "9.2.5",
|
|
66
66
|
"configstore": "7.1.0",
|
|
67
67
|
"decamelize": "6.0.1",
|
|
68
68
|
"dotenv-defaults": "5.0.2",
|
|
@@ -79,25 +79,25 @@
|
|
|
79
79
|
"pascalcase": "1.0.0",
|
|
80
80
|
"pluralize": "8.0.0",
|
|
81
81
|
"portfinder": "1.0.38",
|
|
82
|
-
"prettier": "3.9.
|
|
82
|
+
"prettier": "3.9.10",
|
|
83
83
|
"prisma": "7.10.0",
|
|
84
84
|
"prompts": "2.4.2",
|
|
85
|
-
"
|
|
86
|
-
"smol-toml": "1.8.0",
|
|
85
|
+
"smol-toml": "1.9.1",
|
|
87
86
|
"srvx": "0.12.8",
|
|
88
87
|
"string-env-interpolation": "1.0.1",
|
|
89
|
-
"systeminformation": "5.33.
|
|
88
|
+
"systeminformation": "5.33.15",
|
|
90
89
|
"termi-link": "1.1.0",
|
|
91
90
|
"title-case": "3.0.3",
|
|
92
91
|
"unionfs": "4.6.0",
|
|
93
92
|
"uuid": "11.1.1",
|
|
93
|
+
"verkit": "0.5.0",
|
|
94
94
|
"yargs": "17.7.3"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@cedarjs/framework-tools": "7.1.
|
|
98
|
-
"@prisma/dmmf": "7.
|
|
97
|
+
"@cedarjs/framework-tools": "7.1.1-next.468",
|
|
98
|
+
"@prisma/dmmf": "7.10.0",
|
|
99
99
|
"@types/archiver": "^7.0.0",
|
|
100
|
-
"memfs": "4.
|
|
100
|
+
"memfs": "4.80.0",
|
|
101
101
|
"node-ssh": "13.2.1",
|
|
102
102
|
"ts-dedent": "2.3.0",
|
|
103
103
|
"typescript": "5.9.3",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import j from "jscodeshift";
|
|
2
|
-
function transform(fileInfo) {
|
|
3
|
-
const root = j(fileInfo.source);
|
|
4
|
-
const imports = root.find(j.ImportDeclaration);
|
|
5
|
-
imports.at(-1).insertAfter(
|
|
6
|
-
j.importDeclaration(
|
|
7
|
-
[j.importSpecifier(j.identifier("storagePrismaExtension"))],
|
|
8
|
-
j.literal("./uploads.js")
|
|
9
|
-
)
|
|
10
|
-
);
|
|
11
|
-
root.find(j.VariableDeclaration, { declarations: [{ id: { name: "db" } }] }).forEach((path) => {
|
|
12
|
-
const dbDeclaration = path.node.declarations[0];
|
|
13
|
-
if (j.VariableDeclarator.check(dbDeclaration) && j.NewExpression.check(dbDeclaration.init)) {
|
|
14
|
-
throw new Error("RW_CODEMOD_ERR_OLD_FORMAT");
|
|
15
|
-
}
|
|
16
|
-
if (j.VariableDeclarator.check(dbDeclaration) && j.Expression.check(dbDeclaration.init)) {
|
|
17
|
-
const newInit = j.callExpression(
|
|
18
|
-
j.memberExpression(dbDeclaration.init, j.identifier("$extends")),
|
|
19
|
-
[j.identifier("storagePrismaExtension")]
|
|
20
|
-
);
|
|
21
|
-
dbDeclaration.init = newInit;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return root.toSource();
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
transform as default
|
|
28
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { APIGatewayEvent, Context } from 'aws-lambda'
|
|
2
|
-
|
|
3
|
-
import type { SignatureValidationArgs } from '@cedarjs/storage/UrlSigner'
|
|
4
|
-
|
|
5
|
-
import { urlSigner, fsStorage } from 'src/lib/uploads'
|
|
6
|
-
|
|
7
|
-
export const handler = async (event: APIGatewayEvent, _context: Context) => {
|
|
8
|
-
const fileToReturn = urlSigner.validateSignature(
|
|
9
|
-
event.queryStringParameters as SignatureValidationArgs
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
const { contents, type } = await fsStorage.read(fileToReturn)
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
statusCode: 200,
|
|
16
|
-
headers: {
|
|
17
|
-
'Content-Type': type,
|
|
18
|
-
},
|
|
19
|
-
body: contents,
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
2
|
-
import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
3
|
-
import { ensurePosixPath } from "@cedarjs/project-config";
|
|
4
|
-
import { errorTelemetry, timedTelemetry } from "@cedarjs/telemetry";
|
|
5
|
-
import { getPaths } from "../../lib/index.js";
|
|
6
|
-
import * as project from "../../lib/project.js";
|
|
7
|
-
import { warnIfNonStandardDatasourceUrl } from "./datasourceWarning.js";
|
|
8
|
-
function hasStringMessage(value) {
|
|
9
|
-
return typeof value === "object" && value !== null && "message" in value && value.message === "string";
|
|
10
|
-
}
|
|
11
|
-
function getExitCode(value) {
|
|
12
|
-
if (!value || typeof value !== "object" || !("exitCode" in value) || typeof value.exitCode !== "number") {
|
|
13
|
-
return void 0;
|
|
14
|
-
}
|
|
15
|
-
return value.exitCode;
|
|
16
|
-
}
|
|
17
|
-
const handler = async ({
|
|
18
|
-
filter: filterParams = [],
|
|
19
|
-
dbPush = true,
|
|
20
|
-
force = false,
|
|
21
|
-
...others
|
|
22
|
-
}) => {
|
|
23
|
-
recordTelemetryAttributes({
|
|
24
|
-
command: "test",
|
|
25
|
-
dbPush
|
|
26
|
-
});
|
|
27
|
-
let watch = true;
|
|
28
|
-
const rwjsPaths = getPaths();
|
|
29
|
-
const forwardVitestFlags = Object.keys(others).flatMap((flagName) => {
|
|
30
|
-
if (["db-push", "force", "loadEnvFiles", "$0", "_"].includes(flagName)) {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
const flag = flagName.length > 1 ? `--${flagName}` : `-${flagName}`;
|
|
34
|
-
const flagValue = others[flagName];
|
|
35
|
-
if (flagName === "watch") {
|
|
36
|
-
watch = flagValue === true;
|
|
37
|
-
} else if (flagName === "run" && flagValue) {
|
|
38
|
-
watch = false;
|
|
39
|
-
}
|
|
40
|
-
if (Array.isArray(flagValue)) {
|
|
41
|
-
return flagValue.flatMap((val) => [flag, val]);
|
|
42
|
-
}
|
|
43
|
-
return [flag, flagValue];
|
|
44
|
-
});
|
|
45
|
-
const sides = filterParams.filter(
|
|
46
|
-
(filterString) => project.workspaces().includes(filterString)
|
|
47
|
-
);
|
|
48
|
-
const vitestFilterArgs = [
|
|
49
|
-
...filterParams.filter(
|
|
50
|
-
(filterString) => !project.workspaces().includes(filterString)
|
|
51
|
-
)
|
|
52
|
-
];
|
|
53
|
-
const vitestArgs = [
|
|
54
|
-
...vitestFilterArgs,
|
|
55
|
-
...forwardVitestFlags,
|
|
56
|
-
"--passWithNoTests"
|
|
57
|
-
].filter((flagOrValue) => flagOrValue !== null);
|
|
58
|
-
if (process.env.CI) {
|
|
59
|
-
vitestArgs.push("--run");
|
|
60
|
-
}
|
|
61
|
-
if (!others["config"]) {
|
|
62
|
-
sides.forEach((side) => vitestArgs.push("--project", side));
|
|
63
|
-
if (!sides.length) {
|
|
64
|
-
project.workspaces().forEach((side) => sides.push(side));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
const cacheDirDb = `file:${ensurePosixPath(
|
|
69
|
-
rwjsPaths.generated.base
|
|
70
|
-
)}/test.db`;
|
|
71
|
-
const mainDatabaseUrl = process.env.DATABASE_URL;
|
|
72
|
-
const DATABASE_URL = process.env.TEST_DATABASE_URL || cacheDirDb;
|
|
73
|
-
if (sides.includes("api") && !dbPush) {
|
|
74
|
-
process.env.SKIP_DB_PUSH = "1";
|
|
75
|
-
}
|
|
76
|
-
if (sides.includes("api")) {
|
|
77
|
-
await warnIfNonStandardDatasourceUrl({ force });
|
|
78
|
-
}
|
|
79
|
-
const runCommand = async () => {
|
|
80
|
-
await runBin("vitest", vitestArgs, {
|
|
81
|
-
cwd: rwjsPaths.base,
|
|
82
|
-
stdio: "inherit",
|
|
83
|
-
env: {
|
|
84
|
-
...process.env,
|
|
85
|
-
DATABASE_URL,
|
|
86
|
-
// Always set, even to '', so CedarApiVitestEnv can tell "there's
|
|
87
|
-
// no real DATABASE_URL to compare against" apart from "this isn't
|
|
88
|
-
// running through `cedar test` at all" (e.g. a direct `vitest`
|
|
89
|
-
// invocation, whose own DATABASE_URL hasn't been touched yet).
|
|
90
|
-
CEDAR_APP_DATABASE_URL: mainDatabaseUrl ?? ""
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
if (watch) {
|
|
95
|
-
await runCommand();
|
|
96
|
-
} else {
|
|
97
|
-
await timedTelemetry(process.argv, { type: "test" }, async () => {
|
|
98
|
-
await runCommand();
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
} catch (error) {
|
|
102
|
-
const message = hasStringMessage(error) ? error.message : "Test command failed";
|
|
103
|
-
errorTelemetry(process.argv, message);
|
|
104
|
-
process.exit(getExitCode(error) ?? 1);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
export {
|
|
108
|
-
handler
|
|
109
|
-
};
|
package/dist/commands/testEsm.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { terminalLink } from "termi-link";
|
|
2
|
-
import { colors as c } from "@cedarjs/cli-helpers";
|
|
3
|
-
import { workspaces } from "../lib/project.js";
|
|
4
|
-
const command = "test [filter..]";
|
|
5
|
-
const description = "Run Vitest tests. Defaults to watch mode";
|
|
6
|
-
const builder = (yargs) => {
|
|
7
|
-
const cliDocsLink = terminalLink(
|
|
8
|
-
"CedarJS CLI Reference",
|
|
9
|
-
"https://cedarjs.com/docs/cli-commands#test"
|
|
10
|
-
);
|
|
11
|
-
const vitestTip = c.tip("yarn vitest --help");
|
|
12
|
-
yargs.strict(false).positional("filter", {
|
|
13
|
-
default: workspaces(),
|
|
14
|
-
description: "Which side(s) to test, and/or a regular expression to match against your test files to filter by",
|
|
15
|
-
type: "string",
|
|
16
|
-
array: true
|
|
17
|
-
}).option("db-push", {
|
|
18
|
-
describe: "Syncs the test database with your Prisma schema without requiring a migration. It creates a test database if it doesn't already exist.",
|
|
19
|
-
type: "boolean",
|
|
20
|
-
default: true
|
|
21
|
-
}).option("force", {
|
|
22
|
-
describe: "Skip any confirmation prompts and run tests without interruption. Useful in CI or scripted environments.",
|
|
23
|
-
type: "boolean",
|
|
24
|
-
default: false
|
|
25
|
-
}).epilogue(
|
|
26
|
-
`For all available flags, run vitest cli directly ${vitestTip}
|
|
27
|
-
|
|
28
|
-
Also see the ${cliDocsLink}
|
|
29
|
-
`
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
const handler = async (options) => {
|
|
33
|
-
const { handler: handler2 } = await import("./test/testHandlerEsm.js");
|
|
34
|
-
return handler2(options);
|
|
35
|
-
};
|
|
36
|
-
export {
|
|
37
|
-
builder,
|
|
38
|
-
command,
|
|
39
|
-
description,
|
|
40
|
-
handler
|
|
41
|
-
};
|