@cedarjs/cli 6.0.2 → 6.0.3-next.275
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 +1 -1
- package/dist/commands/deploy/baremetal.js +1 -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 +2 -1
- 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/experimental/templates/opentelemetry.ts.template +13 -7
- 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/dbAuthHandler.js +23 -3
- package/dist/commands/generate/dbAuth/templates/login.oauth.tsx.template +164 -0
- package/dist/commands/generate/dbAuth/templates/signup.oauth.tsx.template +147 -0
- package/dist/commands/generate/directive/directiveHandler.js +2 -1
- package/dist/commands/generate/function/functionHandler.js +2 -1
- 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/package/filesTask.js +9 -12
- package/dist/commands/generate/package/packageHandler.js +3 -4
- 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/subscriptions/blank/blank.ts.template +1 -1
- package/dist/commands/generate/scaffold/scaffoldHandler.js +2 -1
- package/dist/commands/generate/scaffold/templates/components/NameForm.tsx.template +42 -3
- package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +2 -2
- package/dist/commands/generate/script/scriptHandler.js +2 -1
- package/dist/commands/generate/sdl/sdlHandler.js +2 -1
- package/dist/commands/generate/secret/secret.js +1 -1
- package/dist/commands/generate/service/serviceHandler.js +47 -38
- package/dist/commands/generate/service/templates/service.ts.template +22 -8
- package/dist/commands/generate/service/templates/test.ts.template +1 -1
- 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/lint.js +1 -1
- package/dist/commands/prerenderHandler.js +5 -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/database/postgres.js +1 -1
- package/dist/commands/setup/database/postgresHandler.js +3 -1
- package/dist/commands/setup/deploy/providers/baremetalHandler.js +2 -1
- 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/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 +2 -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 +8 -7
- 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/subscriptions/countdown/countdown.ts.template +1 -1
- package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +1 -1
- package/dist/commands/setup/server-file/serverFile.js +1 -1
- package/dist/commands/setup/server-file/serverFileHandler.js +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 +153 -0
- package/dist/commands/setup/tenancy/templates/InvitePage.tsx.template +63 -0
- package/dist/commands/setup/tenancy/templates/OrgScope.tsx.template +40 -0
- package/dist/commands/setup/tenancy/templates/ensureDefaultOrganizations.dataMigration.ts.template +39 -0
- package/dist/commands/setup/tenancy/templates/organizations.scenarios.ts.template +59 -0
- package/dist/commands/setup/tenancy/templates/organizations.sdl.ts.template +89 -0
- package/dist/commands/setup/tenancy/templates/organizations.test.ts.template +389 -0
- package/dist/commands/setup/tenancy/templates/organizations.ts.template +394 -0
- package/dist/commands/setup/tenancy/templates/requireMembership.test.ts.template +35 -0
- package/dist/commands/setup/tenancy/templates/requireMembership.ts.template +25 -0
- package/dist/commands/setup/tenancy/tenancy.js +30 -0
- package/dist/commands/setup/tenancy/tenancyHandler.js +425 -0
- package/dist/commands/setup/ui/libraries/chakra-uiHandler.js +2 -1
- package/dist/commands/setup/ui/libraries/mantineHandler.js +2 -1
- package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +2 -1
- package/dist/commands/setup/uploads/schemaPrisma.js +41 -0
- package/dist/commands/setup/uploads/serverFile.js +151 -0
- package/dist/commands/setup/uploads/templates/requireUploadToken.ts.template +15 -0
- package/dist/commands/setup/uploads/templates/srcLibUploads.ts.template +23 -24
- package/dist/commands/setup/uploads/templates/uploads.sdl.ts.template +79 -0
- package/dist/commands/setup/uploads/templates/uploads.ts.template +89 -0
- package/dist/commands/setup/uploads/templates/withDataUri.ts.template +14 -0
- package/dist/commands/setup/uploads/templates/withSignedUrl.ts.template +16 -0
- package/dist/commands/setup/uploads/uploads.js +49 -7
- package/dist/commands/setup/uploads/uploadsHandler.js +256 -69
- package/dist/commands/setup.js +2 -2
- package/dist/commands/studio.js +1 -1
- package/dist/commands/test/testHandler.js +35 -72
- 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 -9
- package/dist/lib/exit.js +1 -1
- package/dist/lib/index.js +6 -25
- package/dist/lib/loadEnvFiles.js +1 -1
- package/dist/lib/plugin.js +1 -2
- package/dist/lib/test.js +1 -1
- package/dist/lib/updateCheck.js +5 -5
- package/dist/middleware/checkNodeVersion.js +4 -4
- package/dist/telemetry/index.js +4 -4
- package/dist/telemetry/resource.js +1 -1
- package/dist/telemetry/send.js +7 -2
- package/package.json +27 -27
- package/dist/commands/setup/tsconfig/tsconfig.js +0 -25
- package/dist/commands/setup/tsconfig/tsconfigHandler.js +0 -62
- 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 -100
- package/dist/commands/testEsm.js +0 -41
- package/dist/commands/ts-to-js.js +0 -20
package/dist/commands/test.js
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
1
|
import { terminalLink } from "termi-link";
|
|
2
|
-
import { colors as c } from "@cedarjs/cli-helpers";
|
|
2
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
3
3
|
import { workspaces } from "../lib/project.js";
|
|
4
4
|
const command = "test [filter..]";
|
|
5
|
-
const description = "Run
|
|
5
|
+
const description = "Run Vitest tests. Defaults to watch mode";
|
|
6
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");
|
|
7
12
|
yargs.strict(false).positional("filter", {
|
|
8
13
|
default: workspaces(),
|
|
9
14
|
description: "Which side(s) to test, and/or a regular expression to match against your test files to filter by",
|
|
10
15
|
type: "string",
|
|
11
16
|
array: true
|
|
12
|
-
}).option("watch", {
|
|
13
|
-
describe: "Run tests related to changed files based on hg/git. Specify the name or path to a file to focus on a specific set of tests",
|
|
14
|
-
type: "boolean",
|
|
15
|
-
default: true
|
|
16
|
-
}).option("collect-coverage", {
|
|
17
|
-
describe: "Show test coverage summary and output info to coverage directory",
|
|
18
|
-
type: "boolean",
|
|
19
|
-
default: false
|
|
20
17
|
}).option("db-push", {
|
|
21
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.",
|
|
22
19
|
type: "boolean",
|
|
23
20
|
default: true
|
|
24
21
|
}).option("force", {
|
|
25
|
-
describe: "
|
|
22
|
+
describe: "Skip any confirmation prompts and run tests without interruption. Useful in CI or scripted environments.",
|
|
26
23
|
type: "boolean",
|
|
27
24
|
default: false
|
|
28
25
|
}).epilogue(
|
|
29
|
-
`For all available flags, run
|
|
30
|
-
"yarn jest --help"
|
|
31
|
-
)}
|
|
26
|
+
`For all available flags, run vitest cli directly ${vitestTip}
|
|
32
27
|
|
|
33
|
-
Also see the ${
|
|
34
|
-
"CedarJS CLI Reference",
|
|
35
|
-
"https://cedarjs.com/docs/cli-commands#test"
|
|
36
|
-
)}
|
|
28
|
+
Also see the ${cliDocsLink}
|
|
37
29
|
`
|
|
38
30
|
);
|
|
39
31
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import concurrently from "concurrently";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
5
4
|
import { formatRunBinCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
6
5
|
import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
6
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
7
7
|
import { generatePrismaClient } from "../lib/generatePrismaClient.js";
|
|
8
8
|
import { getPaths } from "../lib/index.js";
|
|
9
9
|
const isConcurrentlyErrorArray = (value) => {
|
|
@@ -3,7 +3,7 @@ import { builtinModules } from "node:module";
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import execa from "execa";
|
|
6
|
-
import
|
|
6
|
+
import { tryParse } from "verkit";
|
|
7
7
|
const MAIN_BRANCH_PRERELEASE_TAGS = ["canary"];
|
|
8
8
|
function isExecaError(e) {
|
|
9
9
|
return e instanceof Error && ("stdout" in e || "stderr" in e || "exitCode" in e);
|
|
@@ -13,7 +13,7 @@ async function runPreUpgradeScripts(ctx, task, { verbose, force }) {
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
const version = typeof ctx.versionToUpgradeTo === "string" ? ctx.versionToUpgradeTo : void 0;
|
|
16
|
-
const parsed =
|
|
16
|
+
const parsed = version ? tryParse(version) : null;
|
|
17
17
|
const baseUrl = "https://raw.githubusercontent.com/cedarjs/cedar/main/upgrade-scripts/";
|
|
18
18
|
const manifestUrl = `${baseUrl}manifest.json`;
|
|
19
19
|
let manifest = [];
|
|
@@ -34,7 +34,7 @@ async function runPreUpgradeScripts(ctx, task, { verbose, force }) {
|
|
|
34
34
|
if (!Array.isArray(manifest) || manifest.length === 0) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
const prereleaseTag = parsed?.prerelease[0];
|
|
37
|
+
const prereleaseTag = parsed?.prerelease?.[0];
|
|
38
38
|
const isMainBranchPrerelease = typeof prereleaseTag === "string" && MAIN_BRANCH_PRERELEASE_TAGS.includes(prereleaseTag);
|
|
39
39
|
const checkLevels = [];
|
|
40
40
|
if (parsed && isMainBranchPrerelease) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { terminalLink } from "termi-link";
|
|
2
|
-
import { colors as c } from "@cedarjs/cli-helpers";
|
|
2
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
3
3
|
import { dedupeIsSupported } from "@cedarjs/cli-helpers/packageManager";
|
|
4
4
|
import { isValidCedarJSTag } from "./tags.js";
|
|
5
5
|
const SEMVER_REGEX = /(?<=^v?|\sv?)(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?(?=$|\s)/i;
|
|
@@ -5,7 +5,7 @@ import execa from "execa";
|
|
|
5
5
|
import latestVersion from "latest-version";
|
|
6
6
|
import { Listr } from "listr2";
|
|
7
7
|
import { terminalLink } from "termi-link";
|
|
8
|
-
import {
|
|
8
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
9
9
|
import {
|
|
10
10
|
dedupe,
|
|
11
11
|
dedupeIsSupported,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
installationErrorMessage,
|
|
14
14
|
prettyPrintCedarCommand
|
|
15
15
|
} from "@cedarjs/cli-helpers/packageManager";
|
|
16
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
16
17
|
import { getConfig } from "@cedarjs/project-config";
|
|
17
18
|
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
18
19
|
import { generatePrismaClient } from "../../lib/generatePrismaClient.js";
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,10 @@ import path from "path";
|
|
|
4
4
|
import { trace, SpanStatusCode } from "@opentelemetry/api";
|
|
5
5
|
import { hideBin, Parser } from "yargs/helpers";
|
|
6
6
|
import yargs from "yargs/yargs";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "@cedarjs/cli-helpers";
|
|
12
|
-
import { findUp, projectIsEsm, getConfigPath } from "@cedarjs/project-config";
|
|
7
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
8
|
+
import { loadEnvFiles } from "@cedarjs/cli-helpers/loadEnvFiles";
|
|
9
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
10
|
+
import { findUp, getConfigPath } from "@cedarjs/project-config";
|
|
13
11
|
import { telemetryMiddleware } from "@cedarjs/telemetry";
|
|
14
12
|
import * as buildCommand from "./commands/build.js";
|
|
15
13
|
import * as checkCommand from "./commands/check.js";
|
|
@@ -30,8 +28,6 @@ import * as serveCommand from "./commands/serve.js";
|
|
|
30
28
|
import * as setupCommand from "./commands/setup.js";
|
|
31
29
|
import * as studioCommand from "./commands/studio.js";
|
|
32
30
|
import * as testCommand from "./commands/test.js";
|
|
33
|
-
import * as testCommandEsm from "./commands/testEsm.js";
|
|
34
|
-
import * as tstojsCommand from "./commands/ts-to-js.js";
|
|
35
31
|
import * as typeCheckCommand from "./commands/type-check.js";
|
|
36
32
|
import * as upgradeCommand from "./commands/upgrade/upgrade.js";
|
|
37
33
|
import { exitWithError } from "./lib/exit.js";
|
|
@@ -135,7 +131,7 @@ async function runYargs() {
|
|
|
135
131
|
}).example(
|
|
136
132
|
"yarn cedar g page home /",
|
|
137
133
|
"Create a page component named 'Home' at path '/'"
|
|
138
|
-
).demandCommand().strict().exitProcess(false).alias("h", "help").command(buildCommand).command(checkCommand).command(consoleCommand).command(deployCommand).command(destroyCommand).command(devCommand).command(execCommand).command(experimentalCommand).command(generateCommand).command(infoCommand).command(jobsCommand).command(lintCommand).command(prerenderCommand).command(prismaCommand).command(recordCommand).command(serveCommand).command(setupCommand).command(studioCommand).command(
|
|
134
|
+
).demandCommand().strict().exitProcess(false).alias("h", "help").command(buildCommand).command(checkCommand).command(consoleCommand).command(deployCommand).command(destroyCommand).command(devCommand).command(execCommand).command(experimentalCommand).command(generateCommand).command(infoCommand).command(jobsCommand).command(lintCommand).command(prerenderCommand).command(prismaCommand).command(recordCommand).command(serveCommand).command(setupCommand).command(studioCommand).command(testCommand).command(typeCheckCommand).command(upgradeCommand);
|
|
139
135
|
await loadPlugins(yarg);
|
|
140
136
|
const pkgJson = await import("../package.json", { with: { type: "json" } });
|
|
141
137
|
yarg.version(pkgJson.default["version"]);
|
package/dist/lib/exit.js
CHANGED
|
@@ -4,7 +4,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
4
4
|
import {
|
|
5
5
|
recordTelemetryAttributes,
|
|
6
6
|
recordTelemetryError
|
|
7
|
-
} from "@cedarjs/cli-helpers";
|
|
7
|
+
} from "@cedarjs/cli-helpers/telemetry";
|
|
8
8
|
const discordLink = terminalLink("Discord", "https://cedarjs.com/discord");
|
|
9
9
|
const githubLink = terminalLink("GitHub", "https://github.com/cedarjs/cedar");
|
|
10
10
|
const DEFAULT_ERROR_EPILOGUE = [
|
package/dist/lib/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import https from "node:https";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import * as babel from "@babel/core";
|
|
5
4
|
import boxen from "boxen";
|
|
6
5
|
import camelcase from "camelcase";
|
|
7
6
|
import { paramCase } from "change-case";
|
|
@@ -12,11 +11,12 @@ import memoize from "lodash/memoize.js";
|
|
|
12
11
|
import template from "lodash/template.js";
|
|
13
12
|
import pascalcase from "pascalcase";
|
|
14
13
|
import { format } from "prettier";
|
|
15
|
-
import { colors as c } from "@cedarjs/cli-helpers";
|
|
14
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
16
15
|
import {
|
|
17
16
|
addRootPackages,
|
|
18
17
|
addWorkspacePackages
|
|
19
18
|
} from "@cedarjs/cli-helpers/packageManager/packages";
|
|
19
|
+
import { transpileTSToJS } from "@cedarjs/cli-helpers/transpileTSToJS";
|
|
20
20
|
import {
|
|
21
21
|
getConfig as getCedarConfig,
|
|
22
22
|
getPaths as getCedarPaths,
|
|
@@ -206,29 +206,10 @@ const getPrettierOptions = async () => {
|
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
208
|
const transformTSToJS = async (filename, content) => {
|
|
209
|
-
|
|
210
|
-
filename,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
cwd: process.env.NODE_ENV === "test" ? void 0 : getPaths().base,
|
|
214
|
-
configFile: false,
|
|
215
|
-
plugins: [
|
|
216
|
-
[
|
|
217
|
-
"@babel/plugin-transform-typescript",
|
|
218
|
-
{
|
|
219
|
-
isTSX: true,
|
|
220
|
-
allExtensions: true
|
|
221
|
-
}
|
|
222
|
-
]
|
|
223
|
-
],
|
|
224
|
-
retainLines: true
|
|
225
|
-
});
|
|
226
|
-
if (result?.code == null) {
|
|
227
|
-
throw new Error(
|
|
228
|
-
`Could not transform ${filename} from TypeScript to JavaScript`
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
return prettify(filename.replace(/\.ts(x)?$/, ".js$1"), result.code);
|
|
209
|
+
return prettify(
|
|
210
|
+
filename.replace(/\.ts(x)?$/, ".js$1"),
|
|
211
|
+
transpileTSToJS(filename, content)
|
|
212
|
+
);
|
|
232
213
|
};
|
|
233
214
|
const transformTSToJSMap = async (files, typescript) => {
|
|
234
215
|
return files.reduce(
|
package/dist/lib/loadEnvFiles.js
CHANGED
package/dist/lib/plugin.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import ansis from "ansis";
|
|
4
4
|
import enquirer from "enquirer";
|
|
5
|
-
import { getCompatibilityData } from "@cedarjs/cli-helpers";
|
|
5
|
+
import { getCompatibilityData } from "@cedarjs/cli-helpers/version";
|
|
6
6
|
import { installModule, isModuleInstalled } from "./packages.js";
|
|
7
7
|
import { getPaths } from "./index.js";
|
|
8
8
|
const { Select } = enquirer;
|
|
@@ -45,7 +45,6 @@ const PLUGIN_CACHE_BUILTIN = [
|
|
|
45
45
|
"serve",
|
|
46
46
|
"setup",
|
|
47
47
|
"test",
|
|
48
|
-
"ts-to-js",
|
|
49
48
|
"type-check",
|
|
50
49
|
"tsc",
|
|
51
50
|
"tc",
|
package/dist/lib/test.js
CHANGED
|
@@ -80,7 +80,7 @@ vi.mock("@cedarjs/project-config/packageManager", () => ({
|
|
|
80
80
|
getPackageManager: vi.fn(() => "yarn"),
|
|
81
81
|
resetPackageManagerCache: vi.fn()
|
|
82
82
|
}));
|
|
83
|
-
vi.mock("@cedarjs/cli-helpers", async (importOriginal) => {
|
|
83
|
+
vi.mock("@cedarjs/cli-helpers/project", async (importOriginal) => {
|
|
84
84
|
const originalCliHelpers = await importOriginal();
|
|
85
85
|
return {
|
|
86
86
|
...originalCliHelpers,
|
package/dist/lib/updateCheck.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from "path";
|
|
|
3
3
|
import ansis from "ansis";
|
|
4
4
|
import boxen from "boxen";
|
|
5
5
|
import latestVersion from "latest-version";
|
|
6
|
-
import
|
|
6
|
+
import { isGreater, isValid } from "verkit";
|
|
7
7
|
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
8
8
|
import { getNodeRunnerArgs } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
9
9
|
import { getConfig } from "@cedarjs/project-config";
|
|
@@ -15,7 +15,7 @@ const SHOW_PERIOD = 24 * 60 * 6e4;
|
|
|
15
15
|
const DEFAULT_DATETIME_MS = 9466848e5;
|
|
16
16
|
const CHECK_LOCK_IDENTIFIER = "UPDATE_CHECK";
|
|
17
17
|
const SHOW_LOCK_IDENTIFIER = "UPDATE_CHECK_SHOW";
|
|
18
|
-
const EXCLUDED_COMMANDS = ["upgrade"
|
|
18
|
+
const EXCLUDED_COMMANDS = ["upgrade"];
|
|
19
19
|
let persistenceDirectory;
|
|
20
20
|
function getPersistenceDirectory() {
|
|
21
21
|
if (persistenceDirectory) {
|
|
@@ -34,7 +34,7 @@ function getLocalVersion() {
|
|
|
34
34
|
} catch {
|
|
35
35
|
return void 0;
|
|
36
36
|
}
|
|
37
|
-
if (typeof version === "string" &&
|
|
37
|
+
if (typeof version === "string" && isValid(version)) {
|
|
38
38
|
return version;
|
|
39
39
|
}
|
|
40
40
|
return void 0;
|
|
@@ -106,7 +106,7 @@ function shouldShow() {
|
|
|
106
106
|
const data = readUpdateDataFile();
|
|
107
107
|
let newerVersion = false;
|
|
108
108
|
data.remoteVersions.forEach((version) => {
|
|
109
|
-
newerVersion ||=
|
|
109
|
+
newerVersion ||= isGreater(version, localVersion);
|
|
110
110
|
});
|
|
111
111
|
return data.shownAt < (/* @__PURE__ */ new Date()).getTime() - SHOW_PERIOD && newerVersion;
|
|
112
112
|
}
|
|
@@ -120,7 +120,7 @@ function getUpdateMessage() {
|
|
|
120
120
|
let updateCount = 0;
|
|
121
121
|
let message = ` New updates to Cedar are available via \`${formatCedarCommand(["upgrade#REPLACEME#"])}\` `;
|
|
122
122
|
data.remoteVersions.forEach((version, tag) => {
|
|
123
|
-
if (
|
|
123
|
+
if (isGreater(version, data.localVersion)) {
|
|
124
124
|
updateCount += 1;
|
|
125
125
|
if (tag === localTag) {
|
|
126
126
|
message += `
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { colors as c } from "@cedarjs/cli-helpers";
|
|
1
|
+
import { clean, isGreaterOrEqual } from "verkit";
|
|
2
|
+
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
3
3
|
function checkNodeVersion() {
|
|
4
4
|
const checks = { ok: true };
|
|
5
5
|
const pVersion = process.version;
|
|
6
|
-
const pVersionC =
|
|
6
|
+
const pVersionC = clean(pVersion);
|
|
7
7
|
const LOWER_BOUND = "v24.0.0";
|
|
8
8
|
if (!pVersionC) {
|
|
9
9
|
checks.ok = false;
|
|
10
10
|
checks.message = `Invalid Node.js version: ${pVersion}`;
|
|
11
11
|
return checks;
|
|
12
12
|
}
|
|
13
|
-
if (
|
|
13
|
+
if (isGreaterOrEqual(pVersionC, LOWER_BOUND)) {
|
|
14
14
|
return checks;
|
|
15
15
|
}
|
|
16
16
|
checks.ok = false;
|
package/dist/telemetry/index.js
CHANGED
|
@@ -22,6 +22,8 @@ async function startTelemetry() {
|
|
|
22
22
|
isStarted = true;
|
|
23
23
|
try {
|
|
24
24
|
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR);
|
|
25
|
+
traceExporter = new CustomFileExporter();
|
|
26
|
+
traceProcessor = new SimpleSpanProcessor(traceExporter);
|
|
25
27
|
traceProvider = new NodeTracerProvider({
|
|
26
28
|
sampler: {
|
|
27
29
|
shouldSample: () => {
|
|
@@ -32,11 +34,9 @@ async function startTelemetry() {
|
|
|
32
34
|
toString: () => {
|
|
33
35
|
return "AlwaysSampleWhenNotShutdown";
|
|
34
36
|
}
|
|
35
|
-
}
|
|
37
|
+
},
|
|
38
|
+
spanProcessors: [traceProcessor]
|
|
36
39
|
});
|
|
37
|
-
traceExporter = new CustomFileExporter();
|
|
38
|
-
traceProcessor = new SimpleSpanProcessor(traceExporter);
|
|
39
|
-
traceProvider.addSpanProcessor(traceProcessor);
|
|
40
40
|
traceProvider.register();
|
|
41
41
|
const cleanArgv = hideBin(process.argv);
|
|
42
42
|
if (!cleanArgv.includes("sb") && !cleanArgv.includes("storybook")) {
|
|
@@ -79,7 +79,7 @@ async function getResources() {
|
|
|
79
79
|
"vscode.version": info.IDEs?.VSCode?.version,
|
|
80
80
|
"cpu.count": cpu.physicalCores,
|
|
81
81
|
"memory.gb": Math.round(mem.total / 1073741824),
|
|
82
|
-
"env.node_env": process.env.NODE_ENV ||
|
|
82
|
+
"env.node_env": process.env.NODE_ENV || void 0,
|
|
83
83
|
"ci.redwood": !!process.env.CEDAR_CI,
|
|
84
84
|
"ci.isci": ci.isCI,
|
|
85
85
|
"dev.environment": developmentEnvironment,
|
package/dist/telemetry/send.js
CHANGED
|
@@ -2,7 +2,10 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { ExportResultCode } from "@opentelemetry/core";
|
|
4
4
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
defaultResource,
|
|
7
|
+
resourceFromAttributes
|
|
8
|
+
} from "@opentelemetry/resources";
|
|
6
9
|
import { getPaths } from "@cedarjs/project-config";
|
|
7
10
|
import { getResources } from "./resource.js";
|
|
8
11
|
async function main() {
|
|
@@ -20,7 +23,9 @@ async function main() {
|
|
|
20
23
|
console.time("Computed resource information");
|
|
21
24
|
const customResourceData = await getResources();
|
|
22
25
|
console.timeEnd("Computed resource information");
|
|
23
|
-
const resource =
|
|
26
|
+
const resource = defaultResource().merge(
|
|
27
|
+
resourceFromAttributes(customResourceData)
|
|
28
|
+
);
|
|
24
29
|
const url = process.env.CEDAR_REDIRECT_TELEMETRY || process.env.REDWOOD_REDIRECT_TELEMETRY || "https://quark.quantumparticle.io/v1/traces";
|
|
25
30
|
const traceExporter = new OTLPTraceExporter({
|
|
26
31
|
url
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3-next.275",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,26 +36,26 @@
|
|
|
36
36
|
"@babel/preset-typescript": "7.29.7",
|
|
37
37
|
"@babel/traverse": "7.29.8",
|
|
38
38
|
"@babel/types": "7.29.8",
|
|
39
|
-
"@cedarjs/api-server": "6.0.
|
|
40
|
-
"@cedarjs/babel-config": "6.0.
|
|
41
|
-
"@cedarjs/cli-helpers": "6.0.
|
|
42
|
-
"@cedarjs/internal": "6.0.
|
|
43
|
-
"@cedarjs/prerender": "6.0.
|
|
44
|
-
"@cedarjs/project-config": "6.0.
|
|
45
|
-
"@cedarjs/structure": "6.0.
|
|
46
|
-
"@cedarjs/telemetry": "6.0.
|
|
47
|
-
"@cedarjs/utils": "6.0.
|
|
48
|
-
"@cedarjs/vite": "6.0.
|
|
49
|
-
"@cedarjs/web-server": "6.0.
|
|
39
|
+
"@cedarjs/api-server": "6.0.3-next.275",
|
|
40
|
+
"@cedarjs/babel-config": "6.0.3-next.275",
|
|
41
|
+
"@cedarjs/cli-helpers": "6.0.3-next.275",
|
|
42
|
+
"@cedarjs/internal": "6.0.3-next.275",
|
|
43
|
+
"@cedarjs/prerender": "6.0.3-next.275",
|
|
44
|
+
"@cedarjs/project-config": "6.0.3-next.275",
|
|
45
|
+
"@cedarjs/structure": "6.0.3-next.275",
|
|
46
|
+
"@cedarjs/telemetry": "6.0.3-next.275",
|
|
47
|
+
"@cedarjs/utils": "6.0.3-next.275",
|
|
48
|
+
"@cedarjs/vite": "6.0.3-next.275",
|
|
49
|
+
"@cedarjs/web-server": "6.0.3-next.275",
|
|
50
50
|
"@listr2/prompt-adapter-enquirer": "4.3.2",
|
|
51
51
|
"@opentelemetry/api": "1.9.1",
|
|
52
|
-
"@opentelemetry/core": "
|
|
53
|
-
"@opentelemetry/exporter-trace-otlp-http": "0.
|
|
54
|
-
"@opentelemetry/resources": "
|
|
55
|
-
"@opentelemetry/sdk-trace-node": "
|
|
56
|
-
"@opentelemetry/semantic-conventions": "1.
|
|
57
|
-
"@prisma/internals": "7.
|
|
58
|
-
"ansis": "4.
|
|
52
|
+
"@opentelemetry/core": "2.11.0",
|
|
53
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.222.0",
|
|
54
|
+
"@opentelemetry/resources": "2.11.0",
|
|
55
|
+
"@opentelemetry/sdk-trace-node": "2.11.0",
|
|
56
|
+
"@opentelemetry/semantic-conventions": "1.43.0",
|
|
57
|
+
"@prisma/internals": "7.10.0",
|
|
58
|
+
"ansis": "4.4.0",
|
|
59
59
|
"archiver": "7.0.1",
|
|
60
60
|
"boxen": "5.1.2",
|
|
61
61
|
"camel-case": "4.1.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.8
|
|
82
|
+
"prettier": "3.9.8",
|
|
83
83
|
"prisma": "7.10.0",
|
|
84
84
|
"prompts": "2.4.2",
|
|
85
|
-
"semver": "7.8.5",
|
|
86
85
|
"smol-toml": "1.8.0",
|
|
87
|
-
"srvx": "0.12.
|
|
86
|
+
"srvx": "0.12.8",
|
|
88
87
|
"string-env-interpolation": "1.0.1",
|
|
89
|
-
"systeminformation": "5.33.
|
|
88
|
+
"systeminformation": "5.33.11",
|
|
90
89
|
"termi-link": "1.1.0",
|
|
91
90
|
"title-case": "3.0.3",
|
|
92
91
|
"unionfs": "4.6.0",
|
|
93
|
-
"uuid": "11.1.
|
|
92
|
+
"uuid": "11.1.1",
|
|
93
|
+
"verkit": "0.4.0",
|
|
94
94
|
"yargs": "17.7.3"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@cedarjs/framework-tools": "6.0.
|
|
98
|
-
"@prisma/dmmf": "7.
|
|
97
|
+
"@cedarjs/framework-tools": "6.0.3-next.275",
|
|
98
|
+
"@prisma/dmmf": "7.10.0",
|
|
99
99
|
"@types/archiver": "^7.0.0",
|
|
100
|
-
"memfs": "4.
|
|
100
|
+
"memfs": "4.78.1",
|
|
101
101
|
"node-ssh": "13.2.1",
|
|
102
102
|
"ts-dedent": "2.3.0",
|
|
103
103
|
"typescript": "5.9.3",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
2
|
-
const command = "tsconfig";
|
|
3
|
-
const description = "Set up tsconfig for web and api sides";
|
|
4
|
-
const builder = (yargs) => {
|
|
5
|
-
yargs.option("force", {
|
|
6
|
-
alias: "f",
|
|
7
|
-
default: false,
|
|
8
|
-
description: "Overwrite existing tsconfig.json files",
|
|
9
|
-
type: "boolean"
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
const handler = async (options) => {
|
|
13
|
-
recordTelemetryAttributes({
|
|
14
|
-
command: "setup tsconfig",
|
|
15
|
-
force: options.force
|
|
16
|
-
});
|
|
17
|
-
const { handler: handler2 } = await import("./tsconfigHandler.js");
|
|
18
|
-
return handler2(options);
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
builder,
|
|
22
|
-
command,
|
|
23
|
-
description,
|
|
24
|
-
handler
|
|
25
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { Listr } from "listr2";
|
|
3
|
-
import { terminalLink } from "termi-link";
|
|
4
|
-
import { colors as c } from "@cedarjs/cli-helpers";
|
|
5
|
-
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
6
|
-
import {
|
|
7
|
-
getInstalledCedarVersion,
|
|
8
|
-
getPaths,
|
|
9
|
-
saveRemoteFileToDisk
|
|
10
|
-
} from "../../../lib/index.js";
|
|
11
|
-
const handler = async ({ force }) => {
|
|
12
|
-
const installedRwVersion = await getInstalledCedarVersion();
|
|
13
|
-
const GITHUB_VERSION_TAG = installedRwVersion.match("canary") ? "main" : `v${installedRwVersion}`;
|
|
14
|
-
const CRWA_TEMPLATE_URL = `https://raw.githubusercontent.com/redwoodjs/redwood/${GITHUB_VERSION_TAG}/packages/create-cedar-app/templates/ts`;
|
|
15
|
-
const tasks = new Listr(
|
|
16
|
-
[
|
|
17
|
-
{
|
|
18
|
-
title: "Creating tsconfig in web",
|
|
19
|
-
task: () => {
|
|
20
|
-
const webConfigPath = path.join(getPaths().web.base, "tsconfig.json");
|
|
21
|
-
const templateUrl = `${CRWA_TEMPLATE_URL}/web/tsconfig.json`;
|
|
22
|
-
return saveRemoteFileToDisk(templateUrl, webConfigPath, {
|
|
23
|
-
overwriteExisting: force
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
title: "Creating tsconfig in api",
|
|
29
|
-
task: () => {
|
|
30
|
-
const webConfigPath = path.join(getPaths().api.base, "tsconfig.json");
|
|
31
|
-
const templateUrl = `${CRWA_TEMPLATE_URL}/api/tsconfig.json`;
|
|
32
|
-
return saveRemoteFileToDisk(templateUrl, webConfigPath, {
|
|
33
|
-
overwriteExisting: force
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
title: "One more thing...",
|
|
39
|
-
task: (_ctx, task) => {
|
|
40
|
-
task.title = `One more thing...
|
|
41
|
-
|
|
42
|
-
${c.tip("Quick link to the docs on configuring TypeScript")}
|
|
43
|
-
${terminalLink("", "https://cedarjs.com/docs/typescript")}
|
|
44
|
-
`;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
{ rendererOptions: { collapseSubtasks: false } }
|
|
49
|
-
);
|
|
50
|
-
try {
|
|
51
|
-
await tasks.run();
|
|
52
|
-
} catch (e) {
|
|
53
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
54
|
-
errorTelemetry(process.argv, message);
|
|
55
|
-
console.error(c.error(message));
|
|
56
|
-
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
57
|
-
process.exit(exitCode);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
export {
|
|
61
|
-
handler
|
|
62
|
-
};
|
|
@@ -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
|
-
}
|