Skip to content

Commit

Permalink
Merge pull request patternfly#119 from wise-king-sullyman/fix-ts-in-dist
Browse files Browse the repository at this point in the history
fix(build): prevent index.ts file from being copied into dist
  • Loading branch information
jenny-s51 authored Nov 28, 2023
2 parents a8a63ce + d2e4d44 commit 070321a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/module/scripts/writeClassMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ function writeIndex(fileName) {
}
}

function isNotTS(file) {
const isTS = file.endsWith('.ts');
const isNotDeclaration = !file.endsWith('.d.ts');

if (isTS && isNotDeclaration) {
return false;
}

return true;
}

/**
* @param {any} classMaps Map of file names to classMaps
*/
Expand All @@ -65,10 +76,10 @@ function writeClassMaps(classMaps) {
copyFileSync(file, join(outDir, outPath));

ensureDirSync(esmDistDir);
copySync(outDir, esmDistDir);
copySync(outDir, esmDistDir, { filter: isNotTS });

ensureDirSync(jsDistDir);
copySync(outDir, jsDistDir);
copySync(outDir, jsDistDir, { filter: isNotTS });
});

// eslint-disable-next-line no-console
Expand Down

0 comments on commit 070321a

Please sign in to comment.