-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
111 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict' | ||
|
||
/* eslint-env mocha */ | ||
|
||
const fse = require('..') | ||
|
||
const methods = [ | ||
'copy', | ||
'emptyDir', | ||
'ensureFile', | ||
'ensureDir', | ||
'ensureLink', | ||
'ensureSymlink', | ||
'mkdirs', | ||
'move', | ||
'readJson', | ||
'readJSON', | ||
'remove', | ||
'writeJson', | ||
'writeJSON' | ||
] | ||
|
||
describe('promise support', () => { | ||
methods.forEach(method => { | ||
it(method, done => { | ||
fse[method]().catch(() => done()) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
const u = require('universalify').fromCallback | ||
module.exports = { | ||
copy: require('./copy') | ||
copy: u(require('./copy')) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
'use strict' | ||
|
||
const u = require('universalify').fromCallback | ||
const jsonFile = require('./jsonfile') | ||
|
||
jsonFile.outputJsonSync = require('./output-json-sync') | ||
jsonFile.outputJson = require('./output-json') | ||
jsonFile.outputJson = u(require('./output-json')) | ||
// aliases | ||
jsonFile.outputJSONSync = require('./output-json-sync') | ||
jsonFile.outputJSON = require('./output-json') | ||
jsonFile.outputJSONSync = jsonFile.outputJSONSync | ||
jsonFile.outputJSON = jsonFile.outputJson | ||
jsonFile.writeJSON = jsonFile.writeJson | ||
jsonFile.writeJSONSync = jsonFile.writeJsonSync | ||
jsonFile.readJSON = jsonFile.readJson | ||
jsonFile.readJSONSync = jsonFile.readJsonSync | ||
|
||
module.exports = jsonFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
'use strict' | ||
|
||
const u = require('universalify').fromCallback | ||
const jsonFile = require('jsonfile') | ||
|
||
module.exports = { | ||
// jsonfile exports | ||
readJson: jsonFile.readFile, | ||
readJSON: jsonFile.readFile, | ||
readJson: u(jsonFile.readFile), | ||
readJsonSync: jsonFile.readFileSync, | ||
readJSONSync: jsonFile.readFileSync, | ||
writeJson: jsonFile.writeFile, | ||
writeJSON: jsonFile.writeFile, | ||
writeJsonSync: jsonFile.writeFileSync, | ||
writeJSONSync: jsonFile.writeFileSync | ||
writeJson: u(jsonFile.writeFile), | ||
writeJsonSync: jsonFile.writeFileSync | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
'use strict' | ||
const u = require('universalify').fromCallback | ||
const mkdirs = u(require('./mkdirs')) | ||
const mkdirsSync = require('./mkdirs-sync') | ||
|
||
module.exports = { | ||
mkdirs: require('./mkdirs'), | ||
mkdirsSync: require('./mkdirs-sync'), | ||
mkdirs: mkdirs, | ||
mkdirsSync: mkdirsSync, | ||
// alias | ||
mkdirp: require('./mkdirs'), | ||
mkdirpSync: require('./mkdirs-sync'), | ||
ensureDir: require('./mkdirs'), | ||
ensureDirSync: require('./mkdirs-sync') | ||
mkdirp: mkdirs, | ||
mkdirpSync: mkdirsSync, | ||
ensureDir: mkdirs, | ||
ensureDirSync: mkdirsSync | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
'use strict' | ||
|
||
const u = require('universalify').fromCallback | ||
const rimraf = require('./rimraf') | ||
|
||
function removeSync (dir) { | ||
return rimraf.sync(dir, {disableGlob: true}) | ||
} | ||
|
||
function remove (dir, callback) { | ||
const options = {disableGlob: true} | ||
return callback ? rimraf(dir, options, callback) : rimraf(dir, options, function () {}) | ||
} | ||
|
||
module.exports = { | ||
remove, | ||
removeSync | ||
remove: u(rimraf), | ||
removeSync: rimraf.sync | ||
} |