@azure-net/cli 5.1.1 → 6.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +189 -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/presenters.d.ts +7 -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 +48 -36
- 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 +914 -0
- package/src/migrate/presenters.js +265 -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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type InterfaceField = {
|
|
2
|
+
name: string;
|
|
3
|
+
optional: boolean;
|
|
4
|
+
type: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const extractInterfaceFields: (body: string) => InterfaceField[];
|
|
7
|
+
export declare const updateRulesObject: (content: string, fields: InterfaceField[]) => string | null;
|
|
8
|
+
export default function generateSchemaFromType(): Promise<void>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function generateStore(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function generateUseCases(): Promise<void>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
type ContextConfig = {
|
|
2
|
+
name: string;
|
|
3
|
+
alias: string;
|
|
4
|
+
};
|
|
5
|
+
type TypeLayer = 'Ports' | 'Entities' | 'Enums';
|
|
6
|
+
type ResponseKind = 'domain' | 'primitive';
|
|
7
|
+
type RepositoryMeta = {
|
|
8
|
+
className: string;
|
|
9
|
+
baseName: string;
|
|
10
|
+
repositoryInterfaceName: string;
|
|
11
|
+
useCasesClassName: string;
|
|
12
|
+
repositoryDependencyName: string;
|
|
13
|
+
};
|
|
14
|
+
type DomainType = {
|
|
15
|
+
name: string;
|
|
16
|
+
layer: TypeLayer;
|
|
17
|
+
fileName?: string;
|
|
18
|
+
};
|
|
19
|
+
type MethodTypeRef = {
|
|
20
|
+
name: string;
|
|
21
|
+
layer: TypeLayer;
|
|
22
|
+
};
|
|
23
|
+
type MethodResponseRef = {
|
|
24
|
+
kind: ResponseKind;
|
|
25
|
+
type: string;
|
|
26
|
+
layer: TypeLayer | null;
|
|
27
|
+
};
|
|
28
|
+
type RepositoryMethod = {
|
|
29
|
+
name: string;
|
|
30
|
+
httpMethod: string;
|
|
31
|
+
route: string;
|
|
32
|
+
response: MethodResponseRef;
|
|
33
|
+
queryType: MethodTypeRef | null;
|
|
34
|
+
bodyType: MethodTypeRef | null;
|
|
35
|
+
pathParamType: string | null;
|
|
36
|
+
};
|
|
37
|
+
type DatasourceInfo = {
|
|
38
|
+
name: string;
|
|
39
|
+
importPath: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const ensureRepositoryName: (rawName: unknown) => string;
|
|
42
|
+
export declare const getRepositoryMeta: (repositoryName: unknown) => RepositoryMeta;
|
|
43
|
+
export declare const getConfigState: () => Promise<{
|
|
44
|
+
contexts: ContextConfig[];
|
|
45
|
+
sharedAlias: string;
|
|
46
|
+
sharedContextName: string;
|
|
47
|
+
}>;
|
|
48
|
+
export declare const selectContext: (message?: string) => Promise<string | null>;
|
|
49
|
+
export declare const resolveContextAlias: (_contexts: ContextConfig[], contextName: string) => string;
|
|
50
|
+
export declare const resolveRepositoriesPath: (contextName: string) => string;
|
|
51
|
+
export declare const resolveDatasourcesPath: (...compatibility: [contextName?: string]) => string;
|
|
52
|
+
export declare const resolveSharedDatasourcesPath: () => Promise<string>;
|
|
53
|
+
export declare const resolveDomainRootPath: (contextName: string, ...compatibility: [domainName?: string]) => string;
|
|
54
|
+
export declare const resolveUseCasesPath: (contextName: string) => string;
|
|
55
|
+
export declare const getAvailableTsNames: (targetPath: string) => Promise<string[]>;
|
|
56
|
+
export declare const selectDatasource: (...compatibility: [contextName?: string]) => Promise<DatasourceInfo | null>;
|
|
57
|
+
export declare const selectDomain: (contextName: string) => Promise<string>;
|
|
58
|
+
export declare const getDomainTypes: (contextName: string, domainName?: string) => Promise<DomainType[]>;
|
|
59
|
+
export declare const promptMethodDefinition: (domainTypes: DomainType[]) => Promise<RepositoryMethod | null>;
|
|
60
|
+
export declare const buildRepositoryMethodCode: (method: RepositoryMethod) => string;
|
|
61
|
+
export declare const buildRepositoryContent: ({ meta, contextAlias, datasource, domainTypes, methods }: {
|
|
62
|
+
meta: RepositoryMeta;
|
|
63
|
+
contextAlias: string;
|
|
64
|
+
domainName: string;
|
|
65
|
+
domainTypes?: DomainType[];
|
|
66
|
+
datasource: DatasourceInfo;
|
|
67
|
+
methods: RepositoryMethod[];
|
|
68
|
+
}) => string;
|
|
69
|
+
export declare const writeRepositoryInterface: ({ contextName, domainName, meta, methods }: {
|
|
70
|
+
contextName: string;
|
|
71
|
+
domainName: string;
|
|
72
|
+
meta: RepositoryMeta;
|
|
73
|
+
methods: RepositoryMethod[];
|
|
74
|
+
}) => Promise<boolean>;
|
|
75
|
+
export declare const createUseCasesForRepository: ({ contextName, contextAlias, domainName, repositoryName }: {
|
|
76
|
+
contextName: string;
|
|
77
|
+
contextAlias: string;
|
|
78
|
+
domainName: string;
|
|
79
|
+
repositoryName: string;
|
|
80
|
+
}) => Promise<boolean>;
|
|
81
|
+
export declare const resolveDomainForRepository: ({ contextName, contextAlias, repositoryName }: {
|
|
82
|
+
contextName: string;
|
|
83
|
+
contextAlias: string;
|
|
84
|
+
repositoryName: string;
|
|
85
|
+
}) => Promise<string | null>;
|
|
86
|
+
export declare const promptMethodsBatch: (domainTypes: DomainType[], count: number) => Promise<RepositoryMethod[] | null>;
|
|
87
|
+
export declare const ensureDomainScaffold: (contextName: string) => Promise<void>;
|
|
88
|
+
export declare const printApplicationProviderWiring: (contextName: string, repositoryName: string, datasourceName: string) => void;
|
|
89
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type RouteGenerationMeta = {
|
|
2
|
+
url: string;
|
|
3
|
+
routeDir: string;
|
|
4
|
+
relativeDir: string;
|
|
5
|
+
segments: string[];
|
|
6
|
+
dynamicParams: string[];
|
|
7
|
+
rootGroup?: string;
|
|
8
|
+
groupStack: string[];
|
|
9
|
+
depth: number;
|
|
10
|
+
hasChildren: boolean;
|
|
11
|
+
hasPage: boolean;
|
|
12
|
+
hasServer: boolean;
|
|
13
|
+
};
|
|
14
|
+
export default function generateRoutes(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function generateComponent(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function generateDesignComponent(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function generateWidget(): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import prompts from 'prompts';
|
|
2
|
+
import { type GitRunner } from './runGit.js';
|
|
3
|
+
export declare const commitTypes: {
|
|
4
|
+
value: string;
|
|
5
|
+
title: string;
|
|
6
|
+
}[];
|
|
7
|
+
export declare class CommitCancelledError extends Error {
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
10
|
+
export declare function validateSubject(value: string): true | string;
|
|
11
|
+
export interface CommitAnswers {
|
|
12
|
+
type: string;
|
|
13
|
+
subject: string;
|
|
14
|
+
body?: string;
|
|
15
|
+
breaking?: string;
|
|
16
|
+
footer?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function formatCommitMessage(answers: CommitAnswers): string;
|
|
19
|
+
export interface CommitDependencies {
|
|
20
|
+
prompt?: typeof prompts;
|
|
21
|
+
git?: GitRunner;
|
|
22
|
+
}
|
|
23
|
+
export default function commit(dependencies?: CommitDependencies): Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CommitDependencies } from './commit.js';
|
|
2
|
+
export interface PushOptions {
|
|
3
|
+
check?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface PushDependencies extends CommitDependencies {
|
|
6
|
+
loadConfig?: () => Promise<{
|
|
7
|
+
runChecksBeforePush?: unknown;
|
|
8
|
+
}>;
|
|
9
|
+
checkProject?: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export default function push(options?: PushOptions, dependencies?: PushDependencies): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type ContextConfig = {
|
|
2
|
+
name: string;
|
|
3
|
+
alias: string;
|
|
4
|
+
};
|
|
5
|
+
/** Compatibility only: architecture discovery never reads configured contexts. */
|
|
6
|
+
export declare function normalizeContexts(raw: unknown): ContextConfig[];
|
|
7
|
+
export declare function generateAliases(): {
|
|
8
|
+
contexts: ContextConfig[];
|
|
9
|
+
aliases: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
export { mergeAliasesInSvelteConfig } from '../utils/legacyAliases.js';
|
|
12
|
+
export default function initAliases(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function initStructure(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../plugins/addLint.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function installFresh(): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type MigrationIssue = {
|
|
2
|
+
file: string;
|
|
3
|
+
reason: string;
|
|
4
|
+
};
|
|
5
|
+
export type MigrationPlan = {
|
|
6
|
+
root: string;
|
|
7
|
+
moves: {
|
|
8
|
+
from: string;
|
|
9
|
+
to: string;
|
|
10
|
+
}[];
|
|
11
|
+
issues: MigrationIssue[];
|
|
12
|
+
writes: Map<string, Buffer>;
|
|
13
|
+
originals: Map<string, Buffer>;
|
|
14
|
+
removes: string[];
|
|
15
|
+
workspaces: string[];
|
|
16
|
+
};
|
|
17
|
+
export declare function planMigration(root?: string): Promise<MigrationPlan>;
|
|
18
|
+
export declare function applyMigration(plan: MigrationPlan): Promise<string>;
|
|
19
|
+
export default function migrate(options?: {
|
|
20
|
+
dryRun?: boolean;
|
|
21
|
+
yes?: boolean;
|
|
22
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function migrateAsyncHelpers(input: string, file: string): string;
|
|
2
|
+
/** Upgrade only recognized factories; arbitrary injected dependencies require a human decision. */
|
|
3
|
+
export declare function migratePresenterSource(input: string, file: string, factories: Set<string>): {
|
|
4
|
+
content: string;
|
|
5
|
+
converted: Map<string, string>;
|
|
6
|
+
issues: string[];
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function createCoreSchema(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function createDatasource(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function createProgram(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function createResponse(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function createSchemaRule(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function createTranslationManager(): Promise<void>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export { default as createCoreSchema } from './createCoreSchema.js';
|
|
2
2
|
export { default as createTranslationManager } from './createTranslationManager.js';
|
|
3
|
-
export { default as createPresenterFactory } from './createPresenterFactory.js';
|
|
4
3
|
export { default as createSchemaRule } from './createSchemaRule.js';
|
|
5
4
|
export { default as createResponse } from './createResponse.js';
|
|
6
5
|
export { default as createDatasource } from './createDatasource.js';
|
|
7
|
-
export { default as createDatasourceProvider } from './createDatasourceProvider.js';
|
|
8
6
|
export { default as createProgram } from './createProgram.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function updateDefaultFactoryConfig(content: string, key: 'defaultSchemaFactory', name: string): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const SHARED_CONTEXT = "SharedKernel";
|
|
2
|
+
export declare const SHARED_WORKSPACE = "Shared";
|
|
3
|
+
export declare const ARCHITECTURE_ALIASES: {
|
|
4
|
+
readonly '#contexts': "./src/app/Contexts";
|
|
5
|
+
readonly '#presentation': "./src/app/Presentation";
|
|
6
|
+
readonly '#platform': "./src/app/Platform";
|
|
7
|
+
};
|
|
8
|
+
export declare const CONTEXT_DIRS: readonly ["Domain/Entities", "Domain/Ports", "Domain/Enums", "Application/UseCases", "Infrastructure/Repositories"];
|
|
9
|
+
export declare const PRESENTATION_DIRS: readonly ["Ui", "Scopes", "Shell"];
|
|
10
|
+
export declare function normalizePascalName(value: string): string;
|
|
11
|
+
export declare const getAppPath: (cwd?: string) => string;
|
|
12
|
+
export declare const getContextsPath: (cwd?: string) => string;
|
|
13
|
+
export declare const getContextPath: (context: string, cwd?: string) => string;
|
|
14
|
+
export declare const getPresentationPath: (workspace?: string, cwd?: string) => string;
|
|
15
|
+
export declare const getPlatformPath: (cwd?: string) => string;
|
|
16
|
+
export declare const getContextImportPath: (context: string) => string;
|
|
17
|
+
export declare const getPresentationImportPath: (workspace?: string) => string;
|
|
18
|
+
export declare const discoverContexts: (cwd?: string) => Promise<string[]>;
|
|
19
|
+
export declare const discoverPresentationWorkspaces: (cwd?: string) => Promise<string[]>;
|
|
20
|
+
export declare function ensureContextStructure(context: string, cwd?: string): Promise<string>;
|
|
21
|
+
export declare function ensurePresentationStructure(workspace?: string, cwd?: string): Promise<void>;
|
|
22
|
+
export declare function selectContext(message?: string): Promise<string | null>;
|
|
23
|
+
/** null means cancelled; undefined means the flat Presentation layout. */
|
|
24
|
+
export declare function selectPresentationWorkspace(message?: string): Promise<string | null | undefined>;
|
|
25
|
+
export type PresentationWorkspace = {
|
|
26
|
+
name: string;
|
|
27
|
+
path: string;
|
|
28
|
+
alias: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function selectWorkspace(): Promise<PresentationWorkspace | null>;
|
|
31
|
+
export declare function selectScope(workspace: PresentationWorkspace): Promise<string | null>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { getContextPath, selectContext, selectPresentationWorkspace, discoverContexts, discoverPresentationWorkspaces, normalizePascalName } from './architecture.js';
|
|
2
|
+
export declare function getAvailableFiles(dir: string, pattern?: string): Promise<string[]>;
|
|
3
|
+
export declare function getApplicationProviderServices(): Promise<string[]>;
|
|
4
|
+
export declare function toPascalCase(str: string): string;
|
|
5
|
+
export declare function toCamelCase(str: string): string;
|
|
6
|
+
export declare function toKebabCase(str: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function writeIfNotExists(filepath: string, content: string): Promise<boolean>;
|
|
2
|
+
export declare function appendBarrelExports(filepath: string, sources: string[]): Promise<void>;
|
|
3
|
+
export declare function updateIndexTs(dir: string, filePattern?: string, ignore?: string[]): Promise<void>;
|
|
4
|
+
export declare function ensureIndexExports(layerPath: string): Promise<void>;
|
|
5
|
+
export declare function injectIntoFile(filepath: string, searchPattern: string, newContent: string, position?: 'after' | 'before'): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeAliasesInSvelteConfig(content: string, aliases: Record<string, string>): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type AzureNetConfig = {
|
|
2
|
+
presentationWorkspaces?: string[];
|
|
3
|
+
runChecksBeforePush?: boolean;
|
|
4
|
+
packageManager?: string;
|
|
5
|
+
defaultSchemaFactory?: string;
|
|
6
|
+
groupRoutesFunc?: unknown;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
export declare function resolveConfigFile(cwd?: string): {
|
|
10
|
+
exists: boolean;
|
|
11
|
+
filepath: string;
|
|
12
|
+
type: 'ts' | 'js';
|
|
13
|
+
};
|
|
14
|
+
export declare function loadUserConfig(cwd?: string): Promise<AzureNetConfig>;
|
|
15
|
+
/** Add the default without rewriting or dropping legacy/user configuration. */
|
|
16
|
+
export declare function initializeConfigDefaults(cwd?: string): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const PACKAGE_IMPORTS: any;
|
|
2
|
+
export declare function mergePackageImports(content: string): Promise<string>;
|
|
3
|
+
export declare function initializePackageImports(): Promise<void>;
|
|
4
|
+
export declare function resolvePackageImport(imports: Record<string, unknown>, specifier: string, root: string): string | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type FoundationConstruct = 'datasource' | 'presenter' | 'provider' | 'response' | 'schema';
|
|
2
|
+
export type ContextConfig = {
|
|
3
|
+
name: string;
|
|
4
|
+
alias: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const SHARED_ESSENTIALS_DIR_NAME = "Platform";
|
|
7
|
+
export declare function getSharedState(): Promise<{
|
|
8
|
+
contexts: ContextConfig[];
|
|
9
|
+
sharedAlias: string;
|
|
10
|
+
sharedContext: ContextConfig;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const hasSharedAliasConfig: () => Promise<boolean>;
|
|
13
|
+
export declare const getSharedContextRootPath: (name?: string) => string;
|
|
14
|
+
export declare const getSharedEssentialsPath: (...compatibility: [name?: string]) => string;
|
|
15
|
+
export declare const getFoundationRootPath: (...compatibility: [name?: string]) => string;
|
|
16
|
+
export declare const getFoundationConstructPath: (name: string, construct: FoundationConstruct) => string;
|
|
17
|
+
export declare const getFoundationConstructImportPath: (_alias: string, construct: FoundationConstruct) => string;
|
|
18
|
+
export declare const getLocalizationPath: (...compatibility: [name?: string]) => string;
|
|
19
|
+
export declare const getLocalizationImportPath: (...compatibility: [alias?: string]) => string;
|
|
20
|
+
export declare const getConfigFileLabel: () => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const VITE_CONFIGS: string[];
|
|
2
|
+
export declare const SVELTE_CONFIGS: string[];
|
|
3
|
+
/** Pure config edit; never evaluates a project's configuration. */
|
|
4
|
+
export declare function mergeKitViteConfig(content: string, aliases: Record<string, string>, legacy?: string): string;
|
|
5
|
+
export declare function formatConfig(content: string, file: string): Promise<string>;
|
|
6
|
+
export declare function configureKitProject(): Promise<void>;
|
|
7
|
+
export declare function readStaticAliases(content: string): Record<string, string>;
|
|
8
|
+
/** Hydratable needs Svelte async mode. Preserve all unrelated literal options. */
|
|
9
|
+
export declare function enableHydratable(content: string): string;
|
package/package.json
CHANGED
|
@@ -1,37 +1,49 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
2
|
+
"name": "@azure-net/cli",
|
|
3
|
+
"version": "6.0.0-next.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"azure-net": "bin/azure-net.js"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"author": "Pixel1917",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public",
|
|
12
|
+
"registry": "https://registry.npmjs.org/"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@azure-net/kit": ">=6.0.0-next.1"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"commander": "^11",
|
|
19
|
+
"prompts": "^2",
|
|
20
|
+
"typescript": "^5",
|
|
21
|
+
"prettier": "^3.6.2"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@eslint/js": "^9.31.0",
|
|
25
|
+
"@types/node": "^24.0.3",
|
|
26
|
+
"@types/prompts": "^2.4.9",
|
|
27
|
+
"env-cmd": "^11.0.0",
|
|
28
|
+
"eslint": "^9.31.0",
|
|
29
|
+
"typescript-eslint": "^8.36.0"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "node scripts/clean-build.mjs && tsc -p tsconfig.json && node scripts/sync-build.mjs",
|
|
33
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
34
|
+
"lint": "eslint \"bin/**/*.ts\" \"src/**/*.ts\"",
|
|
35
|
+
"format": "prettier --write .",
|
|
36
|
+
"test": "pnpm build && node --test tests/*.test.mjs",
|
|
37
|
+
"prepack": "pnpm build"
|
|
38
|
+
},
|
|
39
|
+
"packageManager": "pnpm@9.13.2+sha512.88c9c3864450350e65a33587ab801acf946d7c814ed1134da4a924f6df5a2120fd36b46aab68f7cd1d413149112d53c7db3a4136624cfd00ff1846a0c6cef48a",
|
|
40
|
+
"files": [
|
|
41
|
+
"bin/*.js",
|
|
42
|
+
"src/**/*.js",
|
|
43
|
+
"dist/**/*.d.ts",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=22.15.0"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { resolvePackageImport } from '../utils/packageImports.js';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { readStaticAliases, VITE_CONFIGS, SVELTE_CONFIGS } from '../utils/viteConfig.js';
|
|
5
|
+
import ts from 'typescript';
|
|
6
|
+
export const appRoot = () => path.join(process.cwd(), 'src', 'app');
|
|
7
|
+
export const directories = async (root) => (await fs.readdir(root, { withFileTypes: true }))
|
|
8
|
+
.filter((entry) => entry.isDirectory() && entry.name !== '.backup')
|
|
9
|
+
.map((entry) => entry.name);
|
|
10
|
+
export async function sourceFiles(root) {
|
|
11
|
+
const files = [];
|
|
12
|
+
for (const entry of await fs.readdir(root, { withFileTypes: true })) {
|
|
13
|
+
if (['.backup', 'node_modules', '.git', '.svelte-kit', 'dist'].includes(entry.name))
|
|
14
|
+
continue;
|
|
15
|
+
const file = path.join(root, entry.name);
|
|
16
|
+
if (entry.isDirectory())
|
|
17
|
+
files.push(...(await sourceFiles(file)));
|
|
18
|
+
else if (/\.(?:[cm]?[jt]sx?|svelte)$/.test(entry.name))
|
|
19
|
+
files.push(file);
|
|
20
|
+
}
|
|
21
|
+
return files;
|
|
22
|
+
}
|
|
23
|
+
export function parseSource(content, filename = 'Source.ts') {
|
|
24
|
+
// Mask markup while retaining offsets for accurate Svelte script diagnostics.
|
|
25
|
+
if (filename.endsWith('.svelte')) {
|
|
26
|
+
const pieces = [];
|
|
27
|
+
let end = 0;
|
|
28
|
+
const scripts = /<!--[^]*?-->|<script\b[^>]*>([^]*?)<\/script\s*>/gi;
|
|
29
|
+
for (const match of content.matchAll(scripts)) {
|
|
30
|
+
if (match[1] === undefined)
|
|
31
|
+
continue;
|
|
32
|
+
const start = match.index + match[0].indexOf('>') + 1;
|
|
33
|
+
pieces.push(content.slice(end, start).replace(/[^\r\n]/g, ' '), match[1]);
|
|
34
|
+
end = start + match[1].length;
|
|
35
|
+
}
|
|
36
|
+
pieces.push(content.slice(end).replace(/[^\r\n]/g, ' '));
|
|
37
|
+
content = pieces.join('');
|
|
38
|
+
}
|
|
39
|
+
return ts.createSourceFile(filename, content, ts.ScriptTarget.Latest, true, /\.[jt]sx$/.test(filename) ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
|
|
40
|
+
}
|
|
41
|
+
export function dependencies(content, filename = 'Source.ts') {
|
|
42
|
+
const result = [];
|
|
43
|
+
const sourceFile = parseSource(content, filename);
|
|
44
|
+
const add = (literal, node, kind) => {
|
|
45
|
+
if (!literal || (!ts.isStringLiteral(literal) && !ts.isNoSubstitutionTemplateLiteral(literal)))
|
|
46
|
+
return;
|
|
47
|
+
result.push({ source: literal.text, line: sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1, kind });
|
|
48
|
+
};
|
|
49
|
+
const visit = (node) => {
|
|
50
|
+
if (ts.isImportDeclaration(node)) {
|
|
51
|
+
const clause = node.importClause;
|
|
52
|
+
const bindings = clause?.namedBindings;
|
|
53
|
+
const inlineTypes = !clause?.name &&
|
|
54
|
+
bindings &&
|
|
55
|
+
ts.isNamedImports(bindings) &&
|
|
56
|
+
bindings.elements.length > 0 &&
|
|
57
|
+
bindings.elements.every((element) => element.isTypeOnly);
|
|
58
|
+
add(node.moduleSpecifier, node, !clause ? 'side-effect' : clause.isTypeOnly || inlineTypes ? 'type' : 'value');
|
|
59
|
+
}
|
|
60
|
+
else if (ts.isExportDeclaration(node))
|
|
61
|
+
add(node.moduleSpecifier, node, 'export');
|
|
62
|
+
else if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword)
|
|
63
|
+
add(node.arguments[0], node, 'dynamic');
|
|
64
|
+
else if (ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument))
|
|
65
|
+
add(node.argument.literal, node, 'dynamic');
|
|
66
|
+
else if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference))
|
|
67
|
+
add(node.moduleReference.expression, node, node.isTypeOnly ? 'type' : 'value');
|
|
68
|
+
ts.forEachChild(node, visit);
|
|
69
|
+
};
|
|
70
|
+
visit(sourceFile);
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
export function exportOnly(content) {
|
|
74
|
+
return parseSource(content).statements.every((node) => ts.isExportDeclaration(node) || ts.isEmptyStatement(node));
|
|
75
|
+
}
|
|
76
|
+
export async function importResolver() {
|
|
77
|
+
const aliases = {
|
|
78
|
+
'#contexts': 'src/app/Contexts',
|
|
79
|
+
'#presentation': 'src/app/Presentation',
|
|
80
|
+
'#platform': 'src/app/Platform',
|
|
81
|
+
$lib: 'src/lib',
|
|
82
|
+
'#lib': 'src/lib'
|
|
83
|
+
};
|
|
84
|
+
for (const name of [...VITE_CONFIGS, ...SVELTE_CONFIGS]) {
|
|
85
|
+
const configPath = path.join(process.cwd(), name);
|
|
86
|
+
try {
|
|
87
|
+
await fs.access(configPath);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
Object.assign(aliases, readStaticAliases(await fs.readFile(configPath, 'utf8')));
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
let imports = {};
|
|
96
|
+
try {
|
|
97
|
+
imports = JSON.parse(await fs.readFile(path.join(process.cwd(), 'package.json'), 'utf8')).imports ?? {};
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
if (error.code !== 'ENOENT')
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
const entries = Object.entries(aliases).sort(([a], [b]) => b.length - a.length);
|
|
104
|
+
return (file, source) => {
|
|
105
|
+
const clean = source[0] + source.slice(1).split(/[?#]/)[0];
|
|
106
|
+
const imported = resolvePackageImport(imports, clean, process.cwd());
|
|
107
|
+
if (imported)
|
|
108
|
+
return imported;
|
|
109
|
+
if (clean.startsWith('.'))
|
|
110
|
+
return path.resolve(path.dirname(file), clean);
|
|
111
|
+
if (path.isAbsolute(clean))
|
|
112
|
+
return path.resolve(clean);
|
|
113
|
+
for (const [key, target] of entries) {
|
|
114
|
+
const alias = key.replace(/\/\*$/, '');
|
|
115
|
+
if (clean !== alias && !clean.startsWith(`${alias}/`))
|
|
116
|
+
continue;
|
|
117
|
+
return path.resolve(process.cwd(), target.replace(/\/\*$/, ''), clean.slice(alias.length).replace(/^\//, ''));
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export function location(file) {
|
|
123
|
+
return path.relative(appRoot(), file).split(path.sep);
|
|
124
|
+
}
|
|
125
|
+
export function report(label, issues) {
|
|
126
|
+
if (!issues.length) {
|
|
127
|
+
console.log(`${label} check passed.`);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
console.error(`${label} check failed:`);
|
|
131
|
+
for (const issue of issues)
|
|
132
|
+
console.error(`${path.relative(process.cwd(), issue.file)}:${issue.line} - ${issue.message}`);
|
|
133
|
+
process.exitCode = 1;
|
|
134
|
+
}
|
|
135
|
+
export async function checkDependencies(label, rule) {
|
|
136
|
+
const issues = [];
|
|
137
|
+
try {
|
|
138
|
+
const resolve = await importResolver();
|
|
139
|
+
for (const file of await sourceFiles(appRoot())) {
|
|
140
|
+
for (const entry of dependencies(await fs.readFile(file, 'utf8'), file)) {
|
|
141
|
+
const target = resolve(file, entry.source);
|
|
142
|
+
if (!target)
|
|
143
|
+
continue;
|
|
144
|
+
const message = rule(location(file), location(target));
|
|
145
|
+
if (message)
|
|
146
|
+
issues.push({ file, line: entry.line, message: `${message} (${entry.source})` });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
issues.push({ file: appRoot(), line: 1, message: String(error) });
|
|
152
|
+
}
|
|
153
|
+
report(label, issues);
|
|
154
|
+
}
|