Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function buildSchema(inFile: string, mimetype: string): string {
const jsonSchema = JSON.parse(fs.readFileSync(inFile, 'utf-8'));
const SchemaClass = SchemaClassFactory(jsonSchema);
const schemaInstance = new SchemaClass({});
let name = inFile.split(/[\/\\]/g).pop();
if (name) {
name = strings.classify(name.replace(/\.[^.]*$/, ''));
}
const license = `/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
`.replace(/^ {4}/gm, '');
engineHost.registerOptionsTransform((schematic: FileSystemSchematicDesc, options: any) => {
if (schematic.schema) {
const SchemaMetaClass = SchemaClassFactory(schematic.schemaJson!);
const schemaClass = new SchemaMetaClass(options);
return schemaClass.$$root();
}
return options;
});
}, () => {
const SchemaMetaClass = json_schema_1.SchemaClassFactory(complexSchema);
const schemaClass = new SchemaMetaClass({});
schemaClass.$$root();
});
(function () {
engineHost.registerOptionsTransform((schematic, options) => {
if (schematic.schema) {
const SchemaMetaClass = json_schema_1.SchemaClassFactory(schematic.schemaJson);
const schemaClass = new SchemaMetaClass(options);
return schemaClass.$$root();
}
return options;
});
const collection = engine.createCollection(collectionName);
export function buildSchema(inFile: string, _logger: logging.Logger): string {
const jsonSchema = JSON.parse(fs.readFileSync(inFile, 'utf-8'));
const SchemaClass = SchemaClassFactory(jsonSchema);
const schemaInstance = new SchemaClass({});
return schemaInstance.$$serialize('text/x.dts', 'CliConfig');
}
constructor(_configPath, schema, configJson, fallbacks = []) {
this._configPath = _configPath;
this._config = new (json_schema_1.SchemaClassFactory(schema))(configJson, ...fallbacks);
}
get config() { return this._config; }