mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ts/checkTsProjects] produce a more useful error message (#83209)
Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
parent
5e06f43adf
commit
2f26eaf87c
1 changed files with 9 additions and 6 deletions
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { resolve } from 'path';
|
||||
import { resolve, relative } from 'path';
|
||||
|
||||
import execa from 'execa';
|
||||
|
||||
|
@ -35,7 +35,7 @@ export async function runCheckTsProjectsCli() {
|
|||
});
|
||||
|
||||
const isNotInTsProject: File[] = [];
|
||||
const isInMultipleTsProjects: File[] = [];
|
||||
const isInMultipleTsProjects: string[] = [];
|
||||
|
||||
for (const lineRaw of files.split('\n')) {
|
||||
const line = lineRaw.trim();
|
||||
|
@ -56,7 +56,11 @@ export async function runCheckTsProjectsCli() {
|
|||
isNotInTsProject.push(file);
|
||||
}
|
||||
if (projects.length > 1 && !file.isTypescriptAmbient()) {
|
||||
isInMultipleTsProjects.push(file);
|
||||
isInMultipleTsProjects.push(
|
||||
` - ${file.getRelativePath()}:\n${projects
|
||||
.map((p) => ` - ${relative(process.cwd(), p.tsConfigPath)}`)
|
||||
.join('\n')}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,10 +78,9 @@ export async function runCheckTsProjectsCli() {
|
|||
}
|
||||
|
||||
if (isInMultipleTsProjects.length) {
|
||||
const details = isInMultipleTsProjects.join('\n');
|
||||
log.error(
|
||||
`The following files belong to multiple tsconfig.json files listed in src/dev/typescript/projects.ts\n${isInMultipleTsProjects
|
||||
.map((file) => ` - ${file.getRelativePath()}`)
|
||||
.join('\n')}`
|
||||
`The following files belong to multiple tsconfig.json files listed in src/dev/typescript/projects.ts\n${details}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue