From 3a5bf51d1d0cb06801e0474b4fa320801bf03048 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Fri, 8 Jul 2016 16:33:25 -0700 Subject: [PATCH] add lint-docs script --- package.json | 1 + script/lint-docs.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 script/lint-docs.js diff --git a/package.json b/package.json index baca49ac2d5a..1367dcdcd0b9 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/script/lint-docs.js b/script/lint-docs.js new file mode 100755 index 000000000000..6f4d44084406 --- /dev/null +++ b/script/lint-docs.js @@ -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 `) + process.exit(1) +} + +lint(docsPath, targetVersion).then(function(apis) { + fs.writeFileSync(outFile, JSON.stringify(apis, null, 2)) + console.log(`Wrote ${outFile}`) +})