-
-
Save mrmlnc/7758fdf422691da7040780132f75c5e4 to your computer and use it in GitHub Desktop.
fg@2 -> fg@3
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
diff --git a/index.js b/index.js | |
index 4043b28..0f3fc53 100644 | |
--- a/index.js | |
+++ b/index.js | |
@@ -2,7 +2,7 @@ | |
const fs = require('fs'); | |
const arrayUnion = require('array-union'); | |
const glob = require('glob'); | |
-const fastGlob = require('fast-glob'); | |
+const fastGlob = require('../../fast-glob'); | |
const dirGlob = require('dir-glob'); | |
const gitignore = require('./gitignore'); | |
@@ -22,7 +22,7 @@ const checkCwdOption = options => { | |
} | |
}; | |
-const getPathString = p => p instanceof fs.Stats ? p.path : p; | |
+const getPathString = (p, options) => (options.objectMode || options.stats) ? p.path : p; | |
const generateGlobTasks = (patterns, taskOptions) => { | |
patterns = arrayUnion([].concat(patterns)); | |
@@ -76,7 +76,7 @@ const getPattern = (task, fn) => task.options.expandDirectories ? globDirs(task, | |
const globToTask = task => glob => { | |
const {options} = task; | |
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) { | |
- options.ignore = dirGlob.sync(options.ignore); | |
+ options.ignore = dirGlob.sync(options.ignore).map(p => p.replace(/\\/g, '/')); | |
} | |
return { | |
@@ -110,9 +110,9 @@ const globby = (patterns, options) => { | |
return getFilter() | |
.then(filter => { | |
return getTasks | |
- .then(tasks => Promise.all(tasks.map(task => fastGlob(task.pattern, task.options)))) | |
+ .then(tasks => Promise.all(tasks.map(task => fastGlob(task.pattern.replace(/\\/g, '/'), task.options)))) | |
.then(paths => arrayUnion(...paths)) | |
- .then(paths => paths.filter(p => !filter(getPathString(p)))); | |
+ .then(paths => paths.filter(p => !filter(getPathString(p, options || {})))); | |
}); | |
}; | |
@@ -136,7 +136,7 @@ module.exports.sync = (patterns, options) => { | |
const filter = getFilter(); | |
return tasks.reduce( | |
- (matches, task) => arrayUnion(matches, fastGlob.sync(task.pattern, task.options)), | |
+ (matches, task) => arrayUnion(matches, fastGlob.sync(task.pattern.replace(/\\/g, '/'), task.options)), | |
[] | |
).filter(p => !filter(p)); | |
}; |
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
diff --git a/spec/helpers/nodeDefineJasmineUnderTest.js b/spec/helpers/nodeDefineJasmineUnderTest.js | |
index 739c20af..0ed0bee4 100644 | |
--- a/spec/helpers/nodeDefineJasmineUnderTest.js | |
+++ b/spec/helpers/nodeDefineJasmineUnderTest.js | |
@@ -13,10 +13,15 @@ | |
function getSourceFiles() { | |
var src_files = ['core/**/*.js', 'version.js'].map(function(file) { | |
- return path.join(__dirname, '../../', 'src/', file); | |
+ return file; | |
}); | |
- fg.sync(src_files).forEach(function(resolvedFile) { | |
+ var options = { | |
+ absolute: true, | |
+ cwd: path.join(__dirname, '..', '..', 'src') | |
+ }; | |
+ | |
+ fg.sync(src_files, options).forEach(function(resolvedFile) { | |
require(resolvedFile); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment