### Pimp the docs linter (and assorted changes) #### `scripts/lint-docs.js` - Add an optional cache for faster runs - Add a final report - Don't return anything from `exec()` - Cover more files #### `scripts/_command.js` - Look for a "--cache" option #### `package.json` scripts - Added `watch:lint-docs` - Added `cleanup:lint` to remove the eslint and lint-docs cache files - Changed `lint:docs` to use the `--cache` option - Added `test:js` so that we can run the test suite without the linter - Changed `test` to defer to `test:js` #### Actual lint fixes: - Bad link in a migration guide - The unicode dashes in the "https://en.wikipedia.org/wiki/Subject–verb–object" are not escaped by marked ### Some more lint-docs pimping #### `scripts/lint-docs.js` - some code reorg and cleanup (take a hint from the local coding conventions) - fix misc bugs - pass a User-Agent header to the requests - even nicer reporting #### `package.json` - bump the @babel/parser dep to the latest #### Docs - tweaks based on lints missed due to previous bugs ### Docs: use the github page for velocity.js, the home page has too many errors. Co-Authored-By: Isiah Meadows <contact@isiahmeadows.com>
37 lines
851 B
JavaScript
37 lines
851 B
JavaScript
"use strict"
|
|
|
|
process.on("unhandledRejection", function (e) {
|
|
process.exitCode = 1
|
|
if (!e.stdout || !e.stderr) throw e
|
|
console.error(e.stack)
|
|
|
|
if (e.stdout && e.stdout.length) {
|
|
console.error(e.stdout.toString("utf-8"))
|
|
}
|
|
if (e.stderr && e.stderr.length) {
|
|
console.error(e.stderr.toString("utf-8"))
|
|
}
|
|
|
|
// eslint-disable-next-line no-process-exit
|
|
process.exit()
|
|
})
|
|
|
|
module.exports = ({exec, watch}) => {
|
|
const index = process.argv.indexOf("--watch")
|
|
const useCache = process.argv.indexOf("--cache") >= 0
|
|
if (index >= 0) {
|
|
process.argv.splice(index, 1)
|
|
|
|
if (watch == null) {
|
|
console.error("Watching this script is not supported!")
|
|
// eslint-disable-next-line no-process-exit
|
|
process.exit(1)
|
|
}
|
|
|
|
watch()
|
|
} else {
|
|
Promise.resolve(exec({useCache})).then((code) => {
|
|
if (code != null) process.exitCode = code
|
|
})
|
|
}
|
|
}
|