@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
|
@@ -1,166 +1,179 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
const TARGET_EXTENSIONS = new Set(['.ts', '.js', '.svelte']);
|
|
4
|
-
const IGNORED_DIRS = new Set(['node_modules', 'dist', '.svelte-kit', '.git']);
|
|
4
|
+
const IGNORED_DIRS = new Set(['.backup', 'node_modules', 'dist', '.svelte-kit', '.git']);
|
|
5
5
|
const CREATE_FACTORY_PATTERN = '(?:export\\s+)?(?:const|let|var)\\s+([A-Za-z_$][A-Za-z0-9_$]*)\\s*=\\s*createPresenterFactory\\s*\\(';
|
|
6
6
|
const IMPORT_FROM_PRESENTER_PATTERN = 'import\\s*\\{([^}]+)\\}\\s*from\\s*[\'"]([^\'"]+)[\'"]';
|
|
7
7
|
const PRESENTER_CALL_PATTERN = '\\b([A-Za-z_$][A-Za-z0-9_$]*)\\s*\\(\\s*([\'"`])([^\'"`]*)\\2';
|
|
8
8
|
const toPosixPath = (value) => value.split(path.sep).join('/');
|
|
9
9
|
const isPresenterImportPath = (importPath) => {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const normalized = importPath.replace(/\\/g, '/');
|
|
11
|
+
return /(^|\/)presenter(\/|$)/.test(normalized);
|
|
12
12
|
};
|
|
13
13
|
const parseImportLocals = (rawImports) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const locals = [];
|
|
15
|
+
for (const segment of rawImports.split(',')) {
|
|
16
|
+
const item = segment.trim();
|
|
17
|
+
if (!item.length)
|
|
18
|
+
continue;
|
|
19
|
+
const aliasMatch = item.match(/^([A-Za-z_$][A-Za-z0-9_$]*)\s+as\s+([A-Za-z_$][A-Za-z0-9_$]*)$/);
|
|
20
|
+
if (aliasMatch?.[2]) {
|
|
21
|
+
locals.push(aliasMatch[2]);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const directMatch = item.match(/^([A-Za-z_$][A-Za-z0-9_$]*)$/);
|
|
25
|
+
if (directMatch?.[1]) {
|
|
26
|
+
locals.push(directMatch[1]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return locals;
|
|
29
30
|
};
|
|
30
31
|
const listSourceFiles = async (rootDir) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
32
|
+
const result = [];
|
|
33
|
+
const stack = [rootDir];
|
|
34
|
+
while (stack.length) {
|
|
35
|
+
const current = stack.pop();
|
|
36
|
+
if (!current)
|
|
37
|
+
continue;
|
|
38
|
+
let entries = [];
|
|
39
|
+
try {
|
|
40
|
+
entries = await fs.readdir(current, { withFileTypes: true });
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
for (const entry of entries) {
|
|
46
|
+
if (entry.isDirectory()) {
|
|
47
|
+
if (!IGNORED_DIRS.has(entry.name)) {
|
|
48
|
+
stack.push(path.join(current, entry.name));
|
|
49
|
+
}
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (!entry.isFile())
|
|
53
|
+
continue;
|
|
54
|
+
const fullPath = path.join(current, entry.name);
|
|
55
|
+
const extension = path.extname(fullPath);
|
|
56
|
+
if (!TARGET_EXTENSIONS.has(extension))
|
|
57
|
+
continue;
|
|
58
|
+
result.push(fullPath);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
57
62
|
};
|
|
58
63
|
const getLineByIndex = (content, index) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
let line = 1;
|
|
65
|
+
for (let i = 0; i < index; i += 1) {
|
|
66
|
+
if (content[i] === '\n')
|
|
67
|
+
line += 1;
|
|
68
|
+
}
|
|
69
|
+
return line;
|
|
64
70
|
};
|
|
65
71
|
const extractFactoryNamesFromContent = (content) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const createFactoryRegex = new RegExp(CREATE_FACTORY_PATTERN, 'g');
|
|
73
|
+
const names = [];
|
|
74
|
+
let match;
|
|
75
|
+
while ((match = createFactoryRegex.exec(content)) !== null) {
|
|
76
|
+
const name = match[1];
|
|
77
|
+
if (name)
|
|
78
|
+
names.push(name);
|
|
79
|
+
}
|
|
80
|
+
return names;
|
|
74
81
|
};
|
|
75
82
|
const extractImportedPresenterFactories = (content) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
const importFromPresenterRegex = new RegExp(IMPORT_FROM_PRESENTER_PATTERN, 'g');
|
|
84
|
+
const names = [];
|
|
85
|
+
let match;
|
|
86
|
+
while ((match = importFromPresenterRegex.exec(content)) !== null) {
|
|
87
|
+
const rawImports = match[1];
|
|
88
|
+
const importPath = match[2];
|
|
89
|
+
if (!rawImports || !importPath)
|
|
90
|
+
continue;
|
|
91
|
+
if (!isPresenterImportPath(importPath))
|
|
92
|
+
continue;
|
|
93
|
+
names.push(...parseImportLocals(rawImports));
|
|
94
|
+
}
|
|
95
|
+
return names;
|
|
87
96
|
};
|
|
88
97
|
const collectPresenterOccurrences = (content, filePath, knownFactories) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
98
|
+
const presenterCallRegex = new RegExp(PRESENTER_CALL_PATTERN, 'g');
|
|
99
|
+
const occurrences = [];
|
|
100
|
+
const availableCallees = new Set(['createPresenter']);
|
|
101
|
+
for (const name of extractFactoryNamesFromContent(content)) {
|
|
102
|
+
availableCallees.add(name);
|
|
103
|
+
}
|
|
104
|
+
for (const name of extractImportedPresenterFactories(content)) {
|
|
105
|
+
availableCallees.add(name);
|
|
106
|
+
}
|
|
107
|
+
for (const name of knownFactories) {
|
|
108
|
+
availableCallees.add(name);
|
|
109
|
+
}
|
|
110
|
+
let match;
|
|
111
|
+
while ((match = presenterCallRegex.exec(content)) !== null) {
|
|
112
|
+
const callee = match[1];
|
|
113
|
+
const quote = match[2];
|
|
114
|
+
const presenterId = match[3];
|
|
115
|
+
if (!callee || !presenterId)
|
|
116
|
+
continue;
|
|
117
|
+
if (!availableCallees.has(callee))
|
|
118
|
+
continue;
|
|
119
|
+
if (quote === '`' && presenterId.includes('${'))
|
|
120
|
+
continue;
|
|
121
|
+
occurrences.push({
|
|
122
|
+
id: presenterId,
|
|
123
|
+
file: filePath,
|
|
124
|
+
line: getLineByIndex(content, match.index),
|
|
125
|
+
callee
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return occurrences;
|
|
117
129
|
};
|
|
118
130
|
export default async function checkPresenterNames() {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
131
|
+
const srcPath = path.join(process.cwd(), 'src');
|
|
132
|
+
try {
|
|
133
|
+
await fs.access(srcPath);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
console.error('❌ src folder not found in current workspace.');
|
|
137
|
+
process.exitCode = 1;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const files = await listSourceFiles(srcPath);
|
|
141
|
+
const fileContents = new Map();
|
|
142
|
+
for (const filePath of files) {
|
|
143
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
144
|
+
fileContents.set(filePath, content);
|
|
145
|
+
}
|
|
146
|
+
const globalFactoryNames = new Set();
|
|
147
|
+
for (const content of fileContents.values()) {
|
|
148
|
+
for (const name of extractFactoryNamesFromContent(content)) {
|
|
149
|
+
globalFactoryNames.add(name);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const occurrences = [];
|
|
153
|
+
for (const [filePath, content] of fileContents.entries()) {
|
|
154
|
+
occurrences.push(...collectPresenterOccurrences(content, filePath, globalFactoryNames));
|
|
155
|
+
}
|
|
156
|
+
if (!occurrences.length) {
|
|
157
|
+
console.log('✅ No presenter declarations found.');
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const grouped = new Map();
|
|
161
|
+
for (const occurrence of occurrences) {
|
|
162
|
+
const list = grouped.get(occurrence.id) ?? [];
|
|
163
|
+
list.push(occurrence);
|
|
164
|
+
grouped.set(occurrence.id, list);
|
|
165
|
+
}
|
|
166
|
+
const duplicated = Array.from(grouped.entries()).filter(([, list]) => list.length > 1);
|
|
167
|
+
if (!duplicated.length) {
|
|
168
|
+
console.log(`✅ Presenter names are unique (${occurrences.length} found).`);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
console.error('❌ Duplicate presenter names found:');
|
|
172
|
+
for (const [presenterId, list] of duplicated) {
|
|
173
|
+
console.error(`\n- "${presenterId}"`);
|
|
174
|
+
for (const item of list) {
|
|
175
|
+
console.error(` • ${toPosixPath(path.relative(process.cwd(), item.file))}:${item.line} (${item.callee})`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
process.exitCode = 1;
|
|
166
179
|
}
|
|
@@ -3,34 +3,35 @@ import { loadUserConfig } from '../utils/loadConfig.js';
|
|
|
3
3
|
import checkInternal from './checkInternal.js';
|
|
4
4
|
const isPackageManager = (value) => typeof value === 'string' && ['pnpm', 'npm', 'yarn', 'bun'].includes(value);
|
|
5
5
|
const runScript = (manager, script) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const command = `${manager} run ${script}`;
|
|
7
|
+
console.log(`\n▶ Running: ${command}`);
|
|
8
|
+
execSync(command, { stdio: 'inherit' });
|
|
9
9
|
};
|
|
10
10
|
const runInternalChecks = async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
console.log('\n▶ Running: azure-net check internal');
|
|
12
|
+
process.exitCode = 0;
|
|
13
|
+
await checkInternal();
|
|
14
|
+
if ((process.exitCode ?? 0) !== 0) {
|
|
15
|
+
throw new Error('azure-net check internal failed');
|
|
16
|
+
}
|
|
17
17
|
};
|
|
18
18
|
export default async function checkProject() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
const config = await loadUserConfig();
|
|
20
|
+
const manager = config.packageManager;
|
|
21
|
+
if (!isPackageManager(manager)) {
|
|
22
|
+
console.error('❌ packageManager is missing or invalid in azure-net.config.ts/js. Use one of: bun, pnpm, npm, yarn');
|
|
23
|
+
process.exitCode = 1;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
runScript(manager, 'format');
|
|
28
|
+
await runInternalChecks();
|
|
29
|
+
runScript(manager, 'lint');
|
|
30
|
+
runScript(manager, 'check');
|
|
31
|
+
console.log('\n✅ Project checks passed.');
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error(`\n❌ Project checks failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
}
|
|
36
37
|
}
|