update fileTreeToObject method

This commit is contained in:
Philipp Kunz 2017-04-30 15:37:34 +02:00
parent 06fb0acd52
commit a5b24a7c33
3 changed files with 29 additions and 22 deletions

14
dist/smartfile.fs.js vendored

File diff suppressed because one or more lines are too long

View File

@ -209,13 +209,21 @@ export let toStringSync = function (filePath: string) {
}
export let fileTreeToObject = async (dirPathArg: string, miniMatchFilter: string) => {
let fileTree = await listFileTree(dirPathArg, miniMatchFilter)
// handle absolute miniMatchFilter
let dirPath: string
if (plugins.path.isAbsolute(miniMatchFilter)) {
dirPath = '/'
} else {
dirPath = dirPathArg
}
let fileTree = await listFileTree(dirPath, miniMatchFilter)
let smartfileArray: Smartfile[] = []
for (let filePath of fileTree) {
smartfileArray.push(new Smartfile({
path: filePath,
contentBuffer: new Buffer(toStringSync(
plugins.path.join(dirPathArg, filePath)
plugins.path.join(dirPath, filePath)
))
}))
}

View File

@ -33,11 +33,7 @@
version "0.0.27"
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
"@types/q@0.0.32":
version "0.0.32"
resolved "https://registry.yarnpkg.com/@types/q/-/q-0.0.32.tgz#bd284e57c84f1325da702babfc82a5328190c0c5"
"@types/through2@^2.0.31":
"@types/through2@^2.0.32":
version "2.0.32"
resolved "https://registry.yarnpkg.com/@types/through2/-/through2-2.0.32.tgz#470024450f1ab7640f19f9ebf42d3da574c26129"
dependencies:
@ -191,14 +187,13 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6:
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
gulp-function@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/gulp-function/-/gulp-function-2.2.3.tgz#8f62de74ce74de3fa91c48ba247472c1f56873bd"
version "2.2.6"
resolved "https://registry.yarnpkg.com/gulp-function/-/gulp-function-2.2.6.tgz#e14c1eefdab4d4ac11d9f4abfdbe94115a12d10d"
dependencies:
"@types/q" "0.0.32"
"@types/through2" "^2.0.31"
q "^1.4.1"
through2 "^2.0.1"
typings-global "^1.0.14"
"@types/through2" "^2.0.32"
smartq "^1.1.1"
through2 "^2.0.3"
typings-global "^1.0.16"
home@^1.0.1:
version "1.0.1"
@ -310,10 +305,6 @@ process-nextick-args@^1.0.6, process-nextick-args@~1.0.6:
version "1.0.7"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3"
q@^1.4.1:
version "1.5.0"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
readable-stream@^2.0.2, readable-stream@^2.1.5:
version "2.2.9"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.9.tgz#cf78ec6f4a6d1eb43d26488cac97f042e74b7fc8"
@ -440,7 +431,7 @@ tapbundle@^1.0.10:
smartq "^1.1.1"
typings-global "^1.0.16"
through2@^2.0.1:
through2@^2.0.1, through2@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
dependencies: