Browse Source

Merge pull request #7120 from electron/lint-docs

Publish the public API as a JSON object
Zeke Sikelianos 8 years ago
parent
commit
d4b204799d
3 changed files with 9 additions and 2 deletions
  1. 4 2
      package.json
  2. 3 0
      script/create-dist.py
  3. 2 0
      script/upload.py

+ 4 - 2
package.json

@@ -4,6 +4,7 @@
   "devDependencies": {
     "asar": "^0.11.0",
     "electabul": "~0.0.4",
+    "electron-docs-linter": "^1.6.2",
     "request": "*",
     "standard": "^7.1.2",
     "standard-markdown": "^1.2.1"
@@ -28,11 +29,12 @@
     "clean": "python ./script/clean.py",
     "coverage": "npm run instrument-code-coverage && npm test -- --use-instrumented-asar",
     "instrument-code-coverage": "electabul instrument --input-path ./lib --output-path ./out/coverage/electron.asar",
-    "lint": "npm run lint-js && npm run lint-cpp && npm run lint-py && npm run lint-docs",
+    "lint": "npm run lint-js && npm run lint-cpp && npm run lint-py && npm run lint-api-docs-js && npm run lint-api-docs",
     "lint-js": "standard && cd spec && standard",
     "lint-cpp": "python ./script/cpplint.py",
     "lint-py": "python ./script/pylint.py",
-    "lint-docs": "standard-markdown docs",
+    "lint-api-docs-js": "standard-markdown docs",
+    "lint-api-docs": "electron-docs-linter docs/api --version=$npm_package_version --outfile=out/electron-api.json",
     "preinstall": "node -e 'process.exit(0)'",
     "repl": "python ./script/start.py --interactive",
     "start": "python ./script/start.py",

+ 3 - 0
script/create-dist.py

@@ -85,6 +85,7 @@ def main():
   copy_chrome_binary('chromedriver')
   copy_chrome_binary('mksnapshot')
   copy_license()
+  copy_api_json_schema()
 
   if PLATFORM == 'linux':
     strip_binaries()
@@ -128,6 +129,8 @@ def copy_license():
                DIST_DIR)
   shutil.copy2(os.path.join(SOURCE_ROOT, 'LICENSE'), DIST_DIR)
 
+def copy_api_json_schema():
+  shutil.copy2(os.path.join(OUT_DIR, 'electron-api.json'), DIST_DIR)
 
 def strip_binaries():
   for binary in TARGET_BINARIES[PLATFORM]:

+ 2 - 0
script/upload.py

@@ -79,6 +79,8 @@ def main():
   upload_electron(github, release, os.path.join(DIST_DIR, DIST_NAME))
   upload_electron(github, release, os.path.join(DIST_DIR, SYMBOLS_NAME))
   if PLATFORM == 'darwin':
+    upload_electron(github, release, os.path.join(DIST_DIR,
+                    'electron-api.json'))
     upload_electron(github, release, os.path.join(DIST_DIR, DSYM_NAME))
   elif PLATFORM == 'win32':
     upload_electron(github, release, os.path.join(DIST_DIR, PDB_NAME))