Skip to content

Commit

Permalink
modify entrypoints.ts to handle wildcards in package.json export node…
Browse files Browse the repository at this point in the history
… recursively
  • Loading branch information
Scott Agrimson authored and Scott Agrimson committed Mar 10, 2022
1 parent c44d86f commit 0681b9a
Show file tree
Hide file tree
Showing 2 changed files with 410 additions and 1 deletion.
12 changes: 11 additions & 1 deletion esinstall/src/entrypoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,17 @@ function* forEachWildcardEntry(
let valueDirectoryFullPath = path.join(cwd, valueDirectoryName);

if (existsSync(valueDirectoryFullPath)) {
let filesInDirectory = readdirSync(valueDirectoryFullPath).filter(
let directoryContents = readdirSync(valueDirectoryFullPath);
let directoriesInDirectory = directoryContents.filter(
(filepath) => statSync(path.join(valueDirectoryFullPath, filepath)).isDirectory(), // ignore directories
);

for (let directoryname of directoriesInDirectory) {
const nextdir = `${valueDirectoryName}/${directoryname}/*`;
yield * forEachWildcardEntry(nextdir, nextdir, cwd);
}

let filesInDirectory = directoryContents.filter(
(filepath) => statSync(path.join(valueDirectoryFullPath, filepath)).isFile(), // ignore directories
);

Expand Down
Loading

0 comments on commit 0681b9a

Please sign in to comment.