@azure-net/cli 5.1.1 → 6.0.0-next.3
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 +201 -0
- package/bin/azure-net.js +236 -221
- package/dist/bin/azure-net.d.ts +2 -0
- package/dist/src/checks/architecture.d.ts +20 -0
- package/dist/src/checks/checkDomain.d.ts +1 -0
- package/dist/src/checks/checkFoldersStructure.d.ts +1 -0
- package/dist/src/checks/checkHooks.d.ts +1 -0
- package/dist/src/checks/checkImports.d.ts +1 -0
- package/dist/src/checks/checkInternal.d.ts +1 -0
- package/dist/src/checks/checkLayerBoundaries.d.ts +1 -0
- package/dist/src/checks/checkLayerImports.d.ts +1 -0
- package/dist/src/checks/checkPresenterNames.d.ts +1 -0
- package/dist/src/checks/checkProject.d.ts +1 -0
- package/dist/src/checks/checkProviderGraph.d.ts +1 -0
- package/dist/src/checks/checkProviderNames.d.ts +1 -0
- package/dist/src/generate/layers/generateRepository.d.ts +1 -0
- package/dist/src/generate/layers/generateRepositoryMethod.d.ts +1 -0
- package/dist/src/generate/layers/generateUseCases.d.ts +1 -0
- package/dist/src/generate/module/generateDomain.d.ts +8 -0
- package/dist/src/generate/module/generateModule.d.ts +1 -0
- package/dist/src/generate/module/generateModulePreset.d.ts +1 -0
- package/dist/src/generate/module/generatePresenter.d.ts +29 -0
- package/dist/src/generate/module/generateRepository.d.ts +15 -0
- package/dist/src/generate/module/generateRepositoryMethod.d.ts +2 -0
- package/dist/src/generate/module/generateSchemaFromType.d.ts +9 -0
- package/dist/src/generate/module/generateStore.d.ts +1 -0
- package/dist/src/generate/module/generateTypesJson.d.ts +2 -0
- package/dist/src/generate/module/generateUseCases.d.ts +1 -0
- package/dist/src/generate/module/repositoryModuleShared.d.ts +89 -0
- package/dist/src/generate/routes/generateRoutes.d.ts +14 -0
- package/dist/src/generate/ui/generateComponent.d.ts +1 -0
- package/dist/src/generate/ui/generateDesignComponent.d.ts +1 -0
- package/dist/src/generate/ui/generateWidget.d.ts +1 -0
- package/dist/src/git/commit.d.ts +23 -0
- package/dist/src/git/push.d.ts +11 -0
- package/dist/src/git/runGit.d.ts +2 -0
- package/dist/src/init/initAliases.d.ts +12 -0
- package/dist/src/init/initEdges.d.ts +2 -0
- package/dist/src/init/initStructure.d.ts +1 -0
- package/dist/src/install/configureCommitTools.d.ts +1 -0
- package/dist/src/install/installFresh.d.ts +1 -0
- package/dist/src/migrate/migrate.d.ts +22 -0
- package/dist/src/migrate/presenterFactories.d.ts +9 -0
- package/dist/src/migrate/presenters.d.ts +13 -0
- package/dist/src/migrate/translations.d.ts +8 -0
- package/dist/src/plugins/addLint.d.ts +5 -0
- package/dist/src/scaffolds/createCoreSchema.d.ts +1 -0
- package/dist/src/scaffolds/createDatasource.d.ts +1 -0
- package/dist/src/scaffolds/createProgram.d.ts +1 -0
- package/dist/src/scaffolds/createResponse.d.ts +1 -0
- package/dist/src/scaffolds/createSchemaRule.d.ts +1 -0
- package/dist/src/scaffolds/createTranslationManager.d.ts +1 -0
- package/{src/scaffolds/index.ts → dist/src/scaffolds/index.d.ts} +0 -2
- package/dist/src/scaffolds/registerDatasource.d.ts +2 -0
- package/dist/src/scaffolds/updateDefaultFactoryConfig.d.ts +1 -0
- package/dist/src/utils/architecture.d.ts +31 -0
- package/dist/src/utils/contextUtils.d.ts +6 -0
- package/dist/src/utils/fileUtils.d.ts +5 -0
- package/dist/src/utils/flattenConfig.d.ts +2 -0
- package/dist/src/utils/legacyAliases.d.ts +1 -0
- package/dist/src/utils/loadConfig.d.ts +16 -0
- package/dist/src/utils/packageImports.d.ts +4 -0
- package/dist/src/utils/sharedFoundation.d.ts +20 -0
- package/dist/src/utils/viteConfig.d.ts +9 -0
- package/package.json +17 -7
- package/src/checks/architecture.js +154 -0
- package/src/checks/checkDomain.js +124 -154
- package/src/checks/checkFoldersStructure.js +64 -52
- package/src/checks/checkHooks.js +12 -12
- package/src/checks/checkImports.js +26 -142
- package/src/checks/checkInternal.js +27 -24
- package/src/checks/checkLayerBoundaries.js +22 -197
- package/src/checks/checkLayerImports.js +14 -134
- package/src/checks/checkPresenterNames.js +156 -143
- package/src/checks/checkProject.js +27 -26
- package/src/checks/checkProviderGraph.js +182 -166
- package/src/checks/checkProviderNames.js +123 -112
- package/src/generate/layers/generateRepository.js +1 -109
- package/src/generate/layers/generateRepositoryMethod.js +1 -90
- package/src/generate/layers/generateUseCases.js +1 -44
- package/src/generate/module/generateDomain.js +81 -105
- package/src/generate/module/generateModule.js +34 -68
- package/src/generate/module/generateModulePreset.js +188 -248
- package/src/generate/module/generatePresenter.js +441 -369
- package/src/generate/module/generateRepository.js +102 -121
- package/src/generate/module/generateRepositoryMethod.js +117 -0
- package/src/generate/module/generateSchemaFromType.js +283 -280
- package/src/generate/module/generateStore.js +41 -0
- package/src/generate/module/generateTypesJson.js +196 -195
- package/src/generate/module/generateUseCases.js +47 -55
- package/src/generate/module/repositoryModuleShared.js +480 -459
- package/src/generate/routes/generateRoutes.js +4 -7
- package/src/generate/ui/generateComponent.js +44 -64
- package/src/generate/ui/generateDesignComponent.js +21 -41
- package/src/generate/ui/generateWidget.js +21 -41
- package/src/git/commit.js +67 -0
- package/src/git/push.js +19 -0
- package/src/git/runGit.js +11 -0
- package/src/init/initAliases.js +19 -135
- package/src/init/initEdges.js +79 -54
- package/src/init/initStructure.js +31 -145
- package/src/install/configureCommitTools.js +1 -0
- package/src/install/installFresh.js +39 -68
- package/src/migrate/migrate.js +1027 -0
- package/src/migrate/presenterFactories.js +189 -0
- package/src/migrate/presenters.js +373 -0
- package/src/migrate/translations.js +213 -0
- package/src/plugins/addLint.js +52 -219
- package/src/scaffolds/createCoreSchema.js +65 -91
- package/src/scaffolds/createDatasource.js +67 -101
- package/src/scaffolds/createProgram.js +8 -8
- package/src/scaffolds/createResponse.js +29 -29
- package/src/scaffolds/createSchemaRule.js +19 -19
- package/src/scaffolds/createTranslationManager.js +84 -37
- package/src/scaffolds/index.js +0 -2
- package/src/scaffolds/registerDatasource.js +59 -0
- package/src/scaffolds/updateDefaultFactoryConfig.js +31 -0
- package/src/utils/architecture.js +145 -0
- package/src/utils/contextUtils.js +32 -65
- package/src/utils/fileUtils.js +69 -50
- package/src/utils/flattenConfig.js +38 -0
- package/src/utils/legacyAliases.js +75 -0
- package/src/utils/loadConfig.js +76 -40
- package/src/utils/packageImports.js +63 -0
- package/src/utils/sharedFoundation.js +36 -42
- package/src/utils/viteConfig.js +295 -0
- package/.prettierrc +0 -7
- package/bin/azure-net.ts +0 -308
- package/eslint.config.js +0 -34
- package/src/checks/checkDomain.ts +0 -223
- package/src/checks/checkFoldersStructure.ts +0 -85
- package/src/checks/checkHooks.ts +0 -22
- package/src/checks/checkImports.ts +0 -193
- package/src/checks/checkInternal.ts +0 -48
- package/src/checks/checkLayerBoundaries.ts +0 -255
- package/src/checks/checkLayerImports.ts +0 -185
- package/src/checks/checkPresenterNames.ts +0 -203
- package/src/checks/checkProject.ts +0 -45
- package/src/checks/checkProviderGraph.ts +0 -234
- package/src/checks/checkProviderNames.ts +0 -165
- package/src/generate/layers/generateRepository.ts +0 -123
- package/src/generate/layers/generateRepositoryMethod.ts +0 -102
- package/src/generate/layers/generateUseCases.ts +0 -50
- package/src/generate/layers/repositoryShared.js +0 -506
- package/src/generate/layers/repositoryShared.ts +0 -662
- package/src/generate/module/generateDomain.ts +0 -147
- package/src/generate/module/generateModule.ts +0 -84
- package/src/generate/module/generateModulePreset.ts +0 -338
- package/src/generate/module/generatePresenter.ts +0 -498
- package/src/generate/module/generateRepository.ts +0 -158
- package/src/generate/module/generateSchemaFromType.ts +0 -368
- package/src/generate/module/generateTypesJson.ts +0 -259
- package/src/generate/module/generateUseCases.ts +0 -67
- package/src/generate/module/repositoryModuleShared.ts +0 -669
- package/src/generate/routes/generateRoutes.ts +0 -275
- package/src/generate/ui/generateComponent.ts +0 -100
- package/src/generate/ui/generateDesignComponent.ts +0 -71
- package/src/generate/ui/generateWidget.ts +0 -71
- package/src/init/initAliases.ts +0 -172
- package/src/init/initEdges.ts +0 -74
- package/src/init/initStructure.ts +0 -172
- package/src/install/installFresh.ts +0 -93
- package/src/plugins/addLint.ts +0 -274
- package/src/scaffolds/createCoreSchema.ts +0 -130
- package/src/scaffolds/createDatasource.ts +0 -161
- package/src/scaffolds/createDatasourceProvider.js +0 -127
- package/src/scaffolds/createDatasourceProvider.ts +0 -161
- package/src/scaffolds/createPresenterFactory.js +0 -83
- package/src/scaffolds/createPresenterFactory.ts +0 -102
- package/src/scaffolds/createProgram.ts +0 -19
- package/src/scaffolds/createResponse.ts +0 -66
- package/src/scaffolds/createSchemaRule.ts +0 -44
- package/src/scaffolds/createTranslationManager.ts +0 -80
- package/src/utils/contextUtils.ts +0 -88
- package/src/utils/fileUtils.ts +0 -74
- package/src/utils/loadConfig.ts +0 -68
- package/src/utils/sharedFoundation.ts +0 -70
- package/tsconfig.json +0 -19
- /package/{src/checks/index.ts → dist/src/checks/index.d.ts} +0 -0
- /package/{src/plugins/index.ts → dist/src/plugins/index.d.ts} +0 -0
package/bin/azure-net.ts
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { addLint } from '../src/plugins/index.js';
|
|
5
|
-
|
|
6
|
-
const program = new Command();
|
|
7
|
-
|
|
8
|
-
program.name('azure-net').description('Azure-Net CLI generator').version('4.1.0');
|
|
9
|
-
|
|
10
|
-
const addCommand = program.command('add').description('Add project integrations and plugins');
|
|
11
|
-
const createCommand = program.command('create').description('Create project boilerplate artifacts');
|
|
12
|
-
const initCommand = program.command('init').description('Initialize project scaffolding');
|
|
13
|
-
const installCommand = program.command('install').description('Install project presets and flows');
|
|
14
|
-
const generateCommand = program.command('generate').description('Generate UI artifacts');
|
|
15
|
-
const checkCommand = program.command('check').description('Run project checks');
|
|
16
|
-
|
|
17
|
-
addCommand
|
|
18
|
-
.command('commit-tools')
|
|
19
|
-
.description('Setup linting and commit tools')
|
|
20
|
-
.option('-m, --manager <manager>', 'Package manager: bun | pnpm | npm | yarn')
|
|
21
|
-
.action(addLint);
|
|
22
|
-
|
|
23
|
-
createCommand
|
|
24
|
-
.command('schema-factory')
|
|
25
|
-
.description('Create base schema in shared essentials foundation constructs')
|
|
26
|
-
.action(async () => {
|
|
27
|
-
const handler = (await import('../src/scaffolds/createCoreSchema.js')).default;
|
|
28
|
-
await handler();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
createCommand
|
|
32
|
-
.command('translation-manager')
|
|
33
|
-
.description('Create translation manager in shared essentials localization')
|
|
34
|
-
.action(async () => {
|
|
35
|
-
const handler = (await import('../src/scaffolds/createTranslationManager.js')).default;
|
|
36
|
-
await handler();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
createCommand
|
|
40
|
-
.command('presenter-factory')
|
|
41
|
-
.description('Create presenter factory in shared essentials foundation constructs')
|
|
42
|
-
.action(async () => {
|
|
43
|
-
const handler = (await import('../src/scaffolds/createPresenterFactory.js')).default;
|
|
44
|
-
await handler();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
createCommand
|
|
48
|
-
.command('schema-rule')
|
|
49
|
-
.description('Create schema rule in shared essentials foundation constructs')
|
|
50
|
-
.action(async () => {
|
|
51
|
-
const handler = (await import('../src/scaffolds/createSchemaRule.js')).default;
|
|
52
|
-
await handler();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
createCommand
|
|
56
|
-
.command('response')
|
|
57
|
-
.description('Create response in shared essentials foundation constructs')
|
|
58
|
-
.action(async () => {
|
|
59
|
-
const handler = (await import('../src/scaffolds/createResponse.js')).default;
|
|
60
|
-
await handler();
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
createCommand
|
|
64
|
-
.command('datasource')
|
|
65
|
-
.description('Create datasource in core or context infrastructure')
|
|
66
|
-
.action(async () => {
|
|
67
|
-
const handler = (await import('../src/scaffolds/createDatasource.js')).default;
|
|
68
|
-
await handler();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
createCommand
|
|
72
|
-
.command('datasource-provider')
|
|
73
|
-
.description('Create datasource provider in core or context infrastructure')
|
|
74
|
-
.action(async () => {
|
|
75
|
-
const handler = (await import('../src/scaffolds/createDatasourceProvider.js')).default;
|
|
76
|
-
await handler();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
initCommand
|
|
80
|
-
.command('edges')
|
|
81
|
-
.description('Initialize edges plugin in vite config')
|
|
82
|
-
.action(async () => {
|
|
83
|
-
const handler = (await import('../src/init/initEdges.js')).default;
|
|
84
|
-
await handler();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
initCommand
|
|
88
|
-
.command('folders-structure')
|
|
89
|
-
.description('Generate base folders structure')
|
|
90
|
-
.action(async () => {
|
|
91
|
-
const handler = (await import('../src/init/initStructure.js')).default;
|
|
92
|
-
await handler();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
initCommand.action(async () => {
|
|
96
|
-
const initStructure = (await import('../src/init/initStructure.js')).default;
|
|
97
|
-
await initStructure();
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
installCommand
|
|
101
|
-
.command('fresh')
|
|
102
|
-
.description('Run full fresh install flow (structure + optional generators)')
|
|
103
|
-
.action(async () => {
|
|
104
|
-
const handler = (await import('../src/install/installFresh.js')).default;
|
|
105
|
-
await handler();
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
generateCommand
|
|
109
|
-
.command('component')
|
|
110
|
-
.description('Generate UI component')
|
|
111
|
-
.action(async () => {
|
|
112
|
-
const handler = (await import('../src/generate/ui/generateComponent.js')).default;
|
|
113
|
-
await handler();
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
generateCommand
|
|
117
|
-
.command('widget')
|
|
118
|
-
.description('Generate UI widget')
|
|
119
|
-
.action(async () => {
|
|
120
|
-
const handler = (await import('../src/generate/ui/generateWidget.js')).default;
|
|
121
|
-
await handler();
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
generateCommand
|
|
125
|
-
.command('design-component')
|
|
126
|
-
.description('Generate UI design component')
|
|
127
|
-
.action(async () => {
|
|
128
|
-
const handler = (await import('../src/generate/ui/generateDesignComponent.js')).default;
|
|
129
|
-
await handler();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
generateCommand
|
|
133
|
-
.command('repository')
|
|
134
|
-
.description('Generate infrastructure repository')
|
|
135
|
-
.action(async () => {
|
|
136
|
-
const handler = (await import('../src/generate/layers/generateRepository.js')).default;
|
|
137
|
-
await handler();
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
generateCommand
|
|
141
|
-
.command('repo')
|
|
142
|
-
.description('Generate infrastructure repository (module flow)')
|
|
143
|
-
.action(async () => {
|
|
144
|
-
const handler = (await import('../src/generate/module/generateRepository.js')).default;
|
|
145
|
-
await handler();
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
generateCommand
|
|
149
|
-
.command('repository-method')
|
|
150
|
-
.description('Generate method for an existing repository')
|
|
151
|
-
.action(async () => {
|
|
152
|
-
const handler = (await import('../src/generate/layers/generateRepositoryMethod.js')).default;
|
|
153
|
-
await handler();
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
generateCommand
|
|
157
|
-
.command('use-cases')
|
|
158
|
-
.description('Generate use-cases for an existing repository')
|
|
159
|
-
.action(async () => {
|
|
160
|
-
const handler = (await import('../src/generate/module/generateUseCases.js')).default;
|
|
161
|
-
await handler();
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
generateCommand
|
|
165
|
-
.command('domain')
|
|
166
|
-
.description('Generate domain module (model/ports)')
|
|
167
|
-
.action(async () => {
|
|
168
|
-
const handler = (await import('../src/generate/module/generateDomain.js')).default;
|
|
169
|
-
await handler();
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
generateCommand
|
|
173
|
-
.command('presenter')
|
|
174
|
-
.description('Generate presentation layer presenter from UseCases')
|
|
175
|
-
.action(async () => {
|
|
176
|
-
const handler = (await import('../src/generate/module/generatePresenter.js')).default;
|
|
177
|
-
await handler();
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
generateCommand
|
|
181
|
-
.command('types-json')
|
|
182
|
-
.description('Fill model interface keys from JSON')
|
|
183
|
-
.action(async () => {
|
|
184
|
-
const handler = (await import('../src/generate/module/generateTypesJson.js')).default;
|
|
185
|
-
await handler();
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
generateCommand
|
|
189
|
-
.command('schema-from-type')
|
|
190
|
-
.description('Fill schema rules keys from schema generic type')
|
|
191
|
-
.action(async () => {
|
|
192
|
-
const handler = (await import('../src/generate/module/generateSchemaFromType.js')).default;
|
|
193
|
-
await handler();
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
generateCommand
|
|
197
|
-
.command('module')
|
|
198
|
-
.description('Generate domain + repository + presenter flow')
|
|
199
|
-
.action(async () => {
|
|
200
|
-
const handler = (await import('../src/generate/module/generateModule.js')).default;
|
|
201
|
-
await handler();
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
generateCommand
|
|
205
|
-
.command('module-preset')
|
|
206
|
-
.description('Generate preset CRUD-like module flow')
|
|
207
|
-
.action(async () => {
|
|
208
|
-
const handler = (await import('../src/generate/module/generateModulePreset.js')).default;
|
|
209
|
-
await handler();
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
generateCommand
|
|
213
|
-
.command('routes')
|
|
214
|
-
.description('Generate typed SvelteKit routes list')
|
|
215
|
-
.action(async () => {
|
|
216
|
-
const handler = (await import('../src/generate/routes/generateRoutes.js')).default;
|
|
217
|
-
await handler();
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
checkCommand
|
|
221
|
-
.command('presenter-names')
|
|
222
|
-
.description('Check duplicate presenter names in src')
|
|
223
|
-
.action(async () => {
|
|
224
|
-
const handler = (await import('../src/checks/checkPresenterNames.js')).default;
|
|
225
|
-
await handler();
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
checkCommand
|
|
229
|
-
.command('provider-names')
|
|
230
|
-
.description('Check duplicate provider names in src')
|
|
231
|
-
.action(async () => {
|
|
232
|
-
const handler = (await import('../src/checks/checkProviderNames.js')).default;
|
|
233
|
-
await handler();
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
checkCommand
|
|
237
|
-
.command('provider-graph')
|
|
238
|
-
.description('Check provider dependency graph for cycles')
|
|
239
|
-
.action(async () => {
|
|
240
|
-
const handler = (await import('../src/checks/checkProviderGraph.js')).default;
|
|
241
|
-
await handler();
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
checkCommand
|
|
245
|
-
.command('domain')
|
|
246
|
-
.description('Check domain naming and structure rules in all contexts')
|
|
247
|
-
.action(async () => {
|
|
248
|
-
const handler = (await import('../src/checks/checkDomain.js')).default;
|
|
249
|
-
await handler();
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
checkCommand
|
|
253
|
-
.command('imports')
|
|
254
|
-
.description('Check import extensions and import group order in src')
|
|
255
|
-
.action(async () => {
|
|
256
|
-
const handler = (await import('../src/checks/checkImports.js')).default;
|
|
257
|
-
await handler();
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
checkCommand
|
|
261
|
-
.command('hooks')
|
|
262
|
-
.description('Check that manual SvelteKit hooks are not present')
|
|
263
|
-
.action(async () => {
|
|
264
|
-
const handler = (await import('../src/checks/checkHooks.js')).default;
|
|
265
|
-
await handler();
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
checkCommand
|
|
269
|
-
.command('layer-imports')
|
|
270
|
-
.description('Check forbidden imports between layers inside each context')
|
|
271
|
-
.action(async () => {
|
|
272
|
-
const handler = (await import('../src/checks/checkLayerImports.js')).default;
|
|
273
|
-
await handler();
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
checkCommand
|
|
277
|
-
.command('layer-boundaries')
|
|
278
|
-
.description('Check layer boundaries between contexts by aliases')
|
|
279
|
-
.action(async () => {
|
|
280
|
-
const handler = (await import('../src/checks/checkLayerBoundaries.js')).default;
|
|
281
|
-
await handler();
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
checkCommand
|
|
285
|
-
.command('folders-structure')
|
|
286
|
-
.description('Check allowed folders structure in context layers/ui/components')
|
|
287
|
-
.action(async () => {
|
|
288
|
-
const handler = (await import('../src/checks/checkFoldersStructure.js')).default;
|
|
289
|
-
await handler();
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
checkCommand
|
|
293
|
-
.command('internal')
|
|
294
|
-
.description('Run all internal azure-net checks')
|
|
295
|
-
.action(async () => {
|
|
296
|
-
const handler = (await import('../src/checks/checkInternal.js')).default;
|
|
297
|
-
await handler();
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
checkCommand
|
|
301
|
-
.command('project')
|
|
302
|
-
.description('Run full project checks: format, internal, lint, typecheck')
|
|
303
|
-
.action(async () => {
|
|
304
|
-
const handler = (await import('../src/checks/checkProject.js')).default;
|
|
305
|
-
await handler();
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
program.parse();
|
package/eslint.config.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import tseslint from 'typescript-eslint';
|
|
3
|
-
|
|
4
|
-
export default tseslint.config(
|
|
5
|
-
{
|
|
6
|
-
ignores: ['dist/**', 'node_modules/**']
|
|
7
|
-
},
|
|
8
|
-
js.configs.recommended,
|
|
9
|
-
...tseslint.configs.recommended,
|
|
10
|
-
{
|
|
11
|
-
files: ['bin/**/*.ts', 'src/plugins/**/*.ts'],
|
|
12
|
-
languageOptions: {
|
|
13
|
-
globals: {
|
|
14
|
-
console: 'readonly',
|
|
15
|
-
process: 'readonly'
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
files: [
|
|
21
|
-
'src/generate/module/repositoryModuleShared.ts',
|
|
22
|
-
'src/generate/layers/repositoryShared.ts',
|
|
23
|
-
'src/generate/layers/generateUseCases.ts',
|
|
24
|
-
'src/generate/layers/generateRepositoryMethod.ts',
|
|
25
|
-
'src/generate/layers/generateRepository.ts',
|
|
26
|
-
'src/utils/contextUtils.ts',
|
|
27
|
-
'src/utils/loadConfig.ts',
|
|
28
|
-
'src/utils/fileUtils.ts'
|
|
29
|
-
],
|
|
30
|
-
rules: {
|
|
31
|
-
'@typescript-eslint/ban-ts-comment': 'off'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
);
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { loadUserConfig } from '../utils/loadConfig.js';
|
|
4
|
-
import { normalizeContexts } from '../init/initAliases.js';
|
|
5
|
-
|
|
6
|
-
type DomainIssue = {
|
|
7
|
-
file: string;
|
|
8
|
-
line: number;
|
|
9
|
-
message: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type Declaration = {
|
|
13
|
-
kind: 'interface' | 'type';
|
|
14
|
-
name: string;
|
|
15
|
-
line: number;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const DOMAIN_FILE_EXTENSIONS = new Set(['.ts']);
|
|
19
|
-
const IGNORED_DIRS = new Set(['node_modules', 'dist', '.svelte-kit', '.git']);
|
|
20
|
-
|
|
21
|
-
const INTERFACE_DECLARATION_PATTERN = /(?:^|\n)\s*(?:export\s+)?interface\s+([A-Za-z_$][A-Za-z0-9_$]*)\b/g;
|
|
22
|
-
const TYPE_DECLARATION_PATTERN = /(?:^|\n)\s*(?:export\s+)?type\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*=/g;
|
|
23
|
-
|
|
24
|
-
const EXPORT_STAR_PATTERN = /export\s+\*\s+from\s*['"][^'"]+['"]\s*;?/g;
|
|
25
|
-
const EXPORT_FROM_PATTERN = /export\s+(?:type\s+)?\{[\s\S]*?\}\s+from\s*['"][^'"]+['"]\s*;?/g;
|
|
26
|
-
const EXPORT_LOCAL_PATTERN = /export\s+(?:type\s+)?\{[\s\S]*?\}\s*;?/g;
|
|
27
|
-
|
|
28
|
-
const toPosixPath = (value: string): string => value.split(path.sep).join('/');
|
|
29
|
-
|
|
30
|
-
const stripComments = (content: string): string => content.replace(/\/\*[\s\S]*?\*\//g, '').replace(/(^|[^\\])\/\/.*$/gm, '$1');
|
|
31
|
-
|
|
32
|
-
const stripExportStatements = (content: string): string =>
|
|
33
|
-
content.replace(EXPORT_STAR_PATTERN, '').replace(EXPORT_FROM_PATTERN, '').replace(EXPORT_LOCAL_PATTERN, '');
|
|
34
|
-
|
|
35
|
-
const findLineByIndex = (content: string, index: number): number => {
|
|
36
|
-
let line = 1;
|
|
37
|
-
for (let i = 0; i < index; i += 1) {
|
|
38
|
-
if (content[i] === '\n') line += 1;
|
|
39
|
-
}
|
|
40
|
-
return line;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const getRelativeFilePath = (filePath: string): string => toPosixPath(path.relative(process.cwd(), filePath));
|
|
44
|
-
|
|
45
|
-
const isEnumsPath = (filePath: string): boolean => {
|
|
46
|
-
const normalized = toPosixPath(filePath);
|
|
47
|
-
return normalized.includes('/enums/');
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const isIndexFile = (filePath: string): boolean => path.basename(filePath) === 'index.ts';
|
|
51
|
-
|
|
52
|
-
const startsWithInterfacePrefix = (filePath: string): boolean => /^I[A-Z]/.test(path.basename(filePath, '.ts'));
|
|
53
|
-
|
|
54
|
-
const isExportOnlyIndex = (content: string): boolean => {
|
|
55
|
-
const withoutComments = stripComments(content);
|
|
56
|
-
const withoutExports = stripExportStatements(withoutComments);
|
|
57
|
-
return withoutExports.trim().length === 0;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const validateName = (declaration: Declaration): string | null => {
|
|
61
|
-
if (declaration.kind === 'interface') {
|
|
62
|
-
return /^I[A-Z]/.test(declaration.name) ? null : `Interface "${declaration.name}" must start with "I" and have uppercase second letter`;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return /^[IT][A-Z]/.test(declaration.name)
|
|
66
|
-
? null
|
|
67
|
-
: `Type "${declaration.name}" must start with "I" or "T" and have uppercase second letter`;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const extractDeclarations = (content: string): Declaration[] => {
|
|
71
|
-
const cleaned = stripComments(content);
|
|
72
|
-
const declarations: Declaration[] = [];
|
|
73
|
-
|
|
74
|
-
const interfaceRegex = new RegExp(INTERFACE_DECLARATION_PATTERN.source, 'g');
|
|
75
|
-
let interfaceMatch: RegExpExecArray | null;
|
|
76
|
-
while ((interfaceMatch = interfaceRegex.exec(cleaned)) !== null) {
|
|
77
|
-
const name = interfaceMatch[1];
|
|
78
|
-
if (!name) continue;
|
|
79
|
-
declarations.push({
|
|
80
|
-
kind: 'interface',
|
|
81
|
-
name,
|
|
82
|
-
line: findLineByIndex(cleaned, interfaceMatch.index)
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const typeRegex = new RegExp(TYPE_DECLARATION_PATTERN.source, 'g');
|
|
87
|
-
let typeMatch: RegExpExecArray | null;
|
|
88
|
-
while ((typeMatch = typeRegex.exec(cleaned)) !== null) {
|
|
89
|
-
const name = typeMatch[1];
|
|
90
|
-
if (!name) continue;
|
|
91
|
-
declarations.push({
|
|
92
|
-
kind: 'type',
|
|
93
|
-
name,
|
|
94
|
-
line: findLineByIndex(cleaned, typeMatch.index)
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return declarations.sort((a, b) => a.line - b.line);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const listDomainFiles = async (domainRoot: string): Promise<string[]> => {
|
|
102
|
-
const files: string[] = [];
|
|
103
|
-
const stack: string[] = [domainRoot];
|
|
104
|
-
|
|
105
|
-
while (stack.length) {
|
|
106
|
-
const current = stack.pop();
|
|
107
|
-
if (!current) continue;
|
|
108
|
-
|
|
109
|
-
let entries: import('node:fs').Dirent[] = [];
|
|
110
|
-
try {
|
|
111
|
-
entries = await fs.readdir(current, { withFileTypes: true });
|
|
112
|
-
} catch {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
for (const entry of entries) {
|
|
117
|
-
if (entry.isDirectory()) {
|
|
118
|
-
if (!IGNORED_DIRS.has(entry.name)) {
|
|
119
|
-
stack.push(path.join(current, entry.name));
|
|
120
|
-
}
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (!entry.isFile()) continue;
|
|
125
|
-
const filePath = path.join(current, entry.name);
|
|
126
|
-
if (!DOMAIN_FILE_EXTENSIONS.has(path.extname(filePath))) continue;
|
|
127
|
-
files.push(filePath);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return files;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const collectIssuesForFile = (filePath: string, content: string): DomainIssue[] => {
|
|
135
|
-
const issues: DomainIssue[] = [];
|
|
136
|
-
|
|
137
|
-
if (isIndexFile(filePath) && !isExportOnlyIndex(content)) {
|
|
138
|
-
issues.push({
|
|
139
|
-
file: filePath,
|
|
140
|
-
line: 1,
|
|
141
|
-
message: 'index.ts must contain only exports. Move declarations to separate files'
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (isEnumsPath(filePath)) {
|
|
146
|
-
return issues;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (!isIndexFile(filePath) && startsWithInterfacePrefix(filePath)) {
|
|
150
|
-
issues.push({
|
|
151
|
-
file: filePath,
|
|
152
|
-
line: 1,
|
|
153
|
-
message: 'Domain file names must not start with "I". Keep "I" only in interface/type names'
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const declarations = extractDeclarations(content);
|
|
158
|
-
if (declarations.length > 5) {
|
|
159
|
-
issues.push({
|
|
160
|
-
file: filePath,
|
|
161
|
-
line: declarations[5]?.line ?? 1,
|
|
162
|
-
message: `Too many declarations in one file (${declarations.length}). Maximum is 5`
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
for (const declaration of declarations) {
|
|
167
|
-
const validationError = validateName(declaration);
|
|
168
|
-
if (!validationError) continue;
|
|
169
|
-
issues.push({
|
|
170
|
-
file: filePath,
|
|
171
|
-
line: declaration.line,
|
|
172
|
-
message: validationError
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return issues;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export default async function checkDomain(): Promise<void> {
|
|
180
|
-
const config = await loadUserConfig();
|
|
181
|
-
const contexts = normalizeContexts(config.contexts);
|
|
182
|
-
|
|
183
|
-
if (!contexts.length) {
|
|
184
|
-
console.error('❌ No contexts found in azure-net.config.ts/js. Fill `contexts` first.');
|
|
185
|
-
process.exitCode = 1;
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const issues: DomainIssue[] = [];
|
|
190
|
-
|
|
191
|
-
for (const context of contexts) {
|
|
192
|
-
const domainRoot = path.join(process.cwd(), 'src', 'app', context.name, 'layers', 'domain');
|
|
193
|
-
|
|
194
|
-
try {
|
|
195
|
-
await fs.access(domainRoot);
|
|
196
|
-
} catch {
|
|
197
|
-
issues.push({
|
|
198
|
-
file: domainRoot,
|
|
199
|
-
line: 1,
|
|
200
|
-
message: `Domain folder not found for context "${context.name}"`
|
|
201
|
-
});
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const files = await listDomainFiles(domainRoot);
|
|
206
|
-
for (const filePath of files) {
|
|
207
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
208
|
-
issues.push(...collectIssuesForFile(filePath, content));
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (!issues.length) {
|
|
213
|
-
console.log('✅ Domain check passed: naming, per-file limits and index exports are valid.');
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
console.error('❌ Domain check failed:');
|
|
218
|
-
for (const issue of issues) {
|
|
219
|
-
console.error(`• ${getRelativeFilePath(issue.file)}:${issue.line} — ${issue.message}`);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
process.exitCode = 1;
|
|
223
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { loadUserConfig } from '../utils/loadConfig.js';
|
|
4
|
-
import { normalizeContexts } from '../init/initAliases.js';
|
|
5
|
-
|
|
6
|
-
type StructureIssue = {
|
|
7
|
-
file: string;
|
|
8
|
-
message: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
type ContextConfig = {
|
|
12
|
-
name: string;
|
|
13
|
-
alias: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const ALLOWED_LAYERS_FOLDERS = new Set(['domain', 'presentation', 'infrastructure', 'application']);
|
|
17
|
-
const ALLOWED_UI_FOLDERS = new Set(['components', 'widgets', 'design', 'style']);
|
|
18
|
-
const ALLOWED_COMPONENTS_FOLDERS = new Set(['page', 'layout', 'shared']);
|
|
19
|
-
|
|
20
|
-
const toPosixPath = (value: string): string => value.split(path.sep).join('/');
|
|
21
|
-
|
|
22
|
-
const getRelativePath = (filePath: string): string => toPosixPath(path.relative(process.cwd(), filePath));
|
|
23
|
-
|
|
24
|
-
const getDirectories = async (dirPath: string): Promise<string[] | null> => {
|
|
25
|
-
try {
|
|
26
|
-
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
27
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
28
|
-
} catch {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const checkOnlyAllowedFolders = async (
|
|
34
|
-
basePath: string,
|
|
35
|
-
allowed: Set<string>,
|
|
36
|
-
scopeLabel: string,
|
|
37
|
-
issues: StructureIssue[]
|
|
38
|
-
): Promise<void> => {
|
|
39
|
-
const directories = await getDirectories(basePath);
|
|
40
|
-
if (!directories) return;
|
|
41
|
-
|
|
42
|
-
for (const dir of directories) {
|
|
43
|
-
if (allowed.has(dir)) continue;
|
|
44
|
-
issues.push({
|
|
45
|
-
file: basePath,
|
|
46
|
-
message: `${scopeLabel} can contain only: ${Array.from(allowed).join(', ')}. Found: ${dir}`
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default async function checkFoldersStructure(): Promise<void> {
|
|
52
|
-
const config = await loadUserConfig();
|
|
53
|
-
const contexts = normalizeContexts(config.contexts) as ContextConfig[];
|
|
54
|
-
|
|
55
|
-
if (!contexts.length) {
|
|
56
|
-
console.error('❌ No contexts found in azure-net.config.ts/js. Fill `contexts` first.');
|
|
57
|
-
process.exitCode = 1;
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const issues: StructureIssue[] = [];
|
|
62
|
-
|
|
63
|
-
for (const context of contexts) {
|
|
64
|
-
const contextRoot = path.join(process.cwd(), 'src', 'app', context.name);
|
|
65
|
-
const layersPath = path.join(contextRoot, 'layers');
|
|
66
|
-
const uiPath = path.join(contextRoot, 'ui');
|
|
67
|
-
const componentsPath = path.join(uiPath, 'components');
|
|
68
|
-
|
|
69
|
-
await checkOnlyAllowedFolders(layersPath, ALLOWED_LAYERS_FOLDERS, `layers (${context.name})`, issues);
|
|
70
|
-
await checkOnlyAllowedFolders(uiPath, ALLOWED_UI_FOLDERS, `ui (${context.name})`, issues);
|
|
71
|
-
await checkOnlyAllowedFolders(componentsPath, ALLOWED_COMPONENTS_FOLDERS, `ui/components (${context.name})`, issues);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (!issues.length) {
|
|
75
|
-
console.log('✅ Folders structure check passed.');
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
console.error('❌ Folders structure check failed:');
|
|
80
|
-
for (const issue of issues) {
|
|
81
|
-
console.error(`• ${getRelativePath(issue.file)} — ${issue.message}`);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
process.exitCode = 1;
|
|
85
|
-
}
|
package/src/checks/checkHooks.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
const forbiddenHooks = ['hooks.server.ts', 'hooks.server.js', 'hooks.client.ts', 'hooks.client.js'];
|
|
5
|
-
|
|
6
|
-
export default async function checkHooks(): Promise<void> {
|
|
7
|
-
const srcPath = path.join(process.cwd(), 'src');
|
|
8
|
-
const found = forbiddenHooks.map((filename) => path.join(srcPath, filename)).filter((filepath) => fs.existsSync(filepath));
|
|
9
|
-
|
|
10
|
-
if (!found.length) {
|
|
11
|
-
console.log('✅ No manual SvelteKit hooks found.');
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
console.error('❌ Manual SvelteKit hooks are not allowed with @azure-net/kit AzureNetPlugin.');
|
|
16
|
-
console.error('Move lifecycle code to src/program.ts through createApp(). Found:');
|
|
17
|
-
for (const filepath of found) {
|
|
18
|
-
console.error(` - ${path.relative(process.cwd(), filepath)}`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
process.exitCode = 1;
|
|
22
|
-
}
|