@travetto/base
Advanced tools
Comparing version 0.0.63 to 0.0.64
@@ -19,3 +19,3 @@ { | ||
"scripts": {}, | ||
"version": "0.0.63" | ||
"version": "0.0.64" | ||
} |
@@ -41,5 +41,9 @@ import * as path from 'path'; | ||
for (const file of (await fsReaddir(base))) { | ||
if (file.startsWith('.')) { | ||
continue; | ||
} | ||
const full = `${curBase}${path.sep}${file}`; | ||
const stats = await fsStat(full); | ||
const entry: Entry = { stats, file }; | ||
const entry: Entry = { stats, file: full }; | ||
@@ -52,3 +56,3 @@ if (stats.isDirectory()) { | ||
} | ||
} else if (handler.test(entry.file.replace(base, ''), entry)) { | ||
} else if (handler.test(entry.file.replace(base + path.sep, ''), entry)) { | ||
out.push(entry); | ||
@@ -85,5 +89,9 @@ } | ||
for (const file of fs.readdirSync(relBase)) { | ||
if (file.startsWith('.')) { | ||
continue; | ||
} | ||
const full = `${relBase}${path.sep}${file}`; | ||
const stats = fs.lstatSync(full); | ||
const entry: Entry = { stats, file }; | ||
const entry: Entry = { stats, file: full }; | ||
@@ -96,3 +104,3 @@ if (stats.isDirectory()) { | ||
} | ||
} else if (handler.test(entry.file.replace(base, ''))) { | ||
} else if (handler.test(entry.file.replace(base + path.sep, ''))) { | ||
out.push(entry); | ||
@@ -113,3 +121,5 @@ } | ||
const files = await bulkFind(handlers); | ||
const promises = files.map(x => fsReadFileAsync(x.file).then(d => ({ name: x.file, data: d.toString() }))); | ||
const promises = files | ||
.filter(x => !x.stats.isDirectory()) | ||
.map(x => fsReadFileAsync(x.file).then(d => ({ name: x.file, data: d.toString() }))); | ||
return await Promise.all(promises); | ||
@@ -119,4 +129,5 @@ } | ||
export function bulkReadSync(handlers: Handler[]) { | ||
const files = bulkFindSync(handlers); | ||
return files.map(x => ({ name: x.file, data: fs.readFileSync(x.file).toString() })); | ||
return bulkFindSync(handlers) | ||
.filter(x => !x.stats.isDirectory()) | ||
.map(x => ({ name: x.file, data: fs.readFileSync(x.file).toString() })); | ||
} |
@@ -8,4 +8,4 @@ import { AppEnv } from './env'; | ||
bulkRequire<{ init: { action: Function, priority?: number } }>([ | ||
/^node_modules\/@travetto\/.*\/bootstrap.ts$/, | ||
/^bootstrap.ts$/ | ||
/^node_modules\/@travetto\/.*\/bootstrap[.]ts$/, | ||
/^bootstrap[.]ts$/ | ||
]) | ||
@@ -12,0 +12,0 @@ .map(x => x.init) |
@@ -6,3 +6,3 @@ export function isPrimitive(el: any): el is (string | boolean | number | RegExp) { | ||
export function isPlainObject(obj: any): obj is object { | ||
export function isPlainObject(obj: any): obj is { [key: string]: any } { | ||
return typeof obj === 'object' // separate from primitives | ||
@@ -9,0 +9,0 @@ && obj !== undefined |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24912
788