Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
config.$schema = config.$schema || args_extractors_1.nextOrDefault('--schema', false);
if (config.$schema) {
externalSchema = fs_1.readFileSync(config.$schema, {
encoding: 'utf-8'
});
externalSchema = core_1.buildSchema(externalSchema);
}
}
catch (e) { }
const schemas = [externalSchema, schema].filter(i => !!i);
let mergedSchemas;
if (schemas.length === 1) {
mergedSchemas = schema;
}
else {
mergedSchemas = core_1.mergeSchemas({
schemas
});
}
if (args_extractors_1.includes('--verbose')) {
console.log(`
Schema:
${core_1.printSchema(mergedSchemas)}
`);
}
if (process.argv.toString().includes('--generate')) {
util_1.promisify(fs_1.writeFile)('./schema.graphql', core_1.printSchema(mergedSchemas), {
encoding: 'utf-8'
}).then(() => {
console.log('Schema created!');
process.exit(0);
});
})
);
config.$schema = config.$schema || nextOrDefault('--schema', false);
if (config.$schema) {
externalSchema = readFileSync(config.$schema, {
encoding: 'utf-8'
});
externalSchema = buildSchema(externalSchema);
}
} catch (e) {}
const schemas = [externalSchema, schema].filter(i => !!i);
let mergedSchemas: GraphQLSchema;
if (schemas.length === 1) {
mergedSchemas = schema;
} else {
mergedSchemas = mergeSchemas({
schemas
});
}
if (includes('--verbose')) {
console.log(`
Schema:
${printSchema(mergedSchemas)}
`);
}
if (process.argv.toString().includes('--generate')) {
promisify(writeFile)('./schema.graphql', printSchema(mergedSchemas), {
encoding: 'utf-8'
}).then(() => {
console.log('Schema created!');