Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): prevent index.ts file from being copied into dist #119

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading