Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).then((result: any) => {
if (result.errors) {
throw new Error("Validation error of api '" + api.name + "':" + pretty_yaml.stringify(result.errors));
}
if (result.warnings) {
LOGGER.warn("%s", pretty_yaml.stringify(result.warnings));
}
});
}
{
type: 'input',
name: 'categories',
message: 'Categories (comma separated)',
},
{
type: 'input',
name: 'keywords',
message: 'Keywords (comma separated)',
},
])
const slug = slugify(title)
const destination = fromRoot('content/blog', slug)
mkdirp.sync(destination)
const yaml = jsToYaml.stringify(
removeEmpty({
slug,
title,
date: formatDate(new Date()),
author: 'React Vis',
description: `_${description}_`,
categories: listify(categories),
keywords: listify(keywords),
}),
)
const markdown = prettier.format(`---\n${yaml}\n---\n`, {
...require('../prettier.config'),
parser: 'mdx',
})
fs.writeFileSync(path.join(destination, 'index.md'), markdown)
function writeConfig(answers: Answers, config: Types.Config) {
const ext = answers.config.toLocaleLowerCase().endsWith('.json') ? 'json' : 'yml';
const content = ext === 'json' ? JSON.stringify(config) : YAML.stringify(config);
const fullPath = resolve(process.cwd(), answers.config);
const relativePath = relative(process.cwd(), answers.config);
writeFileSync(fullPath, content, {
encoding: 'utf-8'
});
return {
relativePath,
fullPath
};
}
function jsontoYml(jsonData) {
return jsonYml.stringify(jsonData);
}
}).then((result: any) => {
if (result.errors) {
throw new Error("Validation error of api '" + api.name + "':" + pretty_yaml.stringify(result.errors));
}
if (result.warnings) {
LOGGER.warn("%s", pretty_yaml.stringify(result.warnings));
}
});
}
app.get(api.basepath + api.metadata + ".yaml", function (req, res) {
res.type('text/x-yaml')
res.status(200)
res.send(pretty_yaml.stringify(spec))
})
}
config: rootConfig,
generates: {
[options.out]: transformTemplatesToPlugins(options, {
...rootConfig,
...(options.templateConfig || {})
})
},
silent: options.silent,
watch: options.watch,
require: options.require
};
console['warn'](`
Note: You are using the old API of graphql-code-generator. You can easily migrate by creating "codegen.yml" file in your project with the following content:
${YAML.stringify(configObject)}
Then, make sure that your script is executing just "gql-gen" (without any cli flags).
`);
return configObject;
}
check_api.check_api(specInJson, {}, function (err: any, options: any) {
if (err) {
errors += "\nevent " + event.name + ": Schema validation Error \n" + pretty_yaml.stringify(err)
}
})
}
app.get(api.basepath + api.metadata, function (req, res) {
res.type('text/x-yaml')
res.status(200)
res.send(pretty_yaml.stringify(spec))
});
app.get(api.basepath + api.metadata + ".json", function (req, res) {