@wasp.sh/wasp-cli-darwin-arm64-unknown 0.23.0 → 0.24.0-rc.2
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/data/Cli/starters/basic/main.wasp.ts +60 -0
- package/data/Cli/starters/basic/package.json +4 -1
- package/data/Cli/starters/basic/prettier.config.mjs +9 -0
- package/data/Cli/starters/basic/src/tags/tags.wasp.ts +8 -0
- package/data/Cli/starters/basic/src/tasks/task.wasp.ts +16 -0
- package/data/Cli/starters/minimal/main.wasp.ts +12 -0
- package/data/Cli/starters/minimal/package.json +4 -1
- package/data/Cli/starters/skeleton/AGENTS.md +23 -0
- package/data/Cli/starters/skeleton/CLAUDE.md +23 -0
- package/data/Cli/starters/skeleton/tsconfig.json +5 -26
- package/data/Cli/starters/{ts-minimal → skeleton}/tsconfig.src.json +2 -1
- package/data/Cli/starters/{ts-minimal → skeleton}/tsconfig.wasp.json +5 -2
- package/data/Generator/libs/auth/{wasp.sh-lib-auth-0.23.0.tgz → wasp.sh-lib-auth-0.24.0.tgz} +0 -0
- package/data/Generator/libs/vite-ssr/{wasp.sh-lib-vite-ssr-0.23.0.tgz → wasp.sh-lib-vite-ssr-0.24.0.tgz} +0 -0
- package/data/Generator/templates/sdk/wasp/api/index.ts +51 -47
- package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +5 -2
- package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +9 -4
- package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +5 -2
- package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +5 -2
- package/data/Generator/templates/sdk/wasp/auth/responseSchemas.ts +10 -0
- package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +2 -2
- package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +5 -3
- package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +3 -2
- package/data/Generator/templates/sdk/wasp/client/app/layout.tsx +13 -20
- package/data/Generator/templates/sdk/wasp/client/app/pages/OAuthCallback.tsx +12 -11
- package/data/Generator/templates/sdk/wasp/client/env/schema.ts +8 -8
- package/data/Generator/templates/sdk/wasp/client/env.ts +2 -2
- package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +4 -2
- package/data/Generator/templates/sdk/wasp/client/router/NavLink.tsx +21 -0
- package/data/Generator/templates/sdk/wasp/client/router/index.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/typescriptCheck.ts +8 -4
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/validateEnv.ts +72 -44
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/wasp.ts +1 -1
- package/data/Generator/templates/sdk/wasp/tsconfig.json +3 -0
- package/data/Generator/templates/types/spec/register.ts +14 -0
- package/data/packages/deploy/dist/providers/railway/commands/setup/setup.js +9 -0
- package/data/packages/deploy/dist/providers/railway/jsonOutputSchemas.js +47 -0
- package/data/packages/deploy/dist/providers/railway/railwayService/deployment.js +45 -0
- package/data/packages/deploy/package-lock.json +2 -2
- package/data/packages/deploy/package.json +1 -1
- package/data/packages/prisma/package-lock.json +2 -2
- package/data/packages/prisma/package.json +1 -2
- package/data/packages/spec/dist/__tests__/cli.unit.test.js +128 -0
- package/data/packages/spec/dist/__tests__/legacy/appAnalyzer.unit.test.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/appAnalyzer.unit.test.js +3 -3
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.integration.test.js +2 -2
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.unit.test.js +4 -18
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.d.ts +4 -4
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.js +2 -2
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.test-d.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.js +68 -0
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.js +814 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.test-d.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.test-d.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.test-d.js +148 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.js +49 -0
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.js +204 -0
- package/data/packages/spec/dist/__tests__/spec/testFixtures.d.ts +85 -0
- package/data/packages/spec/dist/__tests__/spec/testFixtures.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/testFixtures.js +473 -0
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.js +44 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.js +218 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.js +174 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.js +119 -0
- package/data/packages/{wasp-config → spec}/dist/src/appSpec.d.ts +11 -4
- package/data/packages/spec/dist/src/appSpec.d.ts.map +1 -0
- package/data/packages/{wasp-config → spec}/dist/src/cli.d.ts +3 -1
- package/data/packages/spec/dist/src/cli.d.ts.map +1 -0
- package/data/packages/spec/dist/src/cli.js +28 -0
- package/data/packages/spec/dist/src/index.d.ts +2 -0
- package/data/packages/spec/dist/src/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/index.js +1 -0
- package/data/packages/spec/dist/src/internal.d.ts +2 -0
- package/data/packages/spec/dist/src/internal.d.ts.map +1 -0
- package/data/packages/spec/dist/src/internal.js +1 -0
- package/data/packages/spec/dist/src/legacy/_private.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/appAnalyzer.d.ts +1 -1
- package/data/packages/spec/dist/src/legacy/appAnalyzer.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/mapTsAppSpecToAppSpecDecls.d.ts +1 -1
- package/data/packages/spec/dist/src/legacy/mapTsAppSpecToAppSpecDecls.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/mapTsAppSpecToAppSpecDecls.js +3 -6
- package/data/packages/spec/dist/src/legacy/publicApi/App.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/tsAppSpec.d.ts +3 -3
- package/data/packages/spec/dist/src/legacy/publicApi/tsAppSpec.d.ts.map +1 -0
- package/data/packages/spec/dist/src/run.js +28 -0
- package/data/packages/spec/dist/src/spec/appAnalyzer.d.ts +8 -0
- package/data/packages/spec/dist/src/spec/appAnalyzer.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/appAnalyzer.js +35 -0
- package/data/packages/spec/dist/src/spec/mapApp.d.ts +54 -0
- package/data/packages/spec/dist/src/spec/mapApp.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/mapApp.js +336 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts +296 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.js +277 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.js +2 -0
- package/data/packages/spec/dist/src/spec/publicApi/register.d.ts +9 -0
- package/data/packages/spec/dist/src/spec/publicApi/register.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/register.js +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts +872 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.js +1 -0
- package/data/packages/spec/dist/src/spec/refObject.d.ts +95 -0
- package/data/packages/spec/dist/src/spec/refObject.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/refObject.js +119 -0
- package/data/packages/spec/dist/src/spec/refObjectPath.d.ts +18 -0
- package/data/packages/spec/dist/src/spec/refObjectPath.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/refObjectPath.js +79 -0
- package/data/packages/spec/dist/src/spec/specUserError.d.ts +9 -0
- package/data/packages/spec/dist/src/spec/specUserError.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/specUserError.js +8 -0
- package/data/packages/spec/dist/src/spec-pipeline/common.d.ts +2 -0
- package/data/packages/spec/dist/src/spec-pipeline/common.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/common.js +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.js +46 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.d.ts +4 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.js +34 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.d.ts +3 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.js +14 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.js +40 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.d.ts +26 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.js +57 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/index.d.ts +3 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/index.js +8 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/apply.d.ts +4 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/apply.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/apply.js +18 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.d.ts +3 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.js +13 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.js +40 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/plan.d.ts +19 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/plan.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/plan.js +60 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/util.d.ts +10 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/util.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/util.js +53 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.js +38 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/project.d.ts +9 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/project.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/project.js +66 -0
- package/data/packages/spec/dist/src/typeUtils.d.ts +3 -0
- package/data/packages/spec/dist/src/typeUtils.d.ts.map +1 -0
- package/data/packages/spec/dist/src/typeUtils.js +1 -0
- package/data/packages/{wasp-config → spec}/package-lock.json +921 -1475
- package/data/packages/spec/package.json +48 -0
- package/data/packages/studio/package-lock.json +2 -2
- package/data/packages/studio/package.json +1 -1
- package/data/packages/ts-inspect/package-lock.json +2 -2
- package/data/packages/ts-inspect/package.json +1 -1
- package/package.json +1 -1
- package/wasp-bin +0 -0
- package/data/Cli/starters/basic/.prettierrc +0 -3
- package/data/Cli/starters/basic/main.wasp +0 -100
- package/data/Cli/starters/minimal/main.wasp +0 -14
- package/data/Cli/starters/ts-minimal/main.wasp.ts +0 -15
- package/data/Cli/starters/ts-minimal/package.json +0 -18
- package/data/Cli/starters/ts-minimal/schema.prisma +0 -10
- package/data/Cli/starters/ts-minimal/src/Main.css +0 -103
- package/data/Cli/starters/ts-minimal/src/MainPage.tsx +0 -37
- package/data/Cli/starters/ts-minimal/src/assets/logo.svg +0 -1
- package/data/Cli/starters/ts-minimal/tsconfig.json +0 -7
- package/data/Cli/starters/ts-minimal/vite.config.ts +0 -9
- package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/cli.unit.test.js +0 -65
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/_private.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/appSpec.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/cli.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/cli.js +0 -24
- package/data/packages/wasp-config/dist/src/index.d.ts +0 -8
- package/data/packages/wasp-config/dist/src/index.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/index.js +0 -1
- package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/publicApi/App.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/run.js +0 -18
- package/data/packages/wasp-config/package.json +0 -40
- /package/data/packages/{wasp-config → spec}/dist/__tests__/cli.unit.test.d.ts +0 -0
- /package/data/packages/{wasp-config → spec}/dist/__tests__/cli.unit.test.d.ts.map +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/appAnalyzer.unit.test.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.integration.test.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.unit.test.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.test-d.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.test-d.js +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/appSpec.js +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/branded.d.ts +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/branded.d.ts.map +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/branded.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/_private.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/_private.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/appAnalyzer.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/App.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/App.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/tsAppSpec.js +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/run.d.ts +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/run.d.ts.map +0 -0
|
@@ -28,12 +28,12 @@ const waspProdClientEnvSchema = z.object({
|
|
|
28
28
|
"{= serverUrlEnvVarName =}": serverUrlSchema,
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
+
const waspClientEnvSchema = import.meta.env.MODE === "production"
|
|
32
|
+
? waspProdClientEnvSchema
|
|
33
|
+
: waspDevClientEnvSchema;
|
|
34
|
+
|
|
31
35
|
// PRIVATE API (sdk, Vite config)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
? waspProdClientEnvSchema
|
|
37
|
-
: waspDevClientEnvSchema;
|
|
38
|
-
return z.object({ ...userClientEnvSchema.shape, ...waspClientEnvSchema.shape })
|
|
39
|
-
}
|
|
36
|
+
export const clientEnvSchema = z.object({
|
|
37
|
+
...userClientEnvSchema.shape,
|
|
38
|
+
...waspClientEnvSchema.shape,
|
|
39
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ensureEnvSchema } from "../env/validation.js";
|
|
2
|
-
import {
|
|
2
|
+
import { clientEnvSchema } from "./env/schema.js";
|
|
3
3
|
|
|
4
4
|
// PUBLIC API
|
|
5
5
|
export const env = ensureEnvSchema(
|
|
6
6
|
import.meta.env,
|
|
7
|
-
|
|
7
|
+
clientEnvSchema,
|
|
8
8
|
);
|
|
@@ -9,8 +9,10 @@ export type OperationRoute = { method: HttpMethod.Post, path: string }
|
|
|
9
9
|
export async function callOperation(operationRoute: OperationRoute, args: any) {
|
|
10
10
|
try {
|
|
11
11
|
const serializedArgs = serialize(args)
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const json = await api.post(operationRoute.path, {
|
|
13
|
+
json: serializedArgs,
|
|
14
|
+
}).json()
|
|
15
|
+
return deserialize(json as any)
|
|
14
16
|
} catch (error) {
|
|
15
17
|
throw handleApiError(error)
|
|
16
18
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import { NavLink as RouterNavLink } from 'react-router'
|
|
3
|
+
import { interpolatePath } from './linkHelpers'
|
|
4
|
+
import { type Routes } from './index'
|
|
5
|
+
|
|
6
|
+
type RouterNavLinkProps = Parameters<typeof RouterNavLink>[0]
|
|
7
|
+
|
|
8
|
+
// PUBLIC API
|
|
9
|
+
export function NavLink(
|
|
10
|
+
{ to, params, search, hash, ...restOfProps }: Omit<RouterNavLinkProps, "to">
|
|
11
|
+
& {
|
|
12
|
+
search?: Record<string, string>;
|
|
13
|
+
hash?: string;
|
|
14
|
+
}
|
|
15
|
+
& Routes
|
|
16
|
+
): React.JSX.Element {
|
|
17
|
+
const toPropWithParams = useMemo(() => {
|
|
18
|
+
return interpolatePath(to, params, search, hash)
|
|
19
|
+
}, [to, params, search, hash])
|
|
20
|
+
return <RouterNavLink to={toPropWithParams} {...restOfProps} />
|
|
21
|
+
}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { type Plugin } from 'vite'
|
|
2
2
|
import { spawn } from 'node:child_process'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface TypeScriptCheckOptions {
|
|
5
|
+
srcTsConfigPath: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function typescriptCheck(options: TypeScriptCheckOptions): Plugin {
|
|
5
9
|
return {
|
|
6
10
|
name: 'wasp:typescript-check',
|
|
7
11
|
apply: 'build',
|
|
8
12
|
async buildStart() {
|
|
9
|
-
await runTsc()
|
|
13
|
+
await runTsc(options.srcTsConfigPath)
|
|
10
14
|
},
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
function runTsc(): Promise<void> {
|
|
18
|
+
function runTsc(srcTsConfigPath: string): Promise<void> {
|
|
15
19
|
return new Promise((resolve, reject) => {
|
|
16
20
|
const child = spawn(
|
|
17
21
|
'tsc',
|
|
18
|
-
['--
|
|
22
|
+
['--project', srcTsConfigPath, '--noEmit'],
|
|
19
23
|
{
|
|
20
24
|
stdio: 'inherit',
|
|
21
25
|
shell: process.platform === 'win32',
|
|
@@ -1,54 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
import path from "node:path";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
type Plugin,
|
|
5
|
+
type ResolvedConfig,
|
|
6
|
+
createServer as createViteServer,
|
|
7
|
+
isRunnableDevEnvironment
|
|
8
|
+
} from "vite";
|
|
9
|
+
|
|
10
|
+
const PLUGIN_NAME = "wasp:validate-env";
|
|
11
|
+
const CLIENT_ENV_SCHEMA_VALIDATION_MODULE = "{= clientEnvSchemaValidationModulePath =}"
|
|
10
12
|
|
|
11
13
|
export function validateEnv(): Plugin {
|
|
12
|
-
let
|
|
14
|
+
let resolvedConfig: ResolvedConfig;
|
|
15
|
+
|
|
13
16
|
return {
|
|
14
|
-
name:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
name: PLUGIN_NAME,
|
|
18
|
+
configResolved(config) {
|
|
19
|
+
resolvedConfig = config;
|
|
20
|
+
},
|
|
21
|
+
// We validate just before any artifacts are built.
|
|
22
|
+
async buildStart() {
|
|
23
|
+
// We need to import the client env schema validation module
|
|
24
|
+
// through a Vite server, because both the user and the Wasp schema
|
|
25
|
+
// modules may depend on bundler features.
|
|
26
|
+
// Because of that we spin up a tepomrary Vite server.
|
|
27
|
+
//
|
|
28
|
+
// Alternatively, for `serve`, we could use the Vite server provided
|
|
29
|
+
// through the `configureServer` hook, but that would complicate
|
|
30
|
+
// the solution for negligible performance benefits.
|
|
31
|
+
const tempServer = await createViteServer({
|
|
32
|
+
root: resolvedConfig.root,
|
|
33
|
+
mode: resolvedConfig.mode,
|
|
34
|
+
// To ensure we pick up all user-defined plugins (resolution matches the main build)
|
|
35
|
+
// while avoiding recursion. This includes the `wasp` plugin.
|
|
36
|
+
configFile: false,
|
|
37
|
+
plugins: resolvedConfig.plugins
|
|
38
|
+
.filter((plugin) => plugin.name !== PLUGIN_NAME)
|
|
39
|
+
// Vite's `configureServer`/`configurePreviewServer` hooks let plugins
|
|
40
|
+
// wire long-lived behavior into a dev or preview server: middleware,
|
|
41
|
+
// websocket handlers, file watchers, and similar background tasks.
|
|
42
|
+
//
|
|
43
|
+
// Plugins are supposed to clean these up by returning a teardown
|
|
44
|
+
// function from the hook, but some forget to, so resources they
|
|
45
|
+
// allocate end up outliving the server. This forces the original
|
|
46
|
+
// Vite process to be alive indefinitely.
|
|
47
|
+
//
|
|
48
|
+
// We don't need either hook to validate the client env schema.
|
|
49
|
+
// We only need module resolution and transforms.
|
|
50
|
+
.map((plugin) => ({
|
|
51
|
+
...plugin,
|
|
52
|
+
configureServer: undefined,
|
|
53
|
+
configurePreviewServer: undefined,
|
|
54
|
+
})),
|
|
55
|
+
// Minimize side effects from spinning up a temporary dev server.
|
|
56
|
+
appType: 'custom', // avoid HTML handling
|
|
57
|
+
server: {
|
|
58
|
+
middlewareMode: true, // do not start an actual HTTP server
|
|
59
|
+
watch: null,
|
|
60
|
+
hmr: false
|
|
61
|
+
},
|
|
62
|
+
logLevel: "silent",
|
|
63
|
+
optimizeDeps: { noDiscovery: true, include: [] },
|
|
64
|
+
clearScreen: false,
|
|
25
65
|
});
|
|
26
|
-
const schema = getClientEnvSchema(config.mode);
|
|
27
|
-
validationResult = getValidatedEnvOrError(env, schema);
|
|
28
66
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
67
|
+
try {
|
|
68
|
+
// Vite's `ssr` means bundled for "backend JS runtime", like Node.
|
|
69
|
+
// This envrionemnt is always runnable in vite dev server.
|
|
70
|
+
if (!isRunnableDevEnvironment(tempServer.environments.ssr)) {
|
|
71
|
+
throw new Error(`Expected ssr to be a runnable dev environment`)
|
|
72
|
+
}
|
|
73
|
+
// The imported module runs env schema validation as an import
|
|
74
|
+
// side-effect and throws on failure.
|
|
75
|
+
const moduleAbsPath = path.resolve(resolvedConfig.root, CLIENT_ENV_SCHEMA_VALIDATION_MODULE);
|
|
76
|
+
await tempServer.environments.ssr.runner.import(moduleAbsPath);
|
|
77
|
+
} finally {
|
|
78
|
+
await tempServer.close();
|
|
34
79
|
}
|
|
35
80
|
},
|
|
36
|
-
configureServer: (server) => {
|
|
37
|
-
if (validationResult === null || validationResult.success) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Send the error to the browser.
|
|
42
|
-
const validationErrorMessage = formatZodEnvError(validationResult.error);
|
|
43
|
-
server.ws.on("connection", () => {
|
|
44
|
-
server.ws.send({
|
|
45
|
-
type: "error",
|
|
46
|
-
err: {
|
|
47
|
-
message: validationErrorMessage,
|
|
48
|
-
stack: "",
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
81
|
};
|
|
54
82
|
}
|
|
@@ -27,7 +27,7 @@ export function wasp(options?: WaspPluginOptions): PluginOption {
|
|
|
27
27
|
/**
|
|
28
28
|
* Plugins running after core Vite plugins.
|
|
29
29
|
*/
|
|
30
|
-
typescriptCheck(),
|
|
30
|
+
typescriptCheck({ srcTsConfigPath: "{= srcTsConfigPath =}" }),
|
|
31
31
|
validateEnv(),
|
|
32
32
|
react(options?.reactOptions),
|
|
33
33
|
ssr({
|
|
@@ -94,5 +94,8 @@
|
|
|
94
94
|
// web-app runtime via Vite virtual modules. That's why we don't want the
|
|
95
95
|
// SDK to compile them.
|
|
96
96
|
"client/vite/virtual-files/files",
|
|
97
|
+
// Wasp spec files shouldn't be compiled by the SDK because they are used to
|
|
98
|
+
// configure Wasp and not part of the SDK runtime.
|
|
99
|
+
"**/*.wasp.ts",
|
|
97
100
|
]
|
|
98
101
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
// The import ensures the module is always loaded into the bundle.
|
|
3
|
+
// Otherwise, module augmentation can fail if it wasn't loaded.
|
|
4
|
+
import "{= waspSpecPackageName =}";
|
|
5
|
+
|
|
6
|
+
declare module "{= waspSpecPackageName =}" {
|
|
7
|
+
export interface Register {
|
|
8
|
+
entities: {
|
|
9
|
+
{=# entities =}
|
|
10
|
+
{= name =}: "{= name =}";
|
|
11
|
+
{=/ entities =}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,7 @@ import { getRailwayEnvVarValueReference } from "../../env.js";
|
|
|
9
9
|
import { clientAppPort, serverAppPort } from "../../ports.js";
|
|
10
10
|
import { initRailwayProject, linkRailwayProjectToWaspProjectDir, } from "../../railwayProject/cli.js";
|
|
11
11
|
import { getRailwayProjectStatus, ProjectStatus, } from "../../railwayProject/index.js";
|
|
12
|
+
import { waitForServiceDeploymentSuccess } from "../../railwayService/deployment.js";
|
|
12
13
|
import { generateServiceUrl } from "../../railwayService/url.js";
|
|
13
14
|
export async function setup(projectName, options) {
|
|
14
15
|
waspSays("Setting up your Wasp app with Railway!");
|
|
@@ -99,6 +100,11 @@ async function setupDb({ cmdOptions: options, dbServiceName, }) {
|
|
|
99
100
|
// Use the default Railway Postgres template.
|
|
100
101
|
await railwayCli(["add", "-d", "postgres"]);
|
|
101
102
|
}
|
|
103
|
+
// The database service deploys asynchronously and `railway add` doesn't wait
|
|
104
|
+
// for it. The server service references the database's DATABASE_URL env
|
|
105
|
+
// variable, and Railway references to a service that isn't fully set up
|
|
106
|
+
// silently resolve to an empty string and never recover.
|
|
107
|
+
await waitForServiceDeploymentSuccess(dbServiceName, options);
|
|
102
108
|
}
|
|
103
109
|
async function setupServer({ cmdOptions: options, serverServiceName, clientServiceName, dbServiceName, }) {
|
|
104
110
|
waspSays(`Setting up server app with name ${serverServiceName}`);
|
|
@@ -139,6 +145,9 @@ async function setupClient({ cmdOptions: options, clientServiceName, }) {
|
|
|
139
145
|
"add",
|
|
140
146
|
["--service", clientServiceName],
|
|
141
147
|
["--variables", `PORT=${clientAppPort}`],
|
|
148
|
+
// So Railpack detects the output as static files even when there's not an
|
|
149
|
+
// `index.html`.
|
|
150
|
+
["--variables", `RAILPACK_STATIC_FILE_ROOT=1`],
|
|
142
151
|
...options.clientSecret.map((secret) => ["--variables", secret]),
|
|
143
152
|
].flat());
|
|
144
153
|
waspSays("Client setup complete!");
|
|
@@ -13,6 +13,53 @@ export const RailwayCliProjectSchema = z.object({
|
|
|
13
13
|
}),
|
|
14
14
|
});
|
|
15
15
|
export const RailwayProjectListSchema = z.array(RailwayCliProjectSchema);
|
|
16
|
+
export const DeploymentStatusSchema = z.enum([
|
|
17
|
+
"BUILDING",
|
|
18
|
+
"CRASHED",
|
|
19
|
+
"DEPLOYING",
|
|
20
|
+
"FAILED",
|
|
21
|
+
"INITIALIZING",
|
|
22
|
+
"NEEDS_APPROVAL",
|
|
23
|
+
"QUEUED",
|
|
24
|
+
"REMOVED",
|
|
25
|
+
"REMOVING",
|
|
26
|
+
"SKIPPED",
|
|
27
|
+
"SLEEPING",
|
|
28
|
+
"SUCCESS",
|
|
29
|
+
"WAITING",
|
|
30
|
+
]);
|
|
31
|
+
const GroupedServiceInstancesSchema = z.object({
|
|
32
|
+
edges: z.array(z.object({
|
|
33
|
+
node: z.object({
|
|
34
|
+
serviceInstances: z.object({
|
|
35
|
+
edges: z.array(z.object({
|
|
36
|
+
node: z.object({
|
|
37
|
+
serviceName: z.string(),
|
|
38
|
+
latestDeployment: z
|
|
39
|
+
.object({
|
|
40
|
+
status: DeploymentStatusSchema,
|
|
41
|
+
})
|
|
42
|
+
.nullish(),
|
|
43
|
+
}),
|
|
44
|
+
})),
|
|
45
|
+
}),
|
|
46
|
+
}),
|
|
47
|
+
})),
|
|
48
|
+
});
|
|
49
|
+
// Railway CLI >=4.35 nests service instances under `environments`.
|
|
50
|
+
const NewFormatProjectStatusSchema = z.object({
|
|
51
|
+
environments: GroupedServiceInstancesSchema,
|
|
52
|
+
});
|
|
53
|
+
// Older Railway CLI versions (e.g. 4.11) nest service instances under `services`.
|
|
54
|
+
const OldFormatProjectStatusSchema = z.object({
|
|
55
|
+
services: GroupedServiceInstancesSchema,
|
|
56
|
+
});
|
|
57
|
+
export const RailwayCliProjectStatusSchema = z.union([
|
|
58
|
+
NewFormatProjectStatusSchema,
|
|
59
|
+
OldFormatProjectStatusSchema.transform(({ services }) => ({
|
|
60
|
+
environments: services,
|
|
61
|
+
})),
|
|
62
|
+
]);
|
|
16
63
|
export const RailwayCliDomainSchema = z.union([
|
|
17
64
|
// Railway CLI >=4.18.1
|
|
18
65
|
z.object({ domains: z.array(z.string()).min(1) }),
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { setTimeout } from "node:timers/promises";
|
|
2
|
+
import { waspSays } from "../../../common/terminal.js";
|
|
3
|
+
import { createCommandWithCwd } from "../../../common/zx.js";
|
|
4
|
+
import { RailwayCliProjectStatusSchema, } from "../jsonOutputSchemas.js";
|
|
5
|
+
const POLL_INTERVAL_MS = 5000;
|
|
6
|
+
const TIMEOUT_MS = 5 * 60 * 1000;
|
|
7
|
+
// Any other status means the deployment is still in progress.
|
|
8
|
+
const SUCCESS_STATUS = "SUCCESS";
|
|
9
|
+
const FAILURE_STATUSES = ["FAILED", "CRASHED"];
|
|
10
|
+
export async function waitForServiceDeploymentSuccess(serviceName, options) {
|
|
11
|
+
const deadline = Date.now() + TIMEOUT_MS;
|
|
12
|
+
while (Date.now() < deadline) {
|
|
13
|
+
const status = await getLatestServiceDeploymentStatus(serviceName, options);
|
|
14
|
+
if (status === SUCCESS_STATUS) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (status !== null && FAILURE_STATUSES.includes(status)) {
|
|
18
|
+
throw new Error(`"${serviceName}" deployment finished with status "${status}". Check the Railway dashboard for details.`);
|
|
19
|
+
}
|
|
20
|
+
waspSays(`Waiting for "${serviceName}" deployment... (Status: "${status ?? "UNKNOWN"}")`);
|
|
21
|
+
await setTimeout(POLL_INTERVAL_MS);
|
|
22
|
+
}
|
|
23
|
+
throw new Error(`Timed out waiting for "${serviceName}" to be deployed. Check the Railway dashboard for details.`);
|
|
24
|
+
}
|
|
25
|
+
async function getLatestServiceDeploymentStatus(serviceName, options) {
|
|
26
|
+
const railwayCli = createCommandWithCwd(options.railwayExe, options.waspProjectDir);
|
|
27
|
+
const result = await railwayCli(["status", "--json"], {
|
|
28
|
+
verbose: false,
|
|
29
|
+
nothrow: true,
|
|
30
|
+
});
|
|
31
|
+
if (result.exitCode !== 0) {
|
|
32
|
+
// Treat transient `railway status` failures as "not ready yet".
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const projectStatus = RailwayCliProjectStatusSchema.parse(result.json());
|
|
36
|
+
return findServiceDeploymentStatus(projectStatus, serviceName);
|
|
37
|
+
}
|
|
38
|
+
export function findServiceDeploymentStatus(projectStatus, serviceName) {
|
|
39
|
+
const serviceInstance = projectStatus.environments.edges
|
|
40
|
+
.flatMap((environment) => environment.node.serviceInstances.edges)
|
|
41
|
+
.map((edge) => edge.node)
|
|
42
|
+
.find((instance) => instance.serviceName === serviceName);
|
|
43
|
+
return serviceInstance?.latestDeployment?.status ?? null;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=deployment.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wasp-deploy",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "wasp-deploy",
|
|
9
|
-
"version": "0.0
|
|
9
|
+
"version": "0.24.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@inquirer/prompts": "^7.5.3",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wasp-prisma",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "wasp-prisma",
|
|
9
|
-
"version": "0.0
|
|
9
|
+
"version": "0.24.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"json5": "^2.2.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wasp-prisma",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Wasp Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"json5": "^2.2.3",
|
|
16
|
-
"prisma": "Prisma version here needs to be kept in sync with prisma version used in wasp-cli.",
|
|
17
16
|
"prisma": "5.19.1",
|
|
18
17
|
"strip-ansi": "^7.1.2",
|
|
19
18
|
"tmp-promise": "3.0.3"
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import { parseProcessArgsOrThrow } from "../src/cli.js";
|
|
3
|
+
describe("parseProcessArgsOrThrow", () => {
|
|
4
|
+
test("should parse arguments correctly", () => {
|
|
5
|
+
expectParseProcessArgsToSucceed([
|
|
6
|
+
"analyze",
|
|
7
|
+
"main.wasp.ts",
|
|
8
|
+
"tsconfig.wasp.json",
|
|
9
|
+
"/project",
|
|
10
|
+
"output.json",
|
|
11
|
+
JSON.stringify(["entity1"]),
|
|
12
|
+
]);
|
|
13
|
+
});
|
|
14
|
+
test("should parse 0 entities correctly", () => {
|
|
15
|
+
expectParseProcessArgsToSucceed([
|
|
16
|
+
"analyze",
|
|
17
|
+
"main.wasp.ts",
|
|
18
|
+
"tsconfig.wasp.json",
|
|
19
|
+
"/project",
|
|
20
|
+
"output.json",
|
|
21
|
+
"[]",
|
|
22
|
+
]);
|
|
23
|
+
});
|
|
24
|
+
test("should throw an error if less than 8 arguments", () => {
|
|
25
|
+
expectParseProcessArgsToError([
|
|
26
|
+
"analyze",
|
|
27
|
+
"main.wasp.ts",
|
|
28
|
+
"tsconfig.wasp.json",
|
|
29
|
+
"/project",
|
|
30
|
+
"output.json",
|
|
31
|
+
]);
|
|
32
|
+
});
|
|
33
|
+
test("should throw an error if more than 8 arguments", () => {
|
|
34
|
+
expectParseProcessArgsToError([
|
|
35
|
+
"analyze",
|
|
36
|
+
"main.wasp.ts",
|
|
37
|
+
"tsconfig.wasp.json",
|
|
38
|
+
"/project",
|
|
39
|
+
"output.json",
|
|
40
|
+
"[]",
|
|
41
|
+
"extraArg",
|
|
42
|
+
]);
|
|
43
|
+
});
|
|
44
|
+
test("should throw an error if command is unsupported", () => {
|
|
45
|
+
expectParseProcessArgsToError([
|
|
46
|
+
"compile",
|
|
47
|
+
"main.wasp.ts",
|
|
48
|
+
"tsconfig.wasp.json",
|
|
49
|
+
"/project",
|
|
50
|
+
"output.json",
|
|
51
|
+
"[]",
|
|
52
|
+
]);
|
|
53
|
+
});
|
|
54
|
+
test("should throw an error if waspTsSpecPath is not a string", () => {
|
|
55
|
+
expectParseProcessArgsToError([
|
|
56
|
+
"analyze",
|
|
57
|
+
undefined,
|
|
58
|
+
"tsconfig.wasp.json",
|
|
59
|
+
"/project",
|
|
60
|
+
"output.json",
|
|
61
|
+
JSON.stringify(["entity1"]),
|
|
62
|
+
]);
|
|
63
|
+
});
|
|
64
|
+
test("should throw an error if tsconfigPath is not a string", () => {
|
|
65
|
+
expectParseProcessArgsToError([
|
|
66
|
+
"analyze",
|
|
67
|
+
"main.wasp.ts",
|
|
68
|
+
undefined,
|
|
69
|
+
"/project",
|
|
70
|
+
"output.json",
|
|
71
|
+
JSON.stringify(["entity1"]),
|
|
72
|
+
]);
|
|
73
|
+
});
|
|
74
|
+
test("should throw an error if projectRootDir is not a string", () => {
|
|
75
|
+
expectParseProcessArgsToError([
|
|
76
|
+
"analyze",
|
|
77
|
+
"main.wasp.ts",
|
|
78
|
+
"tsconfig.wasp.json",
|
|
79
|
+
undefined,
|
|
80
|
+
"output.json",
|
|
81
|
+
JSON.stringify(["entity1"]),
|
|
82
|
+
]);
|
|
83
|
+
});
|
|
84
|
+
test("should throw an error if specResultPath is not a string", () => {
|
|
85
|
+
expectParseProcessArgsToError([
|
|
86
|
+
"analyze",
|
|
87
|
+
"main.wasp.ts",
|
|
88
|
+
"tsconfig.wasp.json",
|
|
89
|
+
"/project",
|
|
90
|
+
undefined,
|
|
91
|
+
JSON.stringify(["entity1"]),
|
|
92
|
+
]);
|
|
93
|
+
});
|
|
94
|
+
test("should throw an error if any entityNames is not a string", () => {
|
|
95
|
+
expectParseProcessArgsToError([
|
|
96
|
+
"analyze",
|
|
97
|
+
"main.wasp.ts",
|
|
98
|
+
"tsconfig.wasp.json",
|
|
99
|
+
"/project",
|
|
100
|
+
"output.json",
|
|
101
|
+
undefined,
|
|
102
|
+
]);
|
|
103
|
+
});
|
|
104
|
+
test("should throw an error if the entity names JSON is not an array", () => {
|
|
105
|
+
expectParseProcessArgsToError([
|
|
106
|
+
"analyze",
|
|
107
|
+
"main.wasp.ts",
|
|
108
|
+
"tsconfig.wasp.json",
|
|
109
|
+
"/project",
|
|
110
|
+
"output.json",
|
|
111
|
+
JSON.stringify({ entity1: "entity1" }),
|
|
112
|
+
]);
|
|
113
|
+
});
|
|
114
|
+
function expectParseProcessArgsToSucceed(args) {
|
|
115
|
+
const result = parseProcessArgsOrThrow(["node", "run.js", ...args]);
|
|
116
|
+
const [_command, waspTsSpecPath, tsconfigPath, projectRootDir, specResultPath, entityNames,] = args;
|
|
117
|
+
expect(result).toEqual({
|
|
118
|
+
waspTsSpecPath,
|
|
119
|
+
tsconfigPath,
|
|
120
|
+
projectRootDir,
|
|
121
|
+
specResultPath,
|
|
122
|
+
entityNames: entityNames && JSON.parse(entityNames),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function expectParseProcessArgsToError(args) {
|
|
126
|
+
expect(() => parseProcessArgsOrThrow(["node", "run.js", ...args])).toThrowError();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appAnalyzer.unit.test.d.ts","sourceRoot":"","sources":["../../../__tests__/legacy/appAnalyzer.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { afterEach } from "node:test";
|
|
2
2
|
import { describe, expect, test, vi } from "vitest";
|
|
3
|
-
import { GET_TS_APP_SPEC } from "
|
|
4
|
-
import { analyzeApp } from "
|
|
5
|
-
import { mapTsAppSpecToAppSpecDecls } from "
|
|
3
|
+
import { GET_TS_APP_SPEC } from "../../src/legacy/_private.js";
|
|
4
|
+
import { analyzeApp } from "../../src/legacy/appAnalyzer.js";
|
|
5
|
+
import { mapTsAppSpecToAppSpecDecls } from "../../src/legacy/mapTsAppSpecToAppSpecDecls.js";
|
|
6
6
|
import * as Fixtures from "./testFixtures.js";
|
|
7
7
|
describe("analyzeApp", () => {
|
|
8
8
|
afterEach(() => vi.clearAllMocks());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapTsAppSpecToAppSpecDecls.integration.test.d.ts","sourceRoot":"","sources":["../../../__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { GET_TS_APP_SPEC } from "
|
|
4
|
-
import { makeRefParser, mapApi, mapApiNamespace, mapApp, mapCrud, mapJob, mapOperation, mapPage, mapRoute, mapTsAppSpecToAppSpecDecls, } from "
|
|
3
|
+
import { GET_TS_APP_SPEC } from "../../src/legacy/_private.js";
|
|
4
|
+
import { makeRefParser, mapApi, mapApiNamespace, mapApp, mapCrud, mapJob, mapOperation, mapPage, mapRoute, mapTsAppSpecToAppSpecDecls, } from "../../src/legacy/mapTsAppSpecToAppSpecDecls.js";
|
|
5
5
|
import * as Fixtures from "./testFixtures.js";
|
|
6
6
|
describe("mapTsAppSpecToAppSpecDecls", () => {
|
|
7
7
|
test("should map full app using mapping functions correctly", () => {
|
package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapTsAppSpecToAppSpecDecls.unit.test.d.ts","sourceRoot":"","sources":["../../../__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.ts"],"names":[],"mappings":""}
|