mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 18:13:38 +08:00
build: only generate types for actual JSON schemas
This commit is contained in:
parent
7439faba12
commit
fda683b874
@ -60,9 +60,15 @@ export default async function(
|
||||
}
|
||||
const content = fs.readFileSync(fileName, 'utf-8');
|
||||
|
||||
const json = JSON.parse(content);
|
||||
if (!json.$schema) {
|
||||
// Skip non-schema files.
|
||||
let json;
|
||||
try {
|
||||
json = JSON.parse(content);
|
||||
if (typeof json.$schema !== 'string' || !json.$schema.startsWith('http://json-schema.org/')) {
|
||||
// Skip non-schema files.
|
||||
continue;
|
||||
}
|
||||
} catch {
|
||||
// malformed or JSON5
|
||||
continue;
|
||||
}
|
||||
const tsContent = await quicktypeRunner.generate(fileName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user