@cloudcannon/reader
Advanced tools
Comparing version 1.1.3 to 1.1.4
{ | ||
"name": "@cloudcannon/reader", | ||
"type": "module", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Parses config, files and folder structures to create a JSON file with information about sites made with any static site generator.", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -9,6 +9,16 @@ import chalk from 'chalk'; | ||
async function getCollectionFilePaths(collectionConfig, source) { | ||
const crawler = new fdir() | ||
let crawler = new fdir() | ||
.withBasePath() | ||
.filter((filePath, isDirectory) => !isDirectory && !filePath.includes('/_defaults.')); | ||
let crawlDirectory = join(source, collectionConfig.path); | ||
// Work around for https://github.com/thecodrr/fdir/issues/92 | ||
// Globbing on `.` doesn't work, so we crawl using the absolute CWD | ||
// and get the relative paths of results instead of the base paths. | ||
if ((crawlDirectory === '.' || crawlDirectory === './') && collectionConfig.glob) { | ||
crawler = crawler.withRelativePaths(); | ||
crawlDirectory = process.cwd(); | ||
} | ||
const glob = typeof collectionConfig.glob === 'string' | ||
@@ -23,3 +33,3 @@ ? [collectionConfig.glob] | ||
return crawler | ||
.crawl(join(source, collectionConfig.path)) | ||
.crawl(crawlDirectory) | ||
.withPromise(); | ||
@@ -26,0 +36,0 @@ } |
30734
458