Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// docsPath is required
if (!docsPath) usage('specify a pathname, .e.g ~/my/electron/electron')
// docsPath is relative to current working directory
docsPath = path.join(process.cwd(), docsPath)
// outfile is relative to current working directory
if (outfile) outfile = path.join(process.cwd(), outfile)
// version is required if writing to a file
if (outfile && !version) usage('`version` is required if `outfile` is specified')
// Use a placeholder version if not writing to a file
if (!version) version = '0.0.0'
const spinner = require('ora')('Parsing electron documentation').start()
lint(docsPath, version).then(function (apis) {
spinner.stop().clear()
apis.forEach(api => console.error(api.report()))
if (apis.some(api => !api.valid)) process.exit(1)
if (outfile) {
fs.writeFileSync(outfile, JSON.stringify(apis, null, 2))
console.log(dedent`
Created ${path.relative(process.cwd(), outfile)}
`)
} else {
console.log(dedent`
Docs are good to go!\n
function spin(config?: string | object): any {
return require('ora')(config || '').start()
}