Skip to content

Commit bebc691

Browse files
olupfloydspace
authored andcommitted
fix(package): exclude complete bundle directory
1 parent cb57ba3 commit bebc691

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/pack-individually.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function packIndividually() {
4848

4949
// get a list of every function bundle
5050
const buildResults = this.buildResults;
51-
const bundlePathList = buildResults.map(b => b.bundlePath);
51+
const bundlePathList = buildResults.map(b => path.dirname(b.bundlePath));
5252

5353
// get a list of external dependencies already listed in package.json
5454
const externals = without<string>(this.buildOptions.exclude, this.buildOptions.external);
@@ -63,9 +63,9 @@ export async function packIndividually() {
6363
const startZip = Date.now();
6464
const name = func.name;
6565

66-
const excludedFiles = [
66+
const excludedFilesOrDirectory = [
6767
...excludedFilesDefault,
68-
...bundlePathList.filter(p => p !== bundlePath),
68+
...bundlePathList.filter(p => !bundlePath.startsWith(p)),
6969
];
7070

7171
// allowed external dependencies in the final zip
@@ -89,8 +89,8 @@ export async function packIndividually() {
8989
zip.pipe(output);
9090

9191
files.forEach((filePath: string) => {
92-
// exclude non individual files
93-
if (excludedFiles.includes(filePath)) return;
92+
// exclude non individual files based on file or dir path
93+
if (excludedFilesOrDirectory.find(p => filePath.startsWith(p))) return;
9494

9595
// exclude generated zip TODO:better logic
9696
if (filePath.endsWith('.zip')) return;

0 commit comments

Comments
 (0)