Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readdirp to address deprecation, inline noop2, and update minor versions #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const eos = require('end-of-stream')
const readdirp = require('readdirp')
const assert = require('assert')
const mkdirp = require('mkdirp')
const noop = require('noop2')
const path = require('path')
const pump = require('pump')
const fs = require('graceful-fs')
Expand All @@ -16,7 +15,7 @@ module.exports = copyTemplateDir
// (str, str, obj, fn) -> null
function copyTemplateDir (srcDir, outDir, vars, cb) {
if (!cb) {
if (!vars) vars = noop
if (!vars) vars = function () {}
cb = vars
vars = {}
}
Expand All @@ -30,7 +29,7 @@ function copyTemplateDir (srcDir, outDir, vars, cb) {
mkdirp(outDir, function (err) {
if (err) return cb(err)

const rs = readdirp({ root: srcDir })
const rs = readdirp(srcDir)
const streams = []
const createdFiles = []

Expand All @@ -57,7 +56,7 @@ function writeFile (outDir, vars, file) {
return function (done) {
const fileName = file.path
const inFile = file.fullPath
const parentDir = file.parentDir
const parentDir = path.dirname(file.path)
const outFile = path.join(outDir, maxstache(removeUnderscore(fileName), vars))

mkdirp(path.join(outDir, maxstache(parentDir, vars)), function (err) {
Expand Down
29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,22 @@
],
"license": "MIT",
"dependencies": {
"end-of-stream": "^1.1.0",
"graceful-fs": "^4.1.3",
"maxstache": "^1.0.0",
"maxstache-stream": "^1.0.0",
"mkdirp": "^0.5.1",
"noop2": "^2.0.0",
"pump": "^1.0.0",
"readdirp": "^2.0.0",
"run-parallel": "^1.1.4"
"end-of-stream": "^1.4.4",
"graceful-fs": "^4.2.11",
"maxstache": "^1.0.7",
"maxstache-stream": "^1.0.4",
"mkdirp": "^0.5.6",
"pump": "^1.0.3",
"readdirp": "^3.6.0",
"run-parallel": "^1.2.0"
},
"devDependencies": {
"concat-stream": "^1.5.0",
"dependency-check": "^2.5.1",
"istanbul": "^0.3.21",
"rimraf": "^2.4.3",
"standard": "^5.3.1",
"tape": "^4.2.0"
"concat-stream": "^1.6.2",
"dependency-check": "^2.10.1",
"istanbul": "^0.3.22",
"rimraf": "^2.7.1",
"standard": "^17.1.0",
"tape": "^4.16.2"
},
"files": [
"index.js",
Expand Down
8 changes: 4 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test('should write a bunch of files', function (t) {
return path.relative(outDir, filePath)
}), 'reported as created')

readdirp({ root: outDir }).pipe(concat({ object: true }, function (arr) {
readdirp(outDir).pipe(concat({ object: true }, function (arr) {
t.ok(Array.isArray(arr), 'is array')

const names = arr.map(function (file) { return file.path })
Expand All @@ -61,7 +61,7 @@ test('should inject context variables strings', function (t) {
copy(inDir, outDir, { foo: 'bar' }, function (err) {
t.error(err)

readdirp({ root: outDir }).pipe(concat({ object: true }, function (arr) {
readdirp(outDir).pipe(concat({ object: true }, function (arr) {
t.ok(Array.isArray(arr), 'is array')

const file = path.join(outDir, '1.txt')
Expand All @@ -87,7 +87,7 @@ test('should inject context variables strings into filenames', function (t) {
copy(inDir, outDir, { foo: 'bar' }, function (err) {
t.error(err)

readdirp({ root: outDir }).pipe(concat({ object: true }, function (arr) {
readdirp(outDir).pipe(concat({ object: true }, function (arr) {
t.ok(Array.isArray(arr), 'is array')

const file = path.join(outDir, 'bar.txt')
Expand All @@ -110,7 +110,7 @@ test('should inject context variables strings into directory names', function (t
copy(inDir, outDir, { foo: 'bar' }, function (err) {
t.error(err)

readdirp({ root: outDir }).pipe(concat({ object: true }, function (arr) {
readdirp(outDir).pipe(concat({ object: true }, function (arr) {
t.ok(Array.isArray(arr), 'is array')

const dir = path.join(outDir, 'bar')
Expand Down