add lint-docs script

This commit is contained in:
Zeke Sikelianos 2016-07-08 16:33:25 -07:00
parent 01fa9827b4
commit 3a5bf51d1d
2 changed files with 20 additions and 0 deletions

View file

@ -4,6 +4,7 @@
"devDependencies": {
"asar": "^0.11.0",
"electabul": "~0.0.4",
"electron-docs-linter": "^1.0.1",
"request": "*",
"standard": "^7.1.2",
"standard-markdown": "^1.2.1"

19
script/lint-docs.js Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const lint = require('electron-docs-linter')
const args = process.argv.slice(2)
const docsPath = path.join(__dirname, '../docs/api')
const targetVersion = args[0]
const outFile = path.join(__dirname, '../electron.json')
if (!targetVersion) {
console.error(`Usage: ./script/lint-docs.js <targetVersion>`)
process.exit(1)
}
lint(docsPath, targetVersion).then(function(apis) {
fs.writeFileSync(outFile, JSON.stringify(apis, null, 2))
console.log(`Wrote ${outFile}`)
})