From 9eef850d0c5008f134403a088370f69847d9c1c1 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 23 May 2017 12:26:17 +0100 Subject: [PATCH] Run jsdoc on a custom babeling of the source jsdoc can't read our raw source, because of our dangling commas in function calls. On the other hand, running on /lib means that a lot of the useful information about exports is lost and you end up having to jump through hoops to get jsdoc to generate the right thing. This uses a separate run of babel (with all the presets turned off) to generate source which is almost identical to the input, but lacks trailing commas. (https://babeljs.io/blog/2015/10/31/setting-up-babel-6 says 'Babel 6 ships without any default transforms, so when you run Babel on a file it will just print it back out to you without changing anything.' - however, that is, empirically, not entirely true.) --- .gitignore | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 076209806..93fb23d2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -.jsdoc +/.jsdocbuild +/.jsdoc + node_modules .lock-wscript build/Release diff --git a/package.json b/package.json index 66b698840..387c11a27 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "test:run": "istanbul cover --report text --report cobertura --config .istanbul.yml -i \"lib/**/*.js\" _mocha -- --recursive specbuild --colors --reporter mocha-jenkins-reporter --reporter-options junit_report_path=reports/test-results.xml", "test": "npm run test:build && npm run test:run", "check": "npm run test:build && _mocha --recursive specbuild --colors", - "gendoc": "jsdoc -r lib -P package.json -R README.md -d .jsdoc", + "gendoc": "babel --no-babelrc -d .jsdocbuild src && jsdoc -r .jsdocbuild -P package.json -R README.md -d .jsdoc", "start": "babel -s -w -d lib src", "build": "babel -s -d lib src && rimraf dist && mkdir dist && browserify -d browser-index.js | exorcist dist/browser-matrix.js.map > dist/browser-matrix.js && uglifyjs -c -m -o dist/browser-matrix.min.js --source-map dist/browser-matrix.min.js.map --in-source-map dist/browser-matrix.js.map dist/browser-matrix.js", "dist": "npm run build",