diff --git a/.eslintrc.yml b/.eslintrc.yml index 5dd220c..39836ae 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,9 +1,6 @@ env: node: true -parserOptions: - ecmaVersion: 5 - globals: Uint8Array: false Uint16Array: false diff --git a/.ndocrc b/.ndocrc index 5fa0a66..a757c2e 100644 --- a/.ndocrc +++ b/.ndocrc @@ -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" diff --git a/package.json b/package.json index 62b69a7..a359b02 100644 --- a/package.json +++ b/package.json @@ -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": {} } diff --git a/support/build_doc.js b/support/build_doc.js new file mode 100644 index 0000000..aaf66fc --- /dev/null +++ b/support/build_doc.js @@ -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}"`);