Automate doc publish

This commit is contained in:
Vitaly Puzrin 2020-11-07 15:17:39 +03:00
parent 5b28b9ad26
commit 2613521920
4 changed files with 24 additions and 8 deletions

View file

@ -1,9 +1,6 @@
env:
node: true
parserOptions:
ecmaVersion: 5
globals:
Uint8Array: false
Uint16Array: false

View file

@ -1,10 +1,10 @@
#
# Common nodeca config
# Common config
################################################################################
--index "./README.md"
--package "./package.json"
--gh-ribbon "{package.homepage}"
--gh-ribbon "https://github.com/{package.repository}"
--output "doc"
--render "html"
--broken-links "throw"

View file

@ -8,7 +8,6 @@
"inflate",
"gzip"
],
"homepage": "https://github.com/nodeca/pako",
"contributors": [
"Andrei Tuputcyn (https://github.com/andr83)",
"Vitaly Puzrin (https://github.com/puzrin)",
@ -28,19 +27,24 @@
"lint": "eslint .",
"test": "npm run lint && mocha",
"coverage": "npm run lint && nyc mocha && nyc report --reporter html",
"build": "rollup -c"
"build": "rollup -c",
"doc": "node support/build_doc.js",
"gh-doc": "npm run doc && gh-pages -d doc -f",
"prepublishOnly": "npm run gh-doc"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"buffer-from": "^1.1.1",
"eslint": "^7.13.0",
"gh-pages": "^3.1.0",
"mocha": "^8.2.1",
"multiparty": "^4.1.3",
"ndoc": "^5.0.1",
"nyc": "^15.1.0",
"rollup": "^2.33.1",
"rollup-plugin-terser": "^7.0.2"
"rollup-plugin-terser": "^7.0.2",
"shelljs": "^0.8.4"
},
"dependencies": {}
}

15
support/build_doc.js Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env node
'use strict';
/* eslint-env es6 */
const shell = require('shelljs');
shell.rm('-rf', 'doc');
const head = shell.exec('git show-ref --hash HEAD').stdout.slice(0, 6);
const link_format = `https://github.com/{package.repository}/blob/${head}/{file}#L{line}`;
shell.exec(`node node_modules/.bin/ndoc --link-format "${link_format}"`);