zudojs-cli 2.0.1 → 2.1.0
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/README.md +59 -7
- package/dist/src/adapters/frontend/angular.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/angular.adapter.js +14 -97
- package/dist/src/adapters/frontend/astro.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/astro.adapter.js +4 -64
- package/dist/src/adapters/frontend/fallback/fallback.helper.d.ts +41 -0
- package/dist/src/adapters/frontend/fallback/fallback.helper.js +57 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angular.fallback.d.ts +18 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angular.fallback.js +107 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angularWorkspace.fallback.d.ts +23 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angularWorkspace.fallback.js +125 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/index.d.ts +8 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/index.js +8 -0
- package/dist/src/adapters/frontend/fallback/framework/astro.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/framework/astro.fallback.js +76 -0
- package/dist/src/adapters/frontend/fallback/framework/index.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/framework/index.js +13 -0
- package/dist/src/adapters/frontend/fallback/framework/next.fallback.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/framework/next.fallback.js +105 -0
- package/dist/src/adapters/frontend/fallback/framework/nuxt.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/framework/nuxt.fallback.js +56 -0
- package/dist/src/adapters/frontend/fallback/framework/sveltekit.fallback.d.ts +15 -0
- package/dist/src/adapters/frontend/fallback/framework/sveltekit.fallback.js +94 -0
- package/dist/src/adapters/frontend/fallback/index.d.ts +12 -0
- package/dist/src/adapters/frontend/fallback/index.js +12 -0
- package/dist/src/adapters/frontend/fallback/vite/index.d.ts +11 -0
- package/dist/src/adapters/frontend/fallback/vite/index.js +11 -0
- package/dist/src/adapters/frontend/fallback/vite/react.fallback.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/vite/react.fallback.js +77 -0
- package/dist/src/adapters/frontend/fallback/vite/svelte.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/vite/svelte.fallback.js +95 -0
- package/dist/src/adapters/frontend/fallback/vite/vanilla.fallback.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/vite/vanilla.fallback.js +71 -0
- package/dist/src/adapters/frontend/fallback/vite/vue.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/vite/vue.fallback.js +78 -0
- package/dist/src/adapters/frontend/next.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/next.adapter.js +16 -95
- package/dist/src/adapters/frontend/nuxt.adapter.d.ts +1 -2
- package/dist/src/adapters/frontend/nuxt.adapter.js +32 -43
- package/dist/src/adapters/frontend/react-native.adapter.js +1 -1
- package/dist/src/adapters/frontend/react.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/react.adapter.js +7 -89
- package/dist/src/adapters/frontend/svelte.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/svelte.adapter.js +4 -86
- package/dist/src/adapters/frontend/sveltekit.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/sveltekit.adapter.js +4 -57
- package/dist/src/adapters/frontend/vanilla.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/vanilla.adapter.js +4 -47
- package/dist/src/adapters/frontend/vue.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/vue.adapter.js +4 -76
- package/dist/src/bin/bin.menu.d.ts +22 -0
- package/dist/src/bin/bin.menu.js +40 -0
- package/dist/src/bin/bin.runner.d.ts +38 -0
- package/dist/src/bin/bin.runner.js +51 -0
- package/dist/src/bin/index.d.ts +9 -0
- package/dist/src/bin/index.js +9 -0
- package/dist/src/bin/zudojs.js +15 -4
- package/dist/src/cliApplication/cliApplication.core.d.ts +4 -2
- package/dist/src/cliApplication/cliApplication.core.js +48 -36
- package/dist/src/cliApplication/cliApplication.logger.d.ts +5 -0
- package/dist/src/cliApplication/cliApplication.logger.js +5 -3
- package/dist/src/cliApplication/invocation/index.d.ts +12 -0
- package/dist/src/cliApplication/invocation/index.js +12 -0
- package/dist/src/cliApplication/invocation/invocation.hint.d.ts +30 -0
- package/dist/src/cliApplication/invocation/invocation.hint.js +74 -0
- package/dist/src/cliApplication/invocation/invocation.locate.d.ts +34 -0
- package/dist/src/cliApplication/invocation/invocation.locate.js +53 -0
- package/dist/src/cliApplication/invocation/invocation.name.d.ts +37 -0
- package/dist/src/cliApplication/invocation/invocation.name.js +69 -0
- package/dist/src/cliApplication/invocation/invocation.sanitize.d.ts +19 -0
- package/dist/src/cliApplication/invocation/invocation.sanitize.js +32 -0
- package/dist/src/cliParser/cliParser.core.js +3 -1
- package/dist/src/cliParser/cliParser.helper.d.ts +7 -0
- package/dist/src/cliParser/cliParser.helper.js +19 -2
- package/dist/src/cliParser/cliParser.longOption.js +2 -2
- package/dist/src/commands/add.command.d.ts +7 -3
- package/dist/src/commands/add.command.js +96 -57
- package/dist/src/commands/create.command.js +29 -42
- package/dist/src/commands/doctor.command.d.ts +2 -1
- package/dist/src/commands/doctor.command.js +52 -4
- package/dist/src/commands/generate.command.js +31 -16
- package/dist/src/commands/info.command.js +11 -1
- package/dist/src/constants/index.d.ts +21 -3
- package/dist/src/constants/index.js +40 -5
- package/dist/src/constants/zudojsVersions.generated.d.ts +9 -0
- package/dist/src/constants/zudojsVersions.generated.js +48 -0
- package/dist/src/constants/zudojsVersions.helper.d.ts +21 -0
- package/dist/src/constants/zudojsVersions.helper.js +29 -0
- package/dist/src/generators/frontend/frontendGenerator.core.js +9 -10
- package/dist/src/generators/frontend/frontendPipeline.d.ts +6 -1
- package/dist/src/generators/frontend/frontendPipeline.js +9 -1
- package/dist/src/generators/fullstack/fullstackComposer.core.js +7 -1
- package/dist/src/generators/index.d.ts +1 -2
- package/dist/src/generators/index.js +1 -2
- package/dist/src/generators/infrastructure/infrastructure.generator.js +13 -5
- package/dist/src/generators/integration/integrationGenerator.core.d.ts +2 -0
- package/dist/src/generators/integration/integrationGenerator.core.js +31 -2
- package/dist/src/generators/module/module.generator.js +36 -4
- package/dist/src/generators/resource/index.d.ts +8 -0
- package/dist/src/generators/resource/index.js +8 -0
- package/dist/src/generators/resource/resource.generator.d.ts +27 -0
- package/dist/src/generators/resource/resource.generator.js +87 -0
- package/dist/src/generators/resource/resource.layout.d.ts +26 -0
- package/dist/src/generators/resource/resource.layout.js +46 -0
- package/dist/src/generators/resource/resource.plan.d.ts +27 -0
- package/dist/src/generators/resource/resource.plan.js +46 -0
- package/dist/src/generators/resource/resource.run.d.ts +25 -0
- package/dist/src/generators/resource/resource.run.js +52 -0
- package/dist/src/prompts/cancel.prompt.d.ts +5 -1
- package/dist/src/prompts/cancel.prompt.js +4 -0
- package/dist/src/prompts/menu/index.d.ts +13 -0
- package/dist/src/prompts/menu/index.js +13 -0
- package/dist/src/prompts/menu/menu.adapter.d.ts +16 -0
- package/dist/src/prompts/menu/menu.adapter.js +56 -0
- package/dist/src/prompts/menu/menu.constant.d.ts +20 -0
- package/dist/src/prompts/menu/menu.constant.js +29 -0
- package/dist/src/prompts/menu/menu.flow.d.ts +18 -0
- package/dist/src/prompts/menu/menu.flow.js +82 -0
- package/dist/src/prompts/menu/menu.select.d.ts +26 -0
- package/dist/src/prompts/menu/menu.select.js +118 -0
- package/dist/src/prompts/menu/menu.type.d.ts +66 -0
- package/dist/src/prompts/menu/menu.type.js +8 -0
- package/dist/src/recipes/apply/index.d.ts +9 -0
- package/dist/src/recipes/apply/index.js +9 -0
- package/dist/src/recipes/apply/recipeApply.app.d.ts +20 -0
- package/dist/src/recipes/apply/recipeApply.app.js +79 -0
- package/dist/src/recipes/apply/recipeApply.context.d.ts +14 -0
- package/dist/src/recipes/apply/recipeApply.context.js +76 -0
- package/dist/src/recipes/apply/recipeApply.files.d.ts +39 -0
- package/dist/src/recipes/apply/recipeApply.files.js +84 -0
- package/dist/src/recipes/apply/recipeApply.project.d.ts +11 -0
- package/dist/src/recipes/apply/recipeApply.project.js +50 -0
- package/dist/src/recipes/apply/recipeApply.report.d.ts +20 -0
- package/dist/src/recipes/apply/recipeApply.report.js +51 -0
- package/dist/src/recipes/catalog/database/database.files.d.ts +15 -0
- package/dist/src/recipes/catalog/database/database.files.js +98 -0
- package/dist/src/recipes/catalog/database/database.recipe.d.ts +9 -0
- package/dist/src/recipes/catalog/database/database.recipe.js +50 -0
- package/dist/src/recipes/catalog/database/index.d.ts +6 -0
- package/dist/src/recipes/catalog/database/index.js +6 -0
- package/dist/src/recipes/catalog/email.recipe.d.ts +9 -0
- package/dist/src/recipes/catalog/email.recipe.js +122 -0
- package/dist/src/recipes/catalog/index.d.ts +11 -0
- package/dist/src/recipes/catalog/index.js +11 -0
- package/dist/src/recipes/catalog/openapi.recipe.d.ts +8 -0
- package/dist/src/recipes/catalog/openapi.recipe.js +25 -0
- package/dist/src/recipes/catalog/platform/cache.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/cache.recipe.js +55 -0
- package/dist/src/recipes/catalog/platform/index.d.ts +9 -0
- package/dist/src/recipes/catalog/platform/index.js +9 -0
- package/dist/src/recipes/catalog/platform/messaging.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/messaging.recipe.js +46 -0
- package/dist/src/recipes/catalog/platform/observability.recipe.d.ts +8 -0
- package/dist/src/recipes/catalog/platform/observability.recipe.js +49 -0
- package/dist/src/recipes/catalog/platform/queue.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/queue.recipe.js +61 -0
- package/dist/src/recipes/catalog/platform/scheduler.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/scheduler.recipe.js +56 -0
- package/dist/src/recipes/catalog/redis.recipe.d.ts +8 -0
- package/dist/src/recipes/catalog/redis.recipe.js +79 -0
- package/dist/src/recipes/catalog/storage.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/storage.recipe.js +49 -0
- package/dist/src/recipes/catalog/websockets.recipe.d.ts +10 -0
- package/dist/src/recipes/catalog/websockets.recipe.js +84 -0
- package/dist/src/recipes/docker/docker.compose.d.ts +19 -0
- package/dist/src/recipes/docker/docker.compose.js +90 -0
- package/dist/src/recipes/docker/docker.recipe.d.ts +10 -0
- package/dist/src/recipes/docker/docker.recipe.js +51 -0
- package/dist/src/recipes/docker/docker.refresh.d.ts +13 -0
- package/dist/src/recipes/docker/docker.refresh.js +37 -0
- package/dist/src/recipes/docker/index.d.ts +7 -0
- package/dist/src/recipes/docker/index.js +7 -0
- package/dist/src/recipes/index.d.ts +8 -0
- package/dist/src/recipes/index.js +8 -0
- package/dist/src/recipes/recipe.registry.d.ts +17 -0
- package/dist/src/recipes/recipe.registry.js +46 -0
- package/dist/src/recipes/recipe.type.d.ts +93 -0
- package/dist/src/recipes/recipe.type.js +12 -0
- package/dist/src/resolvers/dependency/dependencyVersions.constant.d.ts +100 -5
- package/dist/src/resolvers/dependency/dependencyVersions.constant.js +103 -34
- package/dist/src/resolvers/dependency/index.d.ts +1 -1
- package/dist/src/resolvers/dependency/index.js +1 -1
- package/dist/src/resolvers/project.resolver.d.ts +14 -1
- package/dist/src/resolvers/project.resolver.js +11 -3
- package/dist/src/scaffolders/scaffolder.helper.js +12 -1
- package/dist/src/templates/backendApp/backendApp.core.d.ts +45 -0
- package/dist/src/templates/backendApp/backendApp.core.js +66 -0
- package/dist/src/templates/backendApp/backendApp.modules.d.ts +26 -0
- package/dist/src/templates/backendApp/backendApp.modules.js +25 -0
- package/dist/src/templates/backendApp/backendApp.project.d.ts +26 -0
- package/dist/src/templates/backendApp/backendApp.project.js +87 -0
- package/dist/src/templates/backendApp/index.d.ts +8 -0
- package/dist/src/templates/backendApp/index.js +8 -0
- package/dist/src/templates/backendApp/parts/config.template.d.ts +28 -0
- package/dist/src/templates/backendApp/parts/config.template.js +118 -0
- package/dist/src/templates/backendApp/parts/httpUtils.template.d.ts +10 -0
- package/dist/src/templates/backendApp/parts/httpUtils.template.js +103 -0
- package/dist/src/templates/backendApp/parts/index.d.ts +9 -0
- package/dist/src/templates/backendApp/parts/index.js +9 -0
- package/dist/src/templates/backendApp/parts/integrations.template.d.ts +16 -0
- package/dist/src/templates/backendApp/parts/integrations.template.js +115 -0
- package/dist/src/templates/backendApp/parts/wiring.template.d.ts +26 -0
- package/dist/src/templates/backendApp/parts/wiring.template.js +111 -0
- package/dist/src/templates/microservice/microservice.template.js +61 -87
- package/dist/src/templates/modular-monolith/modularMonolith.template.js +25 -77
- package/dist/src/templates/monolith/monolith.template.d.ts +11 -26
- package/dist/src/templates/monolith/monolith.template.js +49 -146
- package/dist/src/templates/resource/index.d.ts +9 -0
- package/dist/src/templates/resource/index.js +9 -0
- package/dist/src/templates/resource/layers/index.d.ts +9 -0
- package/dist/src/templates/resource/layers/index.js +9 -0
- package/dist/src/templates/resource/layers/resourceData.template.d.ts +9 -0
- package/dist/src/templates/resource/layers/resourceData.template.js +108 -0
- package/dist/src/templates/resource/layers/resourcePrisma.template.d.ts +15 -0
- package/dist/src/templates/resource/layers/resourcePrisma.template.js +89 -0
- package/dist/src/templates/resource/layers/resourceRoutes.template.d.ts +13 -0
- package/dist/src/templates/resource/layers/resourceRoutes.template.js +128 -0
- package/dist/src/templates/resource/layers/resourceService.template.d.ts +13 -0
- package/dist/src/templates/resource/layers/resourceService.template.js +95 -0
- package/dist/src/templates/resource/resource.files.d.ts +33 -0
- package/dist/src/templates/resource/resource.files.js +99 -0
- package/dist/src/templates/resource/resource.names.d.ts +38 -0
- package/dist/src/templates/resource/resource.names.js +60 -0
- package/dist/src/templates/resource/resource.type.d.ts +19 -0
- package/dist/src/templates/resource/resource.type.js +15 -0
- package/dist/src/templates/shared/appRuntime.template.js +28 -11
- package/dist/src/templates/shared/capability.template.d.ts +13 -4
- package/dist/src/templates/shared/capability.template.js +21 -5
- package/dist/src/templates/shared/dockerfile.template.d.ts +12 -4
- package/dist/src/templates/shared/dockerfile.template.js +68 -29
- package/dist/src/templates/shared/pnpm.template.d.ts +8 -2
- package/dist/src/templates/shared/pnpm.template.js +9 -1
- package/dist/src/templates/shared/server.template.d.ts +23 -22
- package/dist/src/templates/shared/server.template.js +79 -53
- package/dist/src/types/scaffold.type.d.ts +6 -0
- package/dist/src/types/scaffold.type.js +2 -1
- package/dist/src/utils/utils.name.js +6 -0
- package/dist/src/utils/utils.writeGuard.d.ts +5 -0
- package/dist/src/utils/utils.writeGuard.js +23 -0
- package/dist/src/wiring/index.d.ts +10 -0
- package/dist/src/wiring/index.js +10 -0
- package/dist/src/wiring/wiring.dependencies.d.ts +29 -0
- package/dist/src/wiring/wiring.dependencies.js +83 -0
- package/dist/src/wiring/wiring.edits.d.ts +51 -0
- package/dist/src/wiring/wiring.edits.js +90 -0
- package/dist/src/wiring/wiring.markers.d.ts +53 -0
- package/dist/src/wiring/wiring.markers.js +87 -0
- package/package.json +20 -15
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in React + Vite template, written when `create-vite` cannot run.
|
|
3
|
+
*
|
|
4
|
+
* @module adapters/frontend/fallback/vite/react
|
|
5
|
+
*/
|
|
6
|
+
import { DEPENDENCY_VERSION_RANGES as V, TYPESCRIPT_VERSION_RANGES, } from "../../../../resolvers/dependency/dependencyVersions.constant.js";
|
|
7
|
+
import { renderJsonFile, renderViteIndexHtml, VITE_TSCONFIG_COMPILER_OPTIONS, } from "../fallback.helper.js";
|
|
8
|
+
/**
|
|
9
|
+
* Renders the React fallback project, mirroring `create-vite`'s `react-ts`
|
|
10
|
+
* (or `react`) template.
|
|
11
|
+
*/
|
|
12
|
+
export function renderReactFallback(context) {
|
|
13
|
+
const useTypeScript = context.language === "typescript";
|
|
14
|
+
const ext = useTypeScript ? "tsx" : "jsx";
|
|
15
|
+
const files = {
|
|
16
|
+
"package.json": renderJsonFile({
|
|
17
|
+
name: context.project.name,
|
|
18
|
+
version: "0.1.0",
|
|
19
|
+
private: true,
|
|
20
|
+
type: "module",
|
|
21
|
+
scripts: {
|
|
22
|
+
dev: "vite",
|
|
23
|
+
build: useTypeScript ? "tsc --noEmit && vite build" : "vite build",
|
|
24
|
+
preview: "vite preview",
|
|
25
|
+
},
|
|
26
|
+
dependencies: {
|
|
27
|
+
react: V.react,
|
|
28
|
+
"react-dom": V["react-dom"],
|
|
29
|
+
},
|
|
30
|
+
devDependencies: {
|
|
31
|
+
vite: V.vite,
|
|
32
|
+
"@vitejs/plugin-react": V["@vitejs/plugin-react"],
|
|
33
|
+
...(useTypeScript
|
|
34
|
+
? {
|
|
35
|
+
typescript: TYPESCRIPT_VERSION_RANGES.frontend,
|
|
36
|
+
"@types/react": V["@types/react"],
|
|
37
|
+
"@types/react-dom": V["@types/react-dom"],
|
|
38
|
+
}
|
|
39
|
+
: {}),
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
"vite.config.ts": `import react from "@vitejs/plugin-react";
|
|
43
|
+
import { defineConfig } from "vite";
|
|
44
|
+
|
|
45
|
+
export default defineConfig({
|
|
46
|
+
plugins: [react()],
|
|
47
|
+
});
|
|
48
|
+
`,
|
|
49
|
+
"index.html": renderViteIndexHtml(context.project.name, "root", `/src/main.${ext}`),
|
|
50
|
+
[`src/main.${ext}`]: `import { StrictMode } from "react";
|
|
51
|
+
import { createRoot } from "react-dom/client";
|
|
52
|
+
import App from "./App.${ext}";
|
|
53
|
+
|
|
54
|
+
createRoot(document.getElementById("root")${useTypeScript ? "!" : ""}).render(
|
|
55
|
+
<StrictMode>
|
|
56
|
+
<App />
|
|
57
|
+
</StrictMode>,
|
|
58
|
+
);
|
|
59
|
+
`,
|
|
60
|
+
[`src/App.${ext}`]: `export default function App() {
|
|
61
|
+
return (
|
|
62
|
+
<div>
|
|
63
|
+
<h1>Hello from Zudojs</h1>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
`,
|
|
68
|
+
};
|
|
69
|
+
if (useTypeScript) {
|
|
70
|
+
files["tsconfig.json"] = renderJsonFile({
|
|
71
|
+
compilerOptions: { ...VITE_TSCONFIG_COMPILER_OPTIONS, jsx: "react-jsx" },
|
|
72
|
+
include: ["src"],
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return files;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=react.fallback.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Svelte + Vite template, written when `create-vite` cannot run.
|
|
3
|
+
*
|
|
4
|
+
* @module adapters/frontend/fallback/vite/svelte
|
|
5
|
+
*/
|
|
6
|
+
import type { FrontendGenerationContext } from "../../frontendAdapter.type.js";
|
|
7
|
+
import { type FallbackFileTree } from "../fallback.helper.js";
|
|
8
|
+
/**
|
|
9
|
+
* Renders the Svelte 5 fallback project, mirroring `create-vite`'s
|
|
10
|
+
* `svelte-ts` (or `svelte`) template: components are mounted with
|
|
11
|
+
* `mount()`, since Svelte 5 removed `new App({ target })`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderSvelteFallback(context: FrontendGenerationContext): FallbackFileTree;
|
|
14
|
+
//# sourceMappingURL=svelte.fallback.d.ts.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Svelte + Vite template, written when `create-vite` cannot run.
|
|
3
|
+
*
|
|
4
|
+
* @module adapters/frontend/fallback/vite/svelte
|
|
5
|
+
*/
|
|
6
|
+
import { DEPENDENCY_VERSION_RANGES as V, TYPESCRIPT_VERSION_RANGES, } from "../../../../resolvers/dependency/dependencyVersions.constant.js";
|
|
7
|
+
import { renderJsonFile, renderViteIndexHtml, } from "../fallback.helper.js";
|
|
8
|
+
/**
|
|
9
|
+
* Renders the Svelte 5 fallback project, mirroring `create-vite`'s
|
|
10
|
+
* `svelte-ts` (or `svelte`) template: components are mounted with
|
|
11
|
+
* `mount()`, since Svelte 5 removed `new App({ target })`.
|
|
12
|
+
*/
|
|
13
|
+
export function renderSvelteFallback(context) {
|
|
14
|
+
const useTypeScript = context.language === "typescript";
|
|
15
|
+
const ext = useTypeScript ? "ts" : "js";
|
|
16
|
+
const files = {
|
|
17
|
+
"package.json": renderJsonFile({
|
|
18
|
+
name: context.project.name,
|
|
19
|
+
version: "0.1.0",
|
|
20
|
+
private: true,
|
|
21
|
+
type: "module",
|
|
22
|
+
scripts: {
|
|
23
|
+
dev: "vite",
|
|
24
|
+
build: "vite build",
|
|
25
|
+
preview: "vite preview",
|
|
26
|
+
...(useTypeScript
|
|
27
|
+
? { check: "svelte-check --tsconfig ./tsconfig.json" }
|
|
28
|
+
: {}),
|
|
29
|
+
},
|
|
30
|
+
dependencies: {
|
|
31
|
+
svelte: V.svelte,
|
|
32
|
+
},
|
|
33
|
+
devDependencies: {
|
|
34
|
+
vite: V.vite,
|
|
35
|
+
"@sveltejs/vite-plugin-svelte": V["@sveltejs/vite-plugin-svelte"],
|
|
36
|
+
...(useTypeScript
|
|
37
|
+
? {
|
|
38
|
+
typescript: TYPESCRIPT_VERSION_RANGES.frontend,
|
|
39
|
+
"svelte-check": V["svelte-check"],
|
|
40
|
+
"@tsconfig/svelte": V["@tsconfig/svelte"],
|
|
41
|
+
}
|
|
42
|
+
: {}),
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
"svelte.config.js": `/** @type {import("@sveltejs/vite-plugin-svelte").SvelteConfig} */
|
|
46
|
+
export default {};
|
|
47
|
+
`,
|
|
48
|
+
"vite.config.ts": `import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
49
|
+
import { defineConfig } from "vite";
|
|
50
|
+
|
|
51
|
+
export default defineConfig({
|
|
52
|
+
plugins: [svelte()],
|
|
53
|
+
});
|
|
54
|
+
`,
|
|
55
|
+
"index.html": renderViteIndexHtml(context.project.name, "app", `/src/main.${ext}`),
|
|
56
|
+
[`src/main.${ext}`]: `import { mount } from "svelte";
|
|
57
|
+
import App from "./App.svelte";
|
|
58
|
+
|
|
59
|
+
const app = mount(App, {
|
|
60
|
+
target: document.getElementById("app")${useTypeScript ? "!" : ""},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export default app;
|
|
64
|
+
`,
|
|
65
|
+
"src/App.svelte": `<script${useTypeScript ? ' lang="ts"' : ""}>
|
|
66
|
+
const title = "Hello from Zudojs";
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<main>
|
|
70
|
+
<h1>{title}</h1>
|
|
71
|
+
</main>
|
|
72
|
+
|
|
73
|
+
<style>
|
|
74
|
+
main {
|
|
75
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
76
|
+
}
|
|
77
|
+
</style>
|
|
78
|
+
`,
|
|
79
|
+
};
|
|
80
|
+
if (useTypeScript) {
|
|
81
|
+
files["tsconfig.json"] = renderJsonFile({
|
|
82
|
+
extends: "@tsconfig/svelte/tsconfig.json",
|
|
83
|
+
compilerOptions: {
|
|
84
|
+
target: "ES2023",
|
|
85
|
+
module: "ESNext",
|
|
86
|
+
types: ["svelte", "vite/client"],
|
|
87
|
+
noEmit: true,
|
|
88
|
+
moduleDetection: "force",
|
|
89
|
+
},
|
|
90
|
+
include: ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return files;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=svelte.fallback.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in vanilla + Vite template, written when `create-vite` cannot run.
|
|
3
|
+
*
|
|
4
|
+
* @module adapters/frontend/fallback/vite/vanilla
|
|
5
|
+
*/
|
|
6
|
+
import type { FrontendGenerationContext } from "../../frontendAdapter.type.js";
|
|
7
|
+
import { type FallbackFileTree } from "../fallback.helper.js";
|
|
8
|
+
/**
|
|
9
|
+
* Renders the vanilla fallback project. It used to ship no `package.json`
|
|
10
|
+
* at all, so neither `install` nor `build` could run in it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderVanillaFallback(context: FrontendGenerationContext): FallbackFileTree;
|
|
13
|
+
//# sourceMappingURL=vanilla.fallback.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in vanilla + Vite template, written when `create-vite` cannot run.
|
|
3
|
+
*
|
|
4
|
+
* @module adapters/frontend/fallback/vite/vanilla
|
|
5
|
+
*/
|
|
6
|
+
import { DEPENDENCY_VERSION_RANGES as V } from "../../../../resolvers/dependency/dependencyVersions.constant.js";
|
|
7
|
+
import { renderJsonFile } from "../fallback.helper.js";
|
|
8
|
+
/**
|
|
9
|
+
* Renders the vanilla fallback project. It used to ship no `package.json`
|
|
10
|
+
* at all, so neither `install` nor `build` could run in it.
|
|
11
|
+
*/
|
|
12
|
+
export function renderVanillaFallback(context) {
|
|
13
|
+
return {
|
|
14
|
+
"package.json": renderJsonFile({
|
|
15
|
+
name: context.project.name,
|
|
16
|
+
version: "0.1.0",
|
|
17
|
+
private: true,
|
|
18
|
+
type: "module",
|
|
19
|
+
scripts: {
|
|
20
|
+
dev: "vite",
|
|
21
|
+
build: "vite build",
|
|
22
|
+
preview: "vite preview",
|
|
23
|
+
},
|
|
24
|
+
devDependencies: {
|
|
25
|
+
vite: V.vite,
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
"index.html": `<!doctype html>
|
|
29
|
+
<html lang="en">
|
|
30
|
+
<head>
|
|
31
|
+
<meta charset="UTF-8">
|
|
32
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
33
|
+
<title>${context.project.name}</title>
|
|
34
|
+
<link rel="stylesheet" href="/src/styles/main.css">
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div id="app"></div>
|
|
38
|
+
<script type="module" src="/src/main.js"></script>
|
|
39
|
+
</body>
|
|
40
|
+
</html>
|
|
41
|
+
`,
|
|
42
|
+
"src/main.js": `import { createApp } from "./app.js";
|
|
43
|
+
|
|
44
|
+
const app = createApp();
|
|
45
|
+
app.mount("#app");
|
|
46
|
+
`,
|
|
47
|
+
"src/app.js": `export function createApp() {
|
|
48
|
+
return {
|
|
49
|
+
mount(selector) {
|
|
50
|
+
const root = document.querySelector(selector);
|
|
51
|
+
if (root) {
|
|
52
|
+
root.innerHTML = "<h1>Hello from Zudojs</h1>";
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
`,
|
|
58
|
+
"src/styles/main.css": `* {
|
|
59
|
+
margin: 0;
|
|
60
|
+
padding: 0;
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
body {
|
|
65
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
66
|
+
line-height: 1.6;
|
|
67
|
+
}
|
|
68
|
+
`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=vanilla.fallback.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Vue + Vite template, written when `create-vite` cannot run.
|
|
3
|
+
*
|
|
4
|
+
* @module adapters/frontend/fallback/vite/vue
|
|
5
|
+
*/
|
|
6
|
+
import type { FrontendGenerationContext } from "../../frontendAdapter.type.js";
|
|
7
|
+
import { type FallbackFileTree } from "../fallback.helper.js";
|
|
8
|
+
/**
|
|
9
|
+
* Renders the Vue fallback project, mirroring `create-vite`'s `vue-ts`
|
|
10
|
+
* (or `vue`) template. TypeScript projects typecheck with `vue-tsc`, which
|
|
11
|
+
* understands `.vue` files, before Vite builds.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderVueFallback(context: FrontendGenerationContext): FallbackFileTree;
|
|
14
|
+
//# sourceMappingURL=vue.fallback.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Vue + Vite template, written when `create-vite` cannot run.
|
|
3
|
+
*
|
|
4
|
+
* @module adapters/frontend/fallback/vite/vue
|
|
5
|
+
*/
|
|
6
|
+
import { DEPENDENCY_VERSION_RANGES as V, TYPESCRIPT_VERSION_RANGES, } from "../../../../resolvers/dependency/dependencyVersions.constant.js";
|
|
7
|
+
import { renderJsonFile, renderViteIndexHtml, } from "../fallback.helper.js";
|
|
8
|
+
/**
|
|
9
|
+
* Renders the Vue fallback project, mirroring `create-vite`'s `vue-ts`
|
|
10
|
+
* (or `vue`) template. TypeScript projects typecheck with `vue-tsc`, which
|
|
11
|
+
* understands `.vue` files, before Vite builds.
|
|
12
|
+
*/
|
|
13
|
+
export function renderVueFallback(context) {
|
|
14
|
+
const useTypeScript = context.language === "typescript";
|
|
15
|
+
const ext = useTypeScript ? "ts" : "js";
|
|
16
|
+
const files = {
|
|
17
|
+
"package.json": renderJsonFile({
|
|
18
|
+
name: context.project.name,
|
|
19
|
+
version: "0.1.0",
|
|
20
|
+
private: true,
|
|
21
|
+
type: "module",
|
|
22
|
+
scripts: {
|
|
23
|
+
dev: "vite",
|
|
24
|
+
build: useTypeScript ? "vue-tsc --noEmit && vite build" : "vite build",
|
|
25
|
+
preview: "vite preview",
|
|
26
|
+
},
|
|
27
|
+
dependencies: {
|
|
28
|
+
vue: V.vue,
|
|
29
|
+
},
|
|
30
|
+
devDependencies: {
|
|
31
|
+
vite: V.vite,
|
|
32
|
+
"@vitejs/plugin-vue": V["@vitejs/plugin-vue"],
|
|
33
|
+
...(useTypeScript
|
|
34
|
+
? {
|
|
35
|
+
typescript: TYPESCRIPT_VERSION_RANGES.frontend,
|
|
36
|
+
"vue-tsc": V["vue-tsc"],
|
|
37
|
+
"@vue/tsconfig": V["@vue/tsconfig"],
|
|
38
|
+
}
|
|
39
|
+
: {}),
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
"vite.config.ts": `import vue from "@vitejs/plugin-vue";
|
|
43
|
+
import { defineConfig } from "vite";
|
|
44
|
+
|
|
45
|
+
export default defineConfig({
|
|
46
|
+
plugins: [vue()],
|
|
47
|
+
});
|
|
48
|
+
`,
|
|
49
|
+
"index.html": renderViteIndexHtml(context.project.name, "app", `/src/main.${ext}`),
|
|
50
|
+
[`src/main.${ext}`]: `import { createApp } from "vue";
|
|
51
|
+
import App from "./App.vue";
|
|
52
|
+
|
|
53
|
+
createApp(App).mount("#app");
|
|
54
|
+
`,
|
|
55
|
+
"src/App.vue": `<script setup${useTypeScript ? ' lang="ts"' : ""}>
|
|
56
|
+
const title = "Hello from Zudojs";
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<div>
|
|
61
|
+
<h1>{{ title }}</h1>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
`,
|
|
65
|
+
};
|
|
66
|
+
if (useTypeScript) {
|
|
67
|
+
files["tsconfig.json"] = renderJsonFile({
|
|
68
|
+
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
69
|
+
compilerOptions: {
|
|
70
|
+
types: ["vite/client"],
|
|
71
|
+
noFallthroughCasesInSwitch: true,
|
|
72
|
+
},
|
|
73
|
+
include: ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return files;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=vue.fallback.js.map
|
|
@@ -17,7 +17,6 @@ export declare class NextAdapter implements FrontendAdapter {
|
|
|
17
17
|
applyZudojsStructure(context: FrontendGenerationContext): Promise<void>;
|
|
18
18
|
generateIntegration(context: FrontendGenerationContext): Promise<void>;
|
|
19
19
|
validate(context: FrontendGenerationContext): Promise<ValidationResult>;
|
|
20
|
-
private getBaseFiles;
|
|
21
20
|
private getStructure;
|
|
22
21
|
private getIntegrationFiles;
|
|
23
22
|
}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { execCommand } from "../../utils/utils.exec.js";
|
|
7
7
|
import { writeFileTree } from "../../utils/utils.fileSystem.js";
|
|
8
8
|
import { scaffoldWithFallback } from "../../scaffolders/scaffolder.helper.js";
|
|
9
|
+
import { renderNextFallback, versionFromRange } from "./fallback/index.js";
|
|
10
|
+
import { DEPENDENCY_VERSION_RANGES as V } from "../../resolvers/dependency/dependencyVersions.constant.js";
|
|
9
11
|
/**
|
|
10
12
|
* Next.js adapter with App Router support.
|
|
11
13
|
*/
|
|
@@ -22,10 +24,10 @@ export class NextAdapter {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
async getLatestVersion() {
|
|
25
|
-
return
|
|
27
|
+
return versionFromRange(V.next);
|
|
26
28
|
}
|
|
27
29
|
async scaffold(context) {
|
|
28
|
-
const files =
|
|
30
|
+
const files = renderNextFallback(context);
|
|
29
31
|
await scaffoldWithFallback({
|
|
30
32
|
command: "npx",
|
|
31
33
|
args: [
|
|
@@ -34,10 +36,16 @@ export class NextAdapter {
|
|
|
34
36
|
"--typescript",
|
|
35
37
|
"--no-eslint",
|
|
36
38
|
"--no-tailwind",
|
|
37
|
-
|
|
39
|
+
// The Zudojs structure and the fallback both live under src/.
|
|
40
|
+
"--src-dir",
|
|
38
41
|
"--app",
|
|
39
|
-
"--
|
|
40
|
-
"
|
|
42
|
+
"--import-alias",
|
|
43
|
+
"@/*",
|
|
44
|
+
// The pipeline installs with the project's package manager, and a
|
|
45
|
+
// fullstack project's apps/web must not become a nested git repo.
|
|
46
|
+
`--use-${context.packageManager}`,
|
|
47
|
+
"--skip-install",
|
|
48
|
+
"--disable-git",
|
|
41
49
|
],
|
|
42
50
|
targetPath: context.projectPath,
|
|
43
51
|
fallbackFiles: files,
|
|
@@ -49,7 +57,9 @@ export class NextAdapter {
|
|
|
49
57
|
deps.push({ name: "zustand", type: "dependency" });
|
|
50
58
|
}
|
|
51
59
|
if (context.features.testing) {
|
|
52
|
-
deps.push({ name: "vitest", type: "devDependency" }, { name: "@testing-library/react", type: "devDependency" },
|
|
60
|
+
deps.push({ name: "vitest", type: "devDependency" }, { name: "@testing-library/react", type: "devDependency" },
|
|
61
|
+
// Peer dependency of @testing-library/react since v16.
|
|
62
|
+
{ name: "@testing-library/dom", type: "devDependency" }, { name: "@testing-library/jest-dom", type: "devDependency" }, { name: "@testing-library/user-event", type: "devDependency" }, { name: "jsdom", type: "devDependency" });
|
|
53
63
|
}
|
|
54
64
|
return deps;
|
|
55
65
|
}
|
|
@@ -69,95 +79,6 @@ export class NextAdapter {
|
|
|
69
79
|
}
|
|
70
80
|
return { valid: errors.length === 0, errors, warnings };
|
|
71
81
|
}
|
|
72
|
-
getBaseFiles(context) {
|
|
73
|
-
return {
|
|
74
|
-
"package.json": JSON.stringify({
|
|
75
|
-
name: context.project.name,
|
|
76
|
-
version: "0.1.0",
|
|
77
|
-
private: true,
|
|
78
|
-
scripts: {
|
|
79
|
-
dev: "next dev",
|
|
80
|
-
build: "next build",
|
|
81
|
-
start: "next start",
|
|
82
|
-
},
|
|
83
|
-
dependencies: {
|
|
84
|
-
next: "^15.0.0",
|
|
85
|
-
react: "^19.0.0",
|
|
86
|
-
"react-dom": "^19.0.0",
|
|
87
|
-
},
|
|
88
|
-
devDependencies: {
|
|
89
|
-
typescript: "^5.0.0",
|
|
90
|
-
"@types/react": "^19.0.0",
|
|
91
|
-
"@types/node": "^20.0.0",
|
|
92
|
-
},
|
|
93
|
-
}, null, 2),
|
|
94
|
-
"next.config.ts": `/** @type {import("next").NextConfig} */
|
|
95
|
-
const nextConfig = {
|
|
96
|
-
reactStrictMode: true,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export default nextConfig;
|
|
100
|
-
`,
|
|
101
|
-
"tsconfig.json": JSON.stringify({
|
|
102
|
-
compilerOptions: {
|
|
103
|
-
target: "ES2017",
|
|
104
|
-
lib: ["dom", "dom.iterable", "esnext"],
|
|
105
|
-
allowJs: true,
|
|
106
|
-
skipLibCheck: true,
|
|
107
|
-
strict: true,
|
|
108
|
-
noEmit: true,
|
|
109
|
-
esModuleInterop: true,
|
|
110
|
-
module: "esnext",
|
|
111
|
-
moduleResolution: "bundler",
|
|
112
|
-
resolveJsonModule: true,
|
|
113
|
-
isolatedModules: true,
|
|
114
|
-
jsx: "preserve",
|
|
115
|
-
incremental: true,
|
|
116
|
-
plugins: [{ name: "next" }],
|
|
117
|
-
paths: { "@/*": ["./src/*"] },
|
|
118
|
-
},
|
|
119
|
-
include: [
|
|
120
|
-
"next-env.d.ts",
|
|
121
|
-
"**/*.ts",
|
|
122
|
-
"**/*.tsx",
|
|
123
|
-
".next/types/**/*.ts",
|
|
124
|
-
],
|
|
125
|
-
exclude: ["node_modules"],
|
|
126
|
-
}, null, 2),
|
|
127
|
-
"src/app/layout.tsx": `import type { Metadata } from "next";
|
|
128
|
-
|
|
129
|
-
export const metadata: Metadata = {
|
|
130
|
-
title: "${context.project.name}",
|
|
131
|
-
description: "Generated by Zudojs",
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export default function RootLayout({
|
|
135
|
-
children,
|
|
136
|
-
}: {
|
|
137
|
-
children: React.ReactNode;
|
|
138
|
-
}) {
|
|
139
|
-
return (
|
|
140
|
-
<html lang="en">
|
|
141
|
-
<body>{children}</body>
|
|
142
|
-
</html>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
`,
|
|
146
|
-
"src/app/page.tsx": `export default function Home() {
|
|
147
|
-
return (
|
|
148
|
-
<main>
|
|
149
|
-
<h1>Hello from Zudojs</h1>
|
|
150
|
-
</main>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
`,
|
|
154
|
-
"src/app/globals.css": `body {
|
|
155
|
-
margin: 0;
|
|
156
|
-
font-family: system-ui, -apple-system, sans-serif;
|
|
157
|
-
}
|
|
158
|
-
`,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
82
|
getStructure(context) {
|
|
162
83
|
const srcDir = "src";
|
|
163
84
|
return {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { FrontendAdapter, FrontendGenerationContext, DependencyRequirement, ValidationResult } from "./frontendAdapter.type.js";
|
|
7
7
|
/**
|
|
8
|
-
* Nuxt adapter
|
|
8
|
+
* Nuxt adapter targeting Nuxt 4 (application code under app/).
|
|
9
9
|
*/
|
|
10
10
|
export declare class NuxtAdapter implements FrontendAdapter {
|
|
11
11
|
readonly name = "nuxt";
|
|
@@ -17,7 +17,6 @@ export declare class NuxtAdapter implements FrontendAdapter {
|
|
|
17
17
|
applyZudojsStructure(context: FrontendGenerationContext): Promise<void>;
|
|
18
18
|
generateIntegration(context: FrontendGenerationContext): Promise<void>;
|
|
19
19
|
validate(context: FrontendGenerationContext): Promise<ValidationResult>;
|
|
20
|
-
private getBaseFiles;
|
|
21
20
|
private getStructure;
|
|
22
21
|
private getIntegrationFiles;
|
|
23
22
|
}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { writeFileTree } from "../../utils/utils.fileSystem.js";
|
|
7
7
|
import { scaffoldWithFallback } from "../../scaffolders/scaffolder.helper.js";
|
|
8
|
+
import { renderNuxtFallback, versionFromRange } from "./fallback/index.js";
|
|
9
|
+
import { DEPENDENCY_VERSION_RANGES as V } from "../../resolvers/dependency/dependencyVersions.constant.js";
|
|
8
10
|
/**
|
|
9
|
-
* Nuxt adapter
|
|
11
|
+
* Nuxt adapter targeting Nuxt 4 (application code under app/).
|
|
10
12
|
*/
|
|
11
13
|
export class NuxtAdapter {
|
|
12
14
|
name = "nuxt";
|
|
@@ -15,13 +17,29 @@ export class NuxtAdapter {
|
|
|
15
17
|
return true;
|
|
16
18
|
}
|
|
17
19
|
async getLatestVersion() {
|
|
18
|
-
return
|
|
20
|
+
return versionFromRange(V.nuxt);
|
|
19
21
|
}
|
|
20
22
|
async scaffold(context) {
|
|
21
|
-
const files =
|
|
23
|
+
const files = renderNuxtFallback(context);
|
|
22
24
|
await scaffoldWithFallback({
|
|
23
25
|
command: "npx",
|
|
24
|
-
|
|
26
|
+
// Without --template, --packageManager and --gitInit nuxi exits with
|
|
27
|
+
// "Missing required arguments" in a non-interactive shell, so every
|
|
28
|
+
// Nuxt project used to get the fallback. --force lets it write into
|
|
29
|
+
// the existing (empty or pnpm-workspace-only) directory without
|
|
30
|
+
// removing what is there.
|
|
31
|
+
args: [
|
|
32
|
+
"nuxi@latest",
|
|
33
|
+
"init",
|
|
34
|
+
".",
|
|
35
|
+
"--template",
|
|
36
|
+
"minimal",
|
|
37
|
+
"--packageManager",
|
|
38
|
+
context.packageManager,
|
|
39
|
+
"--no-gitInit",
|
|
40
|
+
"--no-install",
|
|
41
|
+
"--force",
|
|
42
|
+
],
|
|
25
43
|
targetPath: context.projectPath,
|
|
26
44
|
fallbackFiles: files,
|
|
27
45
|
});
|
|
@@ -52,54 +70,25 @@ export class NuxtAdapter {
|
|
|
52
70
|
}
|
|
53
71
|
return { valid: errors.length === 0, errors, warnings };
|
|
54
72
|
}
|
|
55
|
-
getBaseFiles(context) {
|
|
56
|
-
return {
|
|
57
|
-
"package.json": JSON.stringify({
|
|
58
|
-
name: context.project.name,
|
|
59
|
-
version: "0.1.0",
|
|
60
|
-
private: true,
|
|
61
|
-
scripts: {
|
|
62
|
-
dev: "nuxt dev",
|
|
63
|
-
build: "nuxt build",
|
|
64
|
-
preview: "nuxt preview",
|
|
65
|
-
},
|
|
66
|
-
dependencies: {
|
|
67
|
-
nuxt: "^3.15.0",
|
|
68
|
-
},
|
|
69
|
-
devDependencies: {
|
|
70
|
-
"@nuxt/devtools": "latest",
|
|
71
|
-
},
|
|
72
|
-
}, null, 2),
|
|
73
|
-
"nuxt.config.ts": `export default defineNuxtConfig({
|
|
74
|
-
compatibilityDate: "2024-11-01",
|
|
75
|
-
devtools: { enabled: true },
|
|
76
|
-
});
|
|
77
|
-
`,
|
|
78
|
-
"app.vue": `<template>
|
|
79
|
-
<div>
|
|
80
|
-
<h1>Hello from Zudojs</h1>
|
|
81
|
-
</div>
|
|
82
|
-
</template>
|
|
83
|
-
`,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
73
|
getStructure(context) {
|
|
74
|
+
// Nuxt 4 resolves application code from app/ (its srcDir); server/
|
|
75
|
+
// and shared/ stay at the project root.
|
|
87
76
|
return {
|
|
88
|
-
"components/.gitkeep": "",
|
|
89
|
-
"composables/.gitkeep": "",
|
|
90
|
-
"layouts/.gitkeep": "",
|
|
91
|
-
"pages/.gitkeep": "",
|
|
77
|
+
"app/components/.gitkeep": "",
|
|
78
|
+
"app/composables/.gitkeep": "",
|
|
79
|
+
"app/layouts/.gitkeep": "",
|
|
80
|
+
"app/pages/.gitkeep": "",
|
|
81
|
+
"app/stores/.gitkeep": "",
|
|
82
|
+
"app/utils/.gitkeep": "",
|
|
92
83
|
"server/.gitkeep": "",
|
|
93
|
-
"
|
|
94
|
-
"types/index.ts": "// Types\nexport {};\n",
|
|
95
|
-
"utils/.gitkeep": "",
|
|
84
|
+
"shared/types/index.ts": "// Types\nexport {};\n",
|
|
96
85
|
};
|
|
97
86
|
}
|
|
98
87
|
getIntegrationFiles(context) {
|
|
99
88
|
const files = {};
|
|
100
89
|
if (context.project.type === "fullstack") {
|
|
101
90
|
files[".env.example"] = `NUXT_PUBLIC_API_URL=http://localhost:3000\n`;
|
|
102
|
-
files["composables/useApi.ts"] = `/**
|
|
91
|
+
files["app/composables/useApi.ts"] = `/**
|
|
103
92
|
* API Client for backend communication.
|
|
104
93
|
*/
|
|
105
94
|
|
|
@@ -17,7 +17,6 @@ export declare class ReactAdapter implements FrontendAdapter {
|
|
|
17
17
|
applyZudojsStructure(context: FrontendGenerationContext): Promise<void>;
|
|
18
18
|
generateIntegration(context: FrontendGenerationContext): Promise<void>;
|
|
19
19
|
validate(context: FrontendGenerationContext): Promise<ValidationResult>;
|
|
20
|
-
private getBaseFiles;
|
|
21
20
|
private getStructure;
|
|
22
21
|
private getZudojsStandardStructure;
|
|
23
22
|
private getFeatureBasedStructure;
|