@xeno-js/cli 0.1.0 → 0.1.1

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.
Files changed (91) hide show
  1. package/dist/index.js +3675 -18
  2. package/dist/index.js.map +1 -0
  3. package/eslint.config.mjs +1 -0
  4. package/package.json +4 -3
  5. package/tsup.config.ts +13 -0
  6. package/dist/domain/contracts/icommand-cli.contracts.js +0 -2
  7. package/dist/domain/contracts/icommand-runner.contracts.js +0 -2
  8. package/dist/domain/contracts/idispatch.contracts.js +0 -2
  9. package/dist/domain/contracts/ifile-service.contracts.js +0 -2
  10. package/dist/domain/contracts/igenerator.contracts.js +0 -2
  11. package/dist/domain/contracts/index.js +0 -2
  12. package/dist/domain/contracts/iscaffold-strategy.contracts.js +0 -2
  13. package/dist/domain/index.js +0 -2
  14. package/dist/generator.contracts.js +0 -13
  15. package/dist/infrastructure/bootstrap/bootstrapper.js +0 -32
  16. package/dist/infrastructure/bootstrap/index.js +0 -17
  17. package/dist/infrastructure/builder/builder.js +0 -16
  18. package/dist/infrastructure/builder/builder.test.js +0 -30
  19. package/dist/infrastructure/builder/index.js +0 -17
  20. package/dist/infrastructure/command_launcher/command.utils.js +0 -30
  21. package/dist/infrastructure/command_launcher/index.js +0 -2
  22. package/dist/infrastructure/commands/command-runner.service.js +0 -36
  23. package/dist/infrastructure/commands/generate.command.js +0 -48
  24. package/dist/infrastructure/commands/help.command.js +0 -44
  25. package/dist/infrastructure/commands/index.js +0 -20
  26. package/dist/infrastructure/commands/new-project.command.js +0 -43
  27. package/dist/infrastructure/dispatcher/dispatcher.js +0 -39
  28. package/dist/infrastructure/dispatcher/index.js +0 -17
  29. package/dist/infrastructure/file/file.service.js +0 -13
  30. package/dist/infrastructure/file/index.js +0 -17
  31. package/dist/infrastructure/generators/bootstrap.generator.js +0 -118
  32. package/dist/infrastructure/generators/core/bootstrap.generator.js +0 -118
  33. package/dist/infrastructure/generators/core/command/cqrs.generator.js +0 -49
  34. package/dist/infrastructure/generators/core/command/generate-command.generator.js +0 -163
  35. package/dist/infrastructure/generators/core/command/generate-query.generator.js +0 -131
  36. package/dist/infrastructure/generators/core/drizzle-sql-lite.generator.js +0 -78
  37. package/dist/infrastructure/generators/core/drizzle.generator.js +0 -85
  38. package/dist/infrastructure/generators/core/env.generator.js +0 -69
  39. package/dist/infrastructure/generators/core/index.js +0 -25
  40. package/dist/infrastructure/generators/core/main.generator.js +0 -45
  41. package/dist/infrastructure/generators/core/packagejson.generator.js +0 -78
  42. package/dist/infrastructure/generators/core/readme.generator.js +0 -431
  43. package/dist/infrastructure/generators/core/registry.generator.js +0 -46
  44. package/dist/infrastructure/generators/core/tsconfig.generator.js +0 -41
  45. package/dist/infrastructure/generators/core-packagejson.generator.js +0 -78
  46. package/dist/infrastructure/generators/drizzle-sql-lite.generator.js +0 -78
  47. package/dist/infrastructure/generators/drizzle.generator.js +0 -85
  48. package/dist/infrastructure/generators/env-vue.generator.js +0 -40
  49. package/dist/infrastructure/generators/env.generator.js +0 -71
  50. package/dist/infrastructure/generators/gitignore.generator.js +0 -62
  51. package/dist/infrastructure/generators/index.js +0 -26
  52. package/dist/infrastructure/generators/main.generator.js +0 -45
  53. package/dist/infrastructure/generators/readme.generator.js +0 -431
  54. package/dist/infrastructure/generators/registry.generator.js +0 -46
  55. package/dist/infrastructure/generators/tsconfig-vue.generator.js +0 -39
  56. package/dist/infrastructure/generators/tsconfig.generator.js +0 -41
  57. package/dist/infrastructure/generators/vite-config.generator.js +0 -39
  58. package/dist/infrastructure/generators/vue/app-vue.generator.js +0 -26
  59. package/dist/infrastructure/generators/vue/bootstrap-ts.generator.js +0 -59
  60. package/dist/infrastructure/generators/vue/command_query/cqrs.generator.js +0 -36
  61. package/dist/infrastructure/generators/vue/command_query/generate-command-vue.generator.js +0 -139
  62. package/dist/infrastructure/generators/vue/command_query/generate-query-vue.generator.js +0 -147
  63. package/dist/infrastructure/generators/vue/env.generator.js +0 -40
  64. package/dist/infrastructure/generators/vue/index-html.generator.js +0 -29
  65. package/dist/infrastructure/generators/vue/index.js +0 -28
  66. package/dist/infrastructure/generators/vue/main.generator.js +0 -45
  67. package/dist/infrastructure/generators/vue/packagejson.generator.js +0 -59
  68. package/dist/infrastructure/generators/vue/readme.generator.js +0 -394
  69. package/dist/infrastructure/generators/vue/registry-ts.generator.js +0 -28
  70. package/dist/infrastructure/generators/vue/router.generator.js +0 -33
  71. package/dist/infrastructure/generators/vue/tailwind.generator.js +0 -19
  72. package/dist/infrastructure/generators/vue/tsconfig.generator.js +0 -39
  73. package/dist/infrastructure/generators/vue/use-app.generator.js +0 -43
  74. package/dist/infrastructure/generators/vue/vite-config.generator.js +0 -39
  75. package/dist/infrastructure/generators/vue-packagejson.generator.js +0 -59
  76. package/dist/infrastructure/generators/vue-readme.generator.js +0 -53
  77. package/dist/infrastructure/generators/vue-source-files.generator.js +0 -136
  78. package/dist/infrastructure/index.js +0 -21
  79. package/dist/infrastructure/strategies/core-scaffold.strategy.js +0 -99
  80. package/dist/infrastructure/strategies/index.js +0 -18
  81. package/dist/infrastructure/strategies/vue-scaffold.strategy.js +0 -79
  82. package/dist/scaffolding.engine.js +0 -60
  83. package/dist/shared/constants/command.constants.js +0 -19
  84. package/dist/shared/constants/core.constants.js +0 -10
  85. package/dist/shared/constants/index.js +0 -18
  86. package/dist/shared/index.js +0 -18
  87. package/dist/shared/types/common.types.js +0 -2
  88. package/dist/shared/types/index.js +0 -2
  89. package/dist/shared/utils/guards.utils.js +0 -310
  90. package/dist/shared/utils/index.js +0 -18
  91. package/dist/shared/utils/string.utils.js +0 -62
@@ -1,394 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ReadmeVueGenerator = void 0;
7
- // src/infrastructure/generators/vue-readme.generator.ts
8
- const node_path_1 = __importDefault(require("node:path"));
9
- class ReadmeVueGenerator {
10
- _fileService;
11
- constructor(_fileService) {
12
- this._fileService = _fileService;
13
- }
14
- async generate(projectPath, options) {
15
- const content = `# ${options.targetDir}
16
-
17
- <div align="center">
18
- <img src="logo/logo.png" alt="Xeno Logo" width="140" />
19
-
20
- <h1>Xeno Vue</h1>
21
-
22
- <p><em>Enterprise-grade DDD & CQRS framework for Vue.js</em></p>
23
-
24
- <p>
25
- <a href="https://github.com/xeno-js/xeno-js">
26
- <img src="https://img.shields.io/badge/Powered%20by-Xeno-blueviolet?style=flat-square" alt="Powered by Xeno" />
27
- </a>
28
- <a href="https://github.com/xeno-js/xeno-fe/blob/main/LICENSE">
29
- <img src="https://img.shields.io/npm/l/@xeno-js/vue?style=flat-square" alt="License: ISC" />
30
- </a>
31
- <a href="https://www.npmjs.com/package/@xeno-js/vue">
32
- <img src="https://img.shields.io/npm/v/@xeno-js/vue?style=flat-square" alt="NPM Version" />
33
- </a>
34
- <a href="https://buymeacoffee.com/xenojs">
35
- <img src="https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-FFdd00?style=flat-square&logo=buy-me-a-coffee&logoColor=black" alt="Buy Me A Coffee" />
36
- </a>
37
- </p>
38
- </div>
39
-
40
- ---
41
-
42
- ## What is Xeno Vue?
43
-
44
- **Xeno Vue** (\`@xeno-js/vue\`) is an enterprise-grade, deterministic
45
- architectural framework that brings the strictness of **Domain-Driven Design
46
- (DDD)** and **Command Query Responsibility Segregation (CQRS)** natively to the
47
- browser.
48
-
49
- By shifting operational logic, remote data fetching, and state mutations away
50
- from Vue components and Pinia stores, Xeno ensures your frontend architecture
51
- remains pristine, highly testable, and completely decoupled from the UI layer.
52
- It treats the browser as a complex distributed client, not just a document
53
- viewer.
54
-
55
- ---
56
-
57
- ## 💡 Why Choose Xeno Vue?
58
-
59
- Modern frontend development often leads to "Spaghetti State" where API calls,
60
- business rules, and DOM manipulations are tightly coupled inside components.
61
- Xeno Vue fixes this with an emphasis on pure Dependency Injection (DI) and clean
62
- boundaries.
63
-
64
- - **Zero-Magic Dependency Injection**: Xeno provides an explicit
65
- \`XenoAppBuilder\` to construct your IoC container at bootstrap. No hidden Vue
66
- plugins doing implicit injections. You have total control over the dependency
67
- graph.
68
- - **Total UI Decoupling**: Vue components act strictly as the Presentation
69
- Layer. Business logic, API calls, and CQRS handlers live in pure, isolated
70
- TypeScript classes. You can swap Vue for React tomorrow without touching your
71
- core domain.
72
- - **Enterprise-Grade Client Resiliency**: The browser is a hostile, unreliable
73
- environment. Xeno Vue natively integrates \`Cockatiel\` and \`Axios\` to provide
74
- out-of-the-box circuit breakers, retries with jitter, and bulkheads directly
75
- in the client.
76
- - **Frontend Middleware Pipeline**: Handle Authentication, CSRF validation,
77
- aggressive Query Caching, and Performance logging _before_ a command is
78
- executed or an API call fires, using the native \`Mediator\` pipeline.
79
-
80
- ---
81
-
82
- ## 📖 Documentation & Getting Started
83
-
84
- To explore the architecture, programmatic configurations, and extension
85
- workflows of Xeno Vue, read the full technical manuals located inside the main
86
- documentation hub:
87
-
88
- - **[Framework Documentation Repository](https://www.xeno-js.it/vue/overview)**
89
-
90
- Inside, you will find exhaustive, step-by-step assembly guides covering frontend
91
- IoC building (\`XenoAppBuilder\`), Vue \`Provide/Inject\` boundaries, and CQRS
92
- composables.
93
-
94
- ---
95
-
96
- ## 🚀 Live Executable Demos
97
-
98
- Want to see how Xeno Vue works? Check out the functional example application
99
- showcasing end-to-end command/query segregation, resilient HTTP fetching, and
100
- pure Composition API integration.
101
-
102
- - **[Xeno Vue Demo Architecture](https://www.xeno-js.it/demo)**
103
-
104
- ---
105
-
106
- ## 📦 Installation
107
-
108
- Install the Vue package:
109
-
110
- \`\`\`bash
111
- npm install @xeno-js/vue
112
-
113
- \`\`\`
114
-
115
- Xeno uses **Optional Peer Dependencies**. You only install the external
116
- libraries you actually need.
117
-
118
- \`\`\`bash
119
- # Example: Install tools only if you enable them in the builder
120
- npm install axios cockatiel zod @supabase/supabase-js @sentry/vue
121
-
122
- \`\`\`
123
-
124
- ---
125
-
126
- ## ⚡ Bootstrapping & Component Example
127
-
128
- Below is an architectural example of how to configure the Xeno \`XenoAppBuilder\`,
129
- inject it into the Vue application, and consume it using Composition API
130
- Composables.
131
-
132
- ### 1. Initialize the Container (\`src/bootstrap.ts\`)
133
-
134
- \`\`\`typescript
135
- import { XenoAppBuilder, LOG_LEVEL, TOKENS } from '@xeno-js/vue'
136
- import { BffRemoteDataSource } from './infrastructure'
137
-
138
- import type { RemoteDataSource, XenoVueRegistry } from '@xeno-js/vue'
139
-
140
- export type MyRegistry = XenoVueRegistry<{
141
- BFF_REMOTE_DS: RemoteDataSource
142
- }>
143
-
144
- // Create the root IoC container context for the browser
145
- const builder = XenoAppBuilder.create<MyRegistry>()
146
- .addContext((opts) => {
147
- opts.contextAccessor = useContextStore()
148
- })
149
- .addLogger((opts, config) => {
150
- opts.console = config.get('VITE_APP_ENV') === 'development'
151
- opts.level = LOG_LEVEL.DEBUG
152
- })
153
- .addAuth((opts, config) => {
154
- opts.url = config.getOrThrow('VITE_SUPABASE_URL')
155
- opts.key = config.getOrThrow('VITE_SUPABASE_KEY')
156
- })
157
- .addHttpCore('BFF_REMOTE_DS', (opts, config) => {
158
- opts.client = {
159
- baseURL: config.getOrThrow('VITE_API_BASE_URL'),
160
- timeoutMs: 10000,
161
- }
162
- opts.resilience.retry.attempts = 3
163
- opts.factory = (http, resilience) =>
164
- new BffRemoteDataSource(http, resilience)
165
- })
166
- .addPipeline((config) => {
167
- config.queryCaching = true // Enable in-memory caching for Queries
168
- })
169
-
170
- export async function bootstrap() {
171
- return await builder.build()
172
- }
173
- \`\`\`
174
-
175
- ### 2. Inject into Vue (\`src/main.ts\`)
176
-
177
- \`\`\`typescript
178
- import { createApp } from 'vue'
179
- import App from './App.vue'
180
- import { bootstrap } from './bootstrap'
181
- import { XENO_SERVICES_KEY, ServicesUtils } from '@xeno-js/vue'
182
-
183
- async function mountApp() {
184
- try {
185
- const app = createApp(App)
186
- const container = await bootstrap()
187
-
188
- // Provide the Xeno IoC container globally to all components
189
- app.provide(XENO_SERVICES_KEY, container)
190
-
191
- // Register global services utility for composables
192
- ServicesUtils.setGlobalServices(container)
193
-
194
- app.mount('#app')
195
- } catch (error) {
196
- console.error('Critical error during frontend bootstrap:', error)
197
- }
198
- }
199
-
200
- mountApp()
201
- \`\`\`
202
-
203
- ### 3. CQRS Composable Usage (\`src/features/users/use-create-user.ts\`)
204
-
205
- \`\`\`typescript
206
- import { ref } from 'vue'
207
- import { Result } from '@xeno-js/shared'
208
- import { ServicesUtils } from '@/use-app'
209
- import { CreateUserCommand } from './create-user.command'
210
-
211
- export function useCreateUser() {
212
- const loading = ref(false)
213
- const error = ref<string | null>(null)
214
-
215
- const execute = async (payload: { email: string; name: string }) => {
216
- if (loading.value) return Result.fail(new Error('Already executing'))
217
- loading.value = true
218
- error.value = null
219
-
220
- try {
221
- // Safely resolve the Mediator from the Xeno Container
222
- const { mediator, BFF_REMOTE_DS } = ServicesUtils.useApp()
223
- const command = new CreateUserCommand()
224
-
225
- const result = await mediator.send(command, async () => {
226
- const apiResult = await bffRemoteDs.post('/v1/users', payload)
227
-
228
- if (!apiResult.isOk()) return Result.fail(apiResult.getErrorOrThrow())
229
- return Result.ok(apiResult.getValueOrThrow())
230
- })
231
-
232
- if (!result.isOk()) {
233
- error.value = result.getErrorOrThrow().message
234
- }
235
-
236
- return result
237
- } finally {
238
- loading.value = false
239
- }
240
- }
241
-
242
- return { loading, error, execute }
243
- }
244
- \`\`\`
245
-
246
- ---
247
-
248
- ## 🛠 Scaffold your project with CLI
249
-
250
- Xeno includes an official CLI tool, \`@xeno-js/cli\`, designed to bootstrap your
251
- new application in seconds. It offers an interactive setup for Vue projects,
252
- instantly scaffolding the CQRS files, composables, and dependency injection
253
- boundaries.
254
-
255
- \`\`\`bash
256
- # Generate a new Vue project
257
- npx @xeno-js/cli new my-frontend-app --vue
258
-
259
- # Generate a Vue Command with its Composable
260
- npx @xeno-js/cli g command CreateUser --vue
261
-
262
- \`\`\`
263
-
264
- Check the
265
- **[CLI Documentation](https://www.google.com/search?q=https://www.xeno-js.it/cli/overview&utm_source=gemini)**
266
- for full options.
267
-
268
- ---
269
-
270
- ## 🤝 For Contributors
271
-
272
- We welcome contributions to Xeno! To maintain the highest code quality and
273
- stability of the core framework, **direct pushes to the \`main\` and \`develop\`
274
- branches are strictly prohibited.** Please follow this Git Flow to contribute:
275
-
276
- 1. **Branch off from \`develop**\`: Create a new branch for your feature or
277
- bugfix.
278
-
279
- \`\`\`bash
280
- git checkout develop
281
- git pull origin develop
282
- git checkout -b feat/your-awesome-feature
283
-
284
- \`\`\`
285
-
286
- 2. **Make your changes**: Write your code and ensure it passes all local checks
287
- (linting, types, and tests).
288
-
289
- \`\`\`bash
290
- npm run check
291
-
292
- \`\`\`
293
-
294
- 3. **Commit your changes**: We enforce
295
- [Conventional Commits](https://www.conventionalcommits.org/?utm_source=gemini).
296
- Husky will verify your commit message format.
297
- 4. **Commit Format:**
298
-
299
- \`\`\`bash
300
- feat(scope): add new feature
301
- fix(scope): resolve bug
302
- chore(scope): update dependencies
303
-
304
- \`\`\`
305
-
306
- 5. **Submit a Pull Request (PR)**: Push your branch to GitHub and open a Pull
307
- Request targeting the **\`develop\`** branch.
308
- 6. **Review**: The repository owner will review your code, run pipeline tests,
309
- and merge it into \`develop\`.
310
-
311
- _Note: The \`main\` branch is strictly reserved for production releases. Code
312
- flows from feature branches ➡️ \`develop\` ➡️ \`main\`._
313
-
314
- ### Scripts
315
-
316
- | Command | Description |
317
- | ----------------------- | ---------------------------------------------- |
318
- | \`npm run build\` | Builds the TypeScript source code into \`dist/\` |
319
- | \`npm run typecheck\` | Checks types without emitting files |
320
- | \`npm run lint\` | Runs ESLint |
321
- | \`npm run format\` | Formats code with Prettier |
322
- | \`npm run test\` | Runs the Vitest test suite |
323
- | \`npm run test:coverage\` | Runs tests and generates a coverage report |
324
-
325
- ### Code Quality (Husky & Git Hooks)
326
-
327
- This project strictly enforces code quality rules before pushing to the
328
- repository:
329
-
330
- - **\`pre-commit\`**: Runs \`lint-staged\` on staged files (ESLint + Prettier).
331
- - **\`commit-msg\`**: Checks commit messages with \`commitlint\` (we use
332
- Conventional Commits).
333
- - **\`pre-push\`**: Runs type checking, linting, and testing before code leaves
334
- your machine.
335
-
336
- ---
337
-
338
- ## 🌱 Support & Appreciation
339
-
340
- Building, benchmarking, and maintaining a progressive, enterprise-ready
341
- open-source framework requires a massive amount of continuous dedication and
342
- architectural engineering.
343
-
344
- If Xeno has brought value to your development workflows, helped decouple your
345
- core business logic, or simplified your system infrastructure layout, consider
346
- supporting its open-source lifecycle. Your backing directly accelerates our
347
- strategic roadmap for new out-of-the-box transport integrations and keeps the
348
- documentation pristine.
349
-
350
- **Want to know how you can contribute or sponsor Xeno?** We rely on the
351
- commitment of our community to keep the project independent and thriving.
352
- Whether you are an individual developer or a business using Xeno, your support
353
- makes a real difference.
354
-
355
- 👉
356
- **[Read our support guidelines and find out how to help](https://www.xeno-js.it/support-us)**
357
-
358
- Thank you for being part of this decoupled open-source journey!
359
-
360
- <amp-bounce>
361
- </amp-bounce>
362
- <a href="https://www.buymeacoffee.com/xenojs" target="_blank">
363
- <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="42" style="height: 42px !important;" />
364
- </a>
365
-
366
- ---
367
-
368
- ## 🛡️ Powered by Xeno
369
-
370
- If you are using Xeno in your project, let the world know! Add this badge to
371
- your README:
372
-
373
- \`\`\`html
374
- <a
375
- href="[https://github.com/xeno-js/xeno-fe](https://github.com/xeno-js/xeno-fe)"
376
- target="_blank"
377
- >
378
- <img
379
- src="[https://img.shields.io/badge/Powered%20by-Xeno-black?style=flat-square](https://img.shields.io/badge/Powered%20by-Xeno-black?style=flat-square)"
380
- alt="Powered by Xeno"
381
- height="20"
382
- />
383
- </a>
384
- \`\`\`
385
-
386
- ## 📄 License
387
-
388
- Copyright (c) 2026 Xeno. Licensed under the
389
- [ISC License](https://www.google.com/search?q=LICENSE&utm_source=gemini).
390
- `;
391
- await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, 'README.md'), content);
392
- }
393
- }
394
- exports.ReadmeVueGenerator = ReadmeVueGenerator;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RegistryGenerator = void 0;
7
- const node_path_1 = __importDefault(require("node:path"));
8
- class RegistryGenerator {
9
- _fileService;
10
- constructor(_fileService) {
11
- this._fileService = _fileService;
12
- }
13
- async generate(projectPath, _options) {
14
- const registryTs = `import type { XenoVueRegistry } from '@xeno-js/vue';
15
-
16
- /**
17
- * @file registry.ts
18
- * @description Centralized Type Contract for Dependency Injection in Vue.
19
- */
20
- export interface MyRegistry extends XenoVueRegistry {
21
- // Add your frontend injection tokens here
22
- // e.g., USER_DATA_SOURCE: IUserDataSource;
23
- }
24
- `;
25
- await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, 'src', 'registry.ts'), registryTs);
26
- }
27
- }
28
- exports.RegistryGenerator = RegistryGenerator;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RouterGenerator = void 0;
7
- const node_path_1 = __importDefault(require("node:path"));
8
- class RouterGenerator {
9
- _fileService;
10
- constructor(_fileService) {
11
- this._fileService = _fileService;
12
- }
13
- async generate(projectPath, options) {
14
- // 6. Optional router and assets
15
- if (options.router) {
16
- const routerTs = `import { createRouter, createWebHistory } from 'vue-router';
17
-
18
- export default createRouter({
19
- history: createWebHistory(),
20
- routes: [
21
- {
22
- path: '/',
23
- name: 'Home',
24
- component: () => import('../views/HomeView.vue')
25
- }
26
- ]
27
- });`;
28
- await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, 'src', 'router', 'index.ts'), routerTs);
29
- await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, 'src', 'views', 'HomeView.vue'), `<template>\n <h1>Home View</h1>\n</template>`);
30
- }
31
- }
32
- }
33
- exports.RouterGenerator = RouterGenerator;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TailwindGenerator = void 0;
7
- const node_path_1 = __importDefault(require("node:path"));
8
- class TailwindGenerator {
9
- _fileService;
10
- constructor(_fileService) {
11
- this._fileService = _fileService;
12
- }
13
- async generate(projectPath, options) {
14
- if (options.tailwind) {
15
- await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, 'src', 'assets', 'style.css'), `@import "tailwindcss";\n`);
16
- }
17
- }
18
- }
19
- exports.TailwindGenerator = TailwindGenerator;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TsconfigVueGenerator = void 0;
7
- // src/infrastructure/generators/tsconfig-vue.generator.ts
8
- const node_path_1 = __importDefault(require("node:path"));
9
- class TsconfigVueGenerator {
10
- _fileService;
11
- constructor(_fileService) {
12
- this._fileService = _fileService;
13
- }
14
- async generate(projectPath, _options) {
15
- const tsconfig = {
16
- compilerOptions: {
17
- target: 'ES2022',
18
- useDefineForClassFields: true,
19
- module: 'ESNext',
20
- moduleResolution: 'bundler',
21
- strict: true,
22
- jsx: 'preserve',
23
- resolveJsonModule: true,
24
- isolatedModules: true,
25
- esModuleInterop: true,
26
- lib: ['ES2022', 'DOM', 'DOM.Iterable'],
27
- skipLibCheck: true,
28
- noEmit: true,
29
- types: ['vite/client'],
30
- paths: {
31
- '@/*': ['./src/*'],
32
- },
33
- },
34
- include: ['src/**/*.ts', 'src/**/*.d.ts', 'src/**/*.tsx', 'src/**/*.vue'],
35
- };
36
- await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, 'tsconfig.json'), JSON.stringify(tsconfig, null, 2));
37
- }
38
- }
39
- exports.TsconfigVueGenerator = TsconfigVueGenerator;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UseAppVueGenerator = void 0;
7
- const node_path_1 = __importDefault(require("node:path"));
8
- class UseAppVueGenerator {
9
- _fileService;
10
- constructor(_fileService) {
11
- this._fileService = _fileService;
12
- }
13
- async generate(projectPath, _options) {
14
- const content = `import type { Nullable } from "@xeno-js/vue";
15
- import { Guards, XENO_SERVICES_KEY } from "@xeno-js/vue";
16
- import { inject } from "vue";
17
- import type { MyRegistry } from "./registry";
18
-
19
- let globalServices: Nullable<MyRegistry> = null;
20
-
21
- export const ServicesUtils = Object.freeze({
22
- // Metodo per registrare i servizi al bootstrap
23
- setGlobalServices(services: MyRegistry) {
24
- globalServices = services;
25
- },
26
- useApp(): MyRegistry {
27
- if (Guards.isDefined(globalServices))
28
- return globalServices;
29
-
30
- const services = inject<MyRegistry>(XENO_SERVICES_KEY);
31
- if (!services)
32
- throw new Error(
33
- '[Xeno Error]: XenoServices not found. Did you provide them using app.provide(XENO_SERVICES_KEY, services)?',
34
- );
35
-
36
- return services;
37
- }
38
- } as const);
39
- `;
40
- await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, 'src', 'use-app.ts'), content);
41
- }
42
- }
43
- exports.UseAppVueGenerator = UseAppVueGenerator;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ViteconfigGenerator = void 0;
7
- // src/infrastructure/generators/viteconfig.generator.ts
8
- const node_path_1 = __importDefault(require("node:path"));
9
- class ViteconfigGenerator {
10
- _fileService;
11
- constructor(_fileService) {
12
- this._fileService = _fileService;
13
- }
14
- async generate(projectPath, options) {
15
- const tailwindImport = options.tailwind ? `\nimport tailwindcss from '@tailwindcss/vite';` : '';
16
- const tailwindPlugin = options.tailwind ? `\n tailwindcss(),` : '';
17
- const content = `import { defineConfig } from 'vite';
18
- import vue from '@vitejs/plugin-vue';${tailwindImport}
19
- import path from 'node:path';
20
-
21
- export default defineConfig({
22
- plugins: [
23
- vue(),${tailwindPlugin}
24
- ],
25
- resolve: {
26
- alias: {
27
- '@': path.resolve(__dirname, './src'),
28
- },
29
- },
30
- server: {
31
- port: 5173,
32
- }
33
- });
34
- `;
35
- const filePath = node_path_1.default.join(projectPath, 'vite.config.ts');
36
- await this._fileService.writeFileRecursive(filePath, content);
37
- }
38
- }
39
- exports.ViteconfigGenerator = ViteconfigGenerator;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PackageJsonVueGenerator = void 0;
7
- const node_path_1 = __importDefault(require("node:path"));
8
- class PackageJsonVueGenerator {
9
- _fileService;
10
- constructor(_fileService) {
11
- this._fileService = _fileService;
12
- }
13
- async generate(projectPath, options) {
14
- const packageJson = {
15
- name: options.targetDir,
16
- version: '1.0.0',
17
- private: true,
18
- type: 'module',
19
- scripts: {
20
- dev: 'vite',
21
- build: 'vue-tsc -b && vite build',
22
- preview: 'vite preview',
23
- g: 'xeno-js generate',
24
- },
25
- dependencies: {
26
- '@xeno-js/vue': 'latest',
27
- vue: '^3.5.0',
28
- },
29
- devDependencies: {
30
- '@types/node': '^20.0.0',
31
- '@vitejs/plugin-vue': '^5.1.0',
32
- typescript: '^5.5.0',
33
- vite: '^5.4.0',
34
- 'vue-tsc': '^2.1.0',
35
- },
36
- };
37
- if (options.axios)
38
- packageJson.dependencies['axios'] = '^1.7.0';
39
- if (options.cockatiel)
40
- packageJson.dependencies['cockatiel'] = '^4.0.0';
41
- if (options.supabase)
42
- packageJson.dependencies['@supabase/supabase-js'] = '^2.45.0';
43
- if (options.sentry)
44
- packageJson.dependencies['@sentry/vue'] = '^8.28.0';
45
- if (options.pinia)
46
- packageJson.dependencies['pinia'] = '^2.2.0';
47
- if (options.router)
48
- packageJson.dependencies['vue-router'] = '^4.4.0';
49
- if (options.zod)
50
- packageJson.dependencies['zod'] = '^4.4.3';
51
- if (options.tailwind) {
52
- packageJson.devDependencies['tailwindcss'] = '^4.0.0';
53
- packageJson.devDependencies['@tailwindcss/vite'] = '^4.0.0';
54
- }
55
- const filePath = node_path_1.default.join(projectPath, 'package.json');
56
- await this._fileService.writeFileRecursive(filePath, JSON.stringify(packageJson, null, 2));
57
- }
58
- }
59
- exports.PackageJsonVueGenerator = PackageJsonVueGenerator;