Refactor the scripts to work as advertised

- Correct docs generation to always fetch its dependency
- Don't try to close a handle that's already been closed by other methods
- Allow the release script to actually be testable.
This commit is contained in:
Isiah Meadows 2019-08-17 15:22:35 -04:00
parent 30ad45caa1
commit 22e6d37a26
12 changed files with 483 additions and 241 deletions

View file

@ -20,18 +20,16 @@ function find(type) {
const line = remoteInfo.find((line) => regexp.test(line))
if (line == null) {
console.error(
"An upstream must be configured with both fetch and push!"
)
process.exit(1)
}
return {
branch: line.slice(0, line.indexOf("\t")),
return line == null ? undefined : {
remote: line.slice(0, line.indexOf("\t")),
repo: line.slice(line.lastIndexOf("\t") + 1, -(type.length + 3)),
}
}
exports.fetch = find("fetch")
exports.push = find("push")
if (exports.fetch == null) {
console.error("You must have an upstream to pull from!")
process.exit(1)
}