@xeno-js/cli 0.1.2 → 0.1.4
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/LICENSE +18 -12
- package/README.md +461 -236
- package/dist/index.js +1018 -688
- package/dist/index.js.map +1 -1
- package/package.json +91 -66
- package/.github/.copilot-instruction.md +0 -73
- package/.github/agents/git-operator.agent.md +0 -86
- package/.github/agents/unit-tester.agent.md +0 -68
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.husky/pre-push +0 -1
- package/.prettierignore +0 -7
- package/.prettierrc.json +0 -37
- package/commitlint.config.cjs +0 -39
- package/eslint.config.mjs +0 -306
- package/lint-staged.config.mjs +0 -5
- package/logo/logo.png +0 -0
- package/src/domain/contracts/icommand-cli.contracts.ts +0 -13
- package/src/domain/contracts/icommand-runner.contracts.ts +0 -3
- package/src/domain/contracts/idispatch.contracts.ts +0 -3
- package/src/domain/contracts/ifile-service.contracts.ts +0 -3
- package/src/domain/contracts/igenerator.contracts.ts +0 -5
- package/src/domain/contracts/index.ts +0 -6
- package/src/domain/contracts/iscaffold-strategy.contracts.ts +0 -7
- package/src/domain/index.ts +0 -1
- package/src/index.ts +0 -30
- package/src/infrastructure/bootstrap/bootstrapper.ts +0 -30
- package/src/infrastructure/bootstrap/index.ts +0 -1
- package/src/infrastructure/builder/builder.test.ts +0 -36
- package/src/infrastructure/builder/builder.ts +0 -15
- package/src/infrastructure/builder/index.ts +0 -1
- package/src/infrastructure/command_launcher/command.utils.ts +0 -31
- package/src/infrastructure/command_launcher/index.ts +0 -0
- package/src/infrastructure/commands/command-runner.service.ts +0 -36
- package/src/infrastructure/commands/generate.command.ts +0 -55
- package/src/infrastructure/commands/help.command.ts +0 -63
- package/src/infrastructure/commands/index.ts +0 -4
- package/src/infrastructure/commands/new-project.command.ts +0 -47
- package/src/infrastructure/dispatcher/dispatcher.ts +0 -45
- package/src/infrastructure/dispatcher/index.ts +0 -1
- package/src/infrastructure/file/file.service.ts +0 -14
- package/src/infrastructure/file/index.ts +0 -1
- package/src/infrastructure/generators/core/bootstrap.generator.ts +0 -118
- package/src/infrastructure/generators/core/command/cqrs.generator.ts +0 -63
- package/src/infrastructure/generators/core/command/generate-command.generator.ts +0 -191
- package/src/infrastructure/generators/core/command/generate-query.generator.ts +0 -150
- package/src/infrastructure/generators/core/drizzle-sql-lite.generator.ts +0 -76
- package/src/infrastructure/generators/core/drizzle.generator.ts +0 -86
- package/src/infrastructure/generators/core/env.generator.ts +0 -69
- package/src/infrastructure/generators/core/index.ts +0 -9
- package/src/infrastructure/generators/core/main.generator.ts +0 -41
- package/src/infrastructure/generators/core/packagejson.generator.ts +0 -70
- package/src/infrastructure/generators/core/readme.generator.ts +0 -427
- package/src/infrastructure/generators/core/registry.generator.ts +0 -40
- package/src/infrastructure/generators/core/tsconfig.generator.ts +0 -39
- package/src/infrastructure/generators/gitignore.generator.ts +0 -60
- package/src/infrastructure/generators/vue/app-vue.generator.ts +0 -21
- package/src/infrastructure/generators/vue/bootstrap-ts.generator.ts +0 -60
- package/src/infrastructure/generators/vue/command_query/cqrs.generator.ts +0 -36
- package/src/infrastructure/generators/vue/command_query/generate-command-vue.generator.ts +0 -153
- package/src/infrastructure/generators/vue/command_query/generate-query-vue.generator.ts +0 -161
- package/src/infrastructure/generators/vue/env.generator.ts +0 -39
- package/src/infrastructure/generators/vue/index-html.generator.ts +0 -24
- package/src/infrastructure/generators/vue/index.ts +0 -12
- package/src/infrastructure/generators/vue/main.generator.ts +0 -41
- package/src/infrastructure/generators/vue/packagejson.generator.ts +0 -50
- package/src/infrastructure/generators/vue/readme.generator.ts +0 -389
- package/src/infrastructure/generators/vue/registry-ts.generator.ts +0 -26
- package/src/infrastructure/generators/vue/router.generator.ts +0 -35
- package/src/infrastructure/generators/vue/tailwind.generator.ts +0 -17
- package/src/infrastructure/generators/vue/tsconfig.generator.ts +0 -38
- package/src/infrastructure/generators/vue/use-app.generator.ts +0 -38
- package/src/infrastructure/generators/vue/vite-config.generator.ts +0 -35
- package/src/infrastructure/index.ts +0 -5
- package/src/infrastructure/strategies/core-scaffold.strategy.ts +0 -100
- package/src/infrastructure/strategies/index.ts +0 -2
- package/src/infrastructure/strategies/vue-scaffold.strategy.ts +0 -79
- package/src/shared/constants/command.constants.ts +0 -18
- package/src/shared/constants/core.constants.ts +0 -7
- package/src/shared/constants/index.ts +0 -2
- package/src/shared/index.ts +0 -3
- package/src/shared/types/common.types.ts +0 -68
- package/src/shared/types/index.ts +0 -1
- package/src/shared/utils/guards.utils.ts +0 -334
- package/src/shared/utils/index.ts +0 -2
- package/src/shared/utils/string.utils.ts +0 -60
- package/tsconfig.json +0 -15
- package/tsup.config.ts +0 -13
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
|
|
3
|
-
import type { IFileService } from '../../../../domain'
|
|
4
|
-
|
|
5
|
-
export class GenerateCommandVueGenerator {
|
|
6
|
-
constructor(private readonly _fileService: IFileService) {}
|
|
7
|
-
|
|
8
|
-
public async generate(
|
|
9
|
-
pascalName: string,
|
|
10
|
-
lowerName: string,
|
|
11
|
-
tokenPrefix: string,
|
|
12
|
-
componentDir: string,
|
|
13
|
-
): Promise<void> {
|
|
14
|
-
// 1. Command (Application)
|
|
15
|
-
const commandContent = `import { Command } from '@xeno-js/vue';
|
|
16
|
-
|
|
17
|
-
export class ${pascalName}Command extends Command {
|
|
18
|
-
constructor() {
|
|
19
|
-
super('${tokenPrefix}_COMMAND');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`
|
|
23
|
-
await this._fileService.writeFileRecursive(
|
|
24
|
-
path.join(componentDir, `${lowerName}.command.ts`),
|
|
25
|
-
commandContent,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
const handlerContent = `import type { IHandler, ResultType } from '@xeno-js/vue';
|
|
29
|
-
import { AppError, Result } from '@xeno-js/vue';
|
|
30
|
-
import type { ${pascalName}Command } from './${lowerName}.command';
|
|
31
|
-
import type { ${pascalName}Response } from './${lowerName}.model';
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* ⚠️ WARNING: ACTION REQUIRED ⚠️
|
|
35
|
-
*
|
|
36
|
-
* Please register your handler in the IoC container (e.g. src/bootstrap.ts) and add its token to MyRegistry.
|
|
37
|
-
*
|
|
38
|
-
* 1. In src/registry.ts:
|
|
39
|
-
* ${tokenPrefix}_HANDLER: IHandler<${pascalName}Command, ${pascalName}Response>;
|
|
40
|
-
*
|
|
41
|
-
* 2. In src/bootstrap.ts:
|
|
42
|
-
* .addServices((config, register) => {
|
|
43
|
-
* register('${tokenPrefix}_HANDLER', new ${pascalName}Handler());
|
|
44
|
-
* });
|
|
45
|
-
*/
|
|
46
|
-
export class ${pascalName}Handler implements IHandler<${pascalName}Command, ${pascalName}Response> {
|
|
47
|
-
constructor(
|
|
48
|
-
// TODO: Inject your remote DataSources or other services here
|
|
49
|
-
) {}
|
|
50
|
-
|
|
51
|
-
public async handle(command: ${pascalName}Command, signal: AbortSignal): Promise<ResultType<${pascalName}Response>> {
|
|
52
|
-
AppError.throwIfAborted(signal, this.constructor.name);
|
|
53
|
-
|
|
54
|
-
// TODO: Implement your frontend business logic or API calls here
|
|
55
|
-
return Result.ok();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`
|
|
59
|
-
await this._fileService.writeFileRecursive(
|
|
60
|
-
path.join(componentDir, `${lowerName}.handler.ts`),
|
|
61
|
-
handlerContent,
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
const composableContent = `import { ref } from 'vue';
|
|
65
|
-
import { AppError, Result, type ApiResponseDto, type ResultType } from '@xeno-js/vue';
|
|
66
|
-
import { ServicesUtils } from '@/use-app';
|
|
67
|
-
import { ${pascalName}Command } from './${lowerName}.command';
|
|
68
|
-
import type { ${pascalName}Request, ${pascalName}Response } from './${lowerName}.model';
|
|
69
|
-
|
|
70
|
-
/*
|
|
71
|
-
* ⚠️ WARNING: ACTION REQUIRED ⚠️
|
|
72
|
-
*
|
|
73
|
-
* Please register your handler in the IoC container (e.g. src/bootstrap.ts) and add its token to MyRegistry.
|
|
74
|
-
*
|
|
75
|
-
* 1. In src/registry.ts:
|
|
76
|
-
* ${tokenPrefix}_HANDLER: IHandler<${pascalName}Command, ${pascalName}Response>;
|
|
77
|
-
*
|
|
78
|
-
* 2. In src/bootstrap.ts:
|
|
79
|
-
* .addServices((config, register) => {
|
|
80
|
-
* register('${tokenPrefix}_HANDLER', new ${pascalName}Handler());
|
|
81
|
-
* });
|
|
82
|
-
*/
|
|
83
|
-
export function use${pascalName}() {
|
|
84
|
-
const loading = ref(false);
|
|
85
|
-
const error = ref<string | null>(null);
|
|
86
|
-
let abortController: AbortController | null = null;
|
|
87
|
-
|
|
88
|
-
const execute = async (payload: ${pascalName}Request): Promise<ResultType<${pascalName}Response>> => {
|
|
89
|
-
abortController = new AbortController();
|
|
90
|
-
|
|
91
|
-
if (loading.value) return Result.fail(AppError.create({
|
|
92
|
-
name: '${pascalName}Command',
|
|
93
|
-
message: '${pascalName}Command is already in progress',
|
|
94
|
-
code: '${tokenPrefix}_COMMAND_ALREADY_IN_PROGRESS',
|
|
95
|
-
status: 500,
|
|
96
|
-
cause: new Error('${tokenPrefix}_COMMAND_ALREADY_IN_PROGRESS'),
|
|
97
|
-
}));
|
|
98
|
-
loading.value = true;
|
|
99
|
-
error.value = null;
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
// Resolve mediator and handler from the container
|
|
103
|
-
const { mediator, ${tokenPrefix}_HANDLER: handler } = ServicesUtils.useApp();
|
|
104
|
-
const command = new ${pascalName}Command();
|
|
105
|
-
|
|
106
|
-
const result = await mediator.send(command, async () => {
|
|
107
|
-
return await handler.handle(command, abortController?.signal);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
if (!result.isOk()) {
|
|
111
|
-
error.value = result.getErrorOrThrow().message;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return result;
|
|
115
|
-
} finally {
|
|
116
|
-
loading.value = false;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const abort = () => {
|
|
121
|
-
if (abortController) {
|
|
122
|
-
abortController.abort();
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// Automatically cancel pending operations when the component unmounts
|
|
127
|
-
onUnmounted(() => {
|
|
128
|
-
abort();
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
return { loading, error, execute };
|
|
132
|
-
}
|
|
133
|
-
`
|
|
134
|
-
await this._fileService.writeFileRecursive(
|
|
135
|
-
path.join(componentDir, `use-${lowerName}.composable.ts`),
|
|
136
|
-
composableContent,
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
// 3. Domain Model (Domain)
|
|
140
|
-
const modelContent = `export interface ${pascalName}Request {
|
|
141
|
-
// TODO: Define your request payload properties here
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface ${pascalName}Response {
|
|
145
|
-
// TODO: Define your response properties here
|
|
146
|
-
}
|
|
147
|
-
`
|
|
148
|
-
await this._fileService.writeFileRecursive(
|
|
149
|
-
path.join(componentDir, `${lowerName}.model.ts`),
|
|
150
|
-
modelContent,
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
|
|
3
|
-
import type { IFileService } from '../../../../domain'
|
|
4
|
-
|
|
5
|
-
export class GenerateQueryVueGenerator {
|
|
6
|
-
constructor(private readonly _fileService: IFileService) {}
|
|
7
|
-
|
|
8
|
-
public async generate(
|
|
9
|
-
pascalName: string,
|
|
10
|
-
lowerName: string,
|
|
11
|
-
tokenPrefix: string,
|
|
12
|
-
componentDir: string,
|
|
13
|
-
): Promise<void> {
|
|
14
|
-
// 1. Query (Application)
|
|
15
|
-
const queryContent = `import { Query } from '@xeno-js/vue';
|
|
16
|
-
import type { ${pascalName}Response } from './${lowerName}.model';
|
|
17
|
-
|
|
18
|
-
export class ${pascalName}Query extends Query<${pascalName}Response> {
|
|
19
|
-
constructor() {
|
|
20
|
-
super('${tokenPrefix}_QUERY', {
|
|
21
|
-
ttl: 60,
|
|
22
|
-
cacheKey: \`${lowerName}.query\`,
|
|
23
|
-
bypassCache: false,
|
|
24
|
-
consistentRead: false,
|
|
25
|
-
isUserScoped: true
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`
|
|
30
|
-
await this._fileService.writeFileRecursive(
|
|
31
|
-
path.join(componentDir, `${lowerName}.query.ts`),
|
|
32
|
-
queryContent,
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
const handlerContent = `import type { IHandler, ResultType } from '@xeno-js/vue';
|
|
36
|
-
import { AppError, Result } from '@xeno-js/vue';
|
|
37
|
-
import type { ${pascalName}Query } from './${lowerName}.query';
|
|
38
|
-
import type { ${pascalName}Response } from './${lowerName}.model';
|
|
39
|
-
|
|
40
|
-
/*
|
|
41
|
-
* ⚠️ WARNING: ACTION REQUIRED ⚠️
|
|
42
|
-
*
|
|
43
|
-
* Please register your handler in the IoC container (e.g. src/bootstrap.ts) and add its token to MyRegistry.
|
|
44
|
-
*
|
|
45
|
-
* 1. In src/registry.ts:
|
|
46
|
-
* ${tokenPrefix}_HANDLER: IHandler<${pascalName}Query, ${pascalName}Response>;
|
|
47
|
-
*
|
|
48
|
-
* 2. In src/bootstrap.ts:
|
|
49
|
-
* .addServices((config, register) => {
|
|
50
|
-
* register('${tokenPrefix}_HANDLER', new ${pascalName}Handler());
|
|
51
|
-
* });
|
|
52
|
-
*/
|
|
53
|
-
export class ${pascalName}Handler implements IHandler<${pascalName}Query, ${pascalName}Response> {
|
|
54
|
-
constructor(
|
|
55
|
-
// TODO: Inject your remote DataSources or other services here
|
|
56
|
-
) {}
|
|
57
|
-
|
|
58
|
-
public async handle(query: ${pascalName}Query, signal: AbortSignal): Promise<ResultType<${pascalName}Response>> {
|
|
59
|
-
AppError.throwIfAborted(signal, this.constructor.name);
|
|
60
|
-
|
|
61
|
-
// TODO: Implement your frontend business logic or API calls here
|
|
62
|
-
return Result.ok();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
`
|
|
66
|
-
await this._fileService.writeFileRecursive(
|
|
67
|
-
path.join(componentDir, `${lowerName}.handler.ts`),
|
|
68
|
-
handlerContent,
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
// 2. Composable (Presentation)
|
|
72
|
-
const composableContent = `import { ref } from 'vue';
|
|
73
|
-
import { AppError, Result, type ApiResponseDto, type ResultType } from '@xeno-js/vue';
|
|
74
|
-
import { ServicesUtils } from '@/use-app';
|
|
75
|
-
import { ${pascalName}Query } from './${lowerName}.query';
|
|
76
|
-
import type { ${pascalName}Response } from './${lowerName}.model';
|
|
77
|
-
|
|
78
|
-
export function use${pascalName}() {
|
|
79
|
-
const loading = ref(false);
|
|
80
|
-
const error = ref<string | null>(null);
|
|
81
|
-
const data = ref<${pascalName}Response | null>(null);
|
|
82
|
-
let abortController: AbortController | null = null;
|
|
83
|
-
|
|
84
|
-
/*
|
|
85
|
-
* ⚠️ WARNING: ACTION REQUIRED ⚠️
|
|
86
|
-
*
|
|
87
|
-
* Please register your handler in the IoC container (e.g. src/bootstrap.ts) and add its token to MyRegistry.
|
|
88
|
-
*
|
|
89
|
-
* 1. In src/registry.ts:
|
|
90
|
-
* ${tokenPrefix}_HANDLER: IHandler<${pascalName}Query, ${pascalName}Response>;
|
|
91
|
-
*
|
|
92
|
-
* 2. In src/bootstrap.ts:
|
|
93
|
-
* .addServices((config, register) => {
|
|
94
|
-
* register('${tokenPrefix}_HANDLER', new ${pascalName}Handler());
|
|
95
|
-
* });
|
|
96
|
-
*/
|
|
97
|
-
const fetch = async (): Promise<ResultType<${pascalName}Response>> => {
|
|
98
|
-
abortController = new AbortController();
|
|
99
|
-
|
|
100
|
-
if (loading.value) return Result.fail(AppError.create({
|
|
101
|
-
name: '${pascalName}Query',
|
|
102
|
-
message: '${pascalName}Query is already in progress',
|
|
103
|
-
code: '${tokenPrefix}_QUERY_ALREADY_IN_PROGRESS',
|
|
104
|
-
status: 500,
|
|
105
|
-
cause: new Error('${tokenPrefix}_QUERY_ALREADY_IN_PROGRESS'),
|
|
106
|
-
}));
|
|
107
|
-
loading.value = true;
|
|
108
|
-
error.value = null;
|
|
109
|
-
|
|
110
|
-
try {
|
|
111
|
-
try {
|
|
112
|
-
// Resolve mediator and handler from the container
|
|
113
|
-
const { mediator, ${tokenPrefix}_HANDLER: handler } = ServicesUtils.useApp();
|
|
114
|
-
const query = new ${pascalName}Query();
|
|
115
|
-
|
|
116
|
-
const result = await mediator.query(query, async () => {
|
|
117
|
-
return await handler.handle(query, abortController?.signal);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
if (result.isOk()) {
|
|
121
|
-
data.value = result.getValueOrThrow();
|
|
122
|
-
} else {
|
|
123
|
-
error.value = result.getErrorOrThrow().message;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return result;
|
|
127
|
-
} finally {
|
|
128
|
-
loading.value = false;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const abort = () => {
|
|
133
|
-
if (abortController) {
|
|
134
|
-
abortController.abort();
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// Automatically cancel pending operations when the component unmounts
|
|
139
|
-
onUnmounted(() => {
|
|
140
|
-
abort();
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
return { loading, error, data, fetch };
|
|
144
|
-
}
|
|
145
|
-
`
|
|
146
|
-
await this._fileService.writeFileRecursive(
|
|
147
|
-
path.join(componentDir, `use-${lowerName}.composable.ts`),
|
|
148
|
-
composableContent,
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
// 3. Domain Model (Domain)
|
|
152
|
-
const modelContent = `export interface ${pascalName}Response {
|
|
153
|
-
// TODO: Define your response properties here
|
|
154
|
-
}
|
|
155
|
-
`
|
|
156
|
-
await this._fileService.writeFileRecursive(
|
|
157
|
-
path.join(componentDir, `${lowerName}.model.ts`),
|
|
158
|
-
modelContent,
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// src/infrastructure/generators/env-vue.generator.ts
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
|
|
4
|
-
import { type IFileService, type IGenerator } from '../../../domain'
|
|
5
|
-
import type { VueOptions } from '../../../shared'
|
|
6
|
-
|
|
7
|
-
export class EnvVueGenerator implements IGenerator<VueOptions> {
|
|
8
|
-
constructor(private readonly _fileService: IFileService) {}
|
|
9
|
-
|
|
10
|
-
public async generate(projectPath: string, options: VueOptions): Promise<void> {
|
|
11
|
-
let content = `# ─────────────────────────────────────────────────────────────────────────────
|
|
12
|
-
# Xeno VUE APPLICATION ENVIRONMENT VARIABLES
|
|
13
|
-
# ─────────────────────────────────────────────────────────────────────────────
|
|
14
|
-
VITE_APP_ENV=development
|
|
15
|
-
`
|
|
16
|
-
|
|
17
|
-
if (options.axios) {
|
|
18
|
-
content += `\n# --- Axios ---
|
|
19
|
-
VITE_API_BASE_URL=http://localhost:3000
|
|
20
|
-
`
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (options.supabase) {
|
|
24
|
-
content += `\n# --- Authentication (Supabase) ---
|
|
25
|
-
VITE_SUPABASE_URL=https://your-project.supabase.co
|
|
26
|
-
VITE_SUPABASE_KEY=your-anon-key
|
|
27
|
-
`
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (options.sentry) {
|
|
31
|
-
content += `\n# --- Error Tracking (Sentry) ---
|
|
32
|
-
VITE_SENTRY_DSN=https://your-sentry-dsn@o0.ingest.sentry.io/0
|
|
33
|
-
`
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
await this._fileService.writeFileRecursive(path.join(projectPath, '.env'), content)
|
|
37
|
-
await this._fileService.writeFileRecursive(path.join(projectPath, '.env.example'), content)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
|
|
3
|
-
import { type IFileService, type IGenerator } from '../../../domain'
|
|
4
|
-
import type { VueOptions } from '../../../shared'
|
|
5
|
-
|
|
6
|
-
export class IndexVueGenerator implements IGenerator<VueOptions> {
|
|
7
|
-
constructor(private readonly _fileService: IFileService) {}
|
|
8
|
-
|
|
9
|
-
public async generate(projectPath: string, options: VueOptions): Promise<void> {
|
|
10
|
-
const indexHtml = `<!DOCTYPE html>
|
|
11
|
-
<html lang="en">
|
|
12
|
-
<head>
|
|
13
|
-
<meta charset="UTF-8" />
|
|
14
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
15
|
-
<title>${options.targetDir}</title>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<div id="app"></div>
|
|
19
|
-
<script type="module" src="/src/main.ts"></script>
|
|
20
|
-
</body>
|
|
21
|
-
</html>`
|
|
22
|
-
await this._fileService.writeFileRecursive(path.join(projectPath, 'index.html'), indexHtml)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './app-vue.generator'
|
|
2
|
-
export * from './bootstrap-ts.generator'
|
|
3
|
-
export * from './env.generator'
|
|
4
|
-
export * from './index-html.generator'
|
|
5
|
-
export * from './main.generator'
|
|
6
|
-
export * from './packagejson.generator'
|
|
7
|
-
export * from './readme.generator'
|
|
8
|
-
export * from './registry-ts.generator'
|
|
9
|
-
export * from './router.generator'
|
|
10
|
-
export * from './tailwind.generator'
|
|
11
|
-
export * from './tsconfig.generator'
|
|
12
|
-
export * from './vite-config.generator'
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
|
|
3
|
-
import { type IFileService, type IGenerator } from '../../../domain'
|
|
4
|
-
import type { VueOptions } from '../../../shared'
|
|
5
|
-
|
|
6
|
-
export class MainGenerator implements IGenerator<VueOptions> {
|
|
7
|
-
constructor(private readonly _fileService: IFileService) {}
|
|
8
|
-
|
|
9
|
-
public async generate(projectPath: string, options: VueOptions): Promise<void> {
|
|
10
|
-
// 5. src/main.ts
|
|
11
|
-
const routerImport = options.router ? `\nimport router from './router';` : ''
|
|
12
|
-
const piniaImport = options.pinia ? `\nimport { createPinia } from 'pinia';` : ''
|
|
13
|
-
const tailwindImport = options.tailwind ? `\nimport './assets/style.css';` : ''
|
|
14
|
-
|
|
15
|
-
const mainTs = `import { createApp } from 'vue';
|
|
16
|
-
import App from './App.vue';
|
|
17
|
-
import { bootstrap } from './bootstrap';
|
|
18
|
-
import { XENO_SERVICES_KEY } from '@xeno-js/vue';${routerImport}${piniaImport}${tailwindImport}
|
|
19
|
-
|
|
20
|
-
async function mountApp() {
|
|
21
|
-
try {
|
|
22
|
-
const app = createApp(App);
|
|
23
|
-
${options.pinia ? '\n app.use(createPinia());' : ''}
|
|
24
|
-
const container = await bootstrap(app, router);
|
|
25
|
-
${options.router ? '\n app.use(router);' : ''}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Provide the Xeno IoC container globally to all components
|
|
29
|
-
app.provide(XENO_SERVICES_KEY, container);
|
|
30
|
-
|
|
31
|
-
app.mount('#app');
|
|
32
|
-
} catch (error) {
|
|
33
|
-
console.error('Critical error during frontend bootstrap:', error);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
mountApp();
|
|
38
|
-
`
|
|
39
|
-
await this._fileService.writeFileRecursive(path.join(projectPath, 'src', 'main.ts'), mainTs)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
|
|
3
|
-
import { type IFileService, type IGenerator } from '../../../domain'
|
|
4
|
-
import type { VueOptions } from '../../../shared'
|
|
5
|
-
|
|
6
|
-
export class PackageJsonVueGenerator implements IGenerator<VueOptions> {
|
|
7
|
-
constructor(private readonly _fileService: IFileService) {}
|
|
8
|
-
|
|
9
|
-
public async generate(projectPath: string, options: VueOptions): Promise<void> {
|
|
10
|
-
const packageJson = {
|
|
11
|
-
name: options.targetDir,
|
|
12
|
-
version: '1.0.0',
|
|
13
|
-
private: true,
|
|
14
|
-
type: 'module',
|
|
15
|
-
scripts: {
|
|
16
|
-
dev: 'vite',
|
|
17
|
-
build: 'vue-tsc -b && vite build',
|
|
18
|
-
preview: 'vite preview',
|
|
19
|
-
g: 'xeno-js generate',
|
|
20
|
-
} as Record<string, string>,
|
|
21
|
-
dependencies: {
|
|
22
|
-
'@xeno-js/vue': 'latest',
|
|
23
|
-
'vue': '^3.5.0',
|
|
24
|
-
} as Record<string, string>,
|
|
25
|
-
devDependencies: {
|
|
26
|
-
'@types/node': '^20.0.0',
|
|
27
|
-
'@vitejs/plugin-vue': '^5.1.0',
|
|
28
|
-
'typescript': '^5.5.0',
|
|
29
|
-
'vite': '^5.4.0',
|
|
30
|
-
'vue-tsc': '^2.1.0',
|
|
31
|
-
} as Record<string, string>,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (options.axios) packageJson.dependencies['axios'] = '^1.7.0'
|
|
35
|
-
if (options.cockatiel) packageJson.dependencies['cockatiel'] = '^4.0.0'
|
|
36
|
-
if (options.supabase) packageJson.dependencies['@supabase/supabase-js'] = '^2.45.0'
|
|
37
|
-
if (options.sentry) packageJson.dependencies['@sentry/vue'] = '^8.28.0'
|
|
38
|
-
if (options.pinia) packageJson.dependencies['pinia'] = '^2.2.0'
|
|
39
|
-
if (options.router) packageJson.dependencies['vue-router'] = '^4.4.0'
|
|
40
|
-
if (options.zod) packageJson.dependencies['zod'] = '^4.4.3'
|
|
41
|
-
|
|
42
|
-
if (options.tailwind) {
|
|
43
|
-
packageJson.devDependencies['tailwindcss'] = '^4.0.0'
|
|
44
|
-
packageJson.devDependencies['@tailwindcss/vite'] = '^4.0.0'
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const filePath = path.join(projectPath, 'package.json')
|
|
48
|
-
await this._fileService.writeFileRecursive(filePath, JSON.stringify(packageJson, null, 2))
|
|
49
|
-
}
|
|
50
|
-
}
|