Skip to content

Commit

Permalink
factor out then-fs and promise.finally
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Oct 7, 2016
1 parent 8055eec commit 2f3bae9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions lib/jsdoc-command.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict'
const arrayify = require('array-back')
const path = require('path')
const promiseFinally = require('promise.prototype.finally')
promiseFinally.shim()

/**
* @module jsdoc-command
Expand Down Expand Up @@ -53,12 +51,13 @@ class JsdocCommand {
if (this.output instanceof Promise) {
return this.output
.then(result => {
this.postExecute()
return result
})
.catch(err => {
this.postExecute()
throw err
})
.finally(() => this.postExecute())
} else {
this.postExecute()
return this.output
Expand Down Expand Up @@ -126,7 +125,7 @@ class JsdocCommand {
*/
readCache () {
if (this.cache) {
const fs = require('then-fs')
const fs = require('fs-then-native')
const promises = this.inputFileSet.files.map(file => fs.readFile(file, 'utf8'))
return Promise.all(promises)
.then(contents => {
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"cover": "istanbul cover ./node_modules/.bin/test-runner test/*.js && cat coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf coverage; echo"
},
"devDependencies": {
"babel-preset-es2015": "^6.14.0",
"babel-preset-es2015": "^6.16.0",
"collect-json": "^1.0.8",
"core-assert": "~0.2.0",
"core-assert": "~0.2.1",
"coveralls": "^2.11.14",
"jsdoc-to-markdown": "^2.0.0-alpha.8",
"rimraf": "^2.5.4",
Expand All @@ -38,12 +38,11 @@
"collect-all": "^1.0.2",
"core-js": "^2.4.1",
"feature-detect-es6": "^1.3.1",
"file-set": "^1.0.2",
"file-set": "^1.1.1",
"fs-then-native": "^0.1.0",
"jsdoc-75lb": "^3.5.6",
"object-to-spawn-args": "^1.1.0",
"promise.prototype.finally": "^2.0.1",
"temp-path": "^1.0.0",
"then-fs": "^2.0.0",
"walk-back": "^2.0.1"
},
"standard": {
Expand Down

0 comments on commit 2f3bae9

Please sign in to comment.