Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Object.keys(schematicCollection).map(schematicName => {
const schematic = {
name: schematicName,
collectionName: `@nrwl/${config.name}`,
...schematicCollection[schematicName],
alias: schematicCollection[schematicName].hasOwnProperty('aliases')
? schematicCollection[schematicName]['aliases'][0]
: null,
rawSchema: fs.readJsonSync(
path.join(config.root, schematicCollection[schematicName]['schema'])
)
};
return parseJsonSchemaToOptions(registry, schematic.rawSchema)
.then(options => ({ ...schematic, options }))
.catch(error =>
console.error(
`Can't parse schema option of ${schematic.name}:\n${error}`
)
);
});
}
return Object.keys(schematicCollection).map(schematicName => {
const schematic = {
name: schematicName,
...schematicCollection[schematicName],
alias: schematicCollection[schematicName].hasOwnProperty('alias')
? schematicCollection[schematicName]['alias']
: null,
rawSchema: fs.readJsonSync(
path.join(config.root, schematicCollection[schematicName]['schema'])
)
};
return parseJsonSchemaToOptions(registry, schematic.rawSchema)
.then(options => ({ ...schematic, options }))
.catch(error =>
console.error(
`Can't parse schema option of ${schematic.name}:\n${error}`
)
);
});
}