diff options
Diffstat (limited to 'packages/anastasis-webui/build.mjs')
-rwxr-xr-x | packages/anastasis-webui/build.mjs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/packages/anastasis-webui/build.mjs b/packages/anastasis-webui/build.mjs index ebe914541..def8b1050 100755 --- a/packages/anastasis-webui/build.mjs +++ b/packages/anastasis-webui/build.mjs @@ -104,8 +104,31 @@ function copyFilesPlugin(options) { }; } +function getFilesInDirectory(startPath, regex) { + if (!fs.existsSync(startPath)) { + return; + } + const files = fs.readdirSync(startPath); + const result = files.flatMap(file => { + const filename = path.join(startPath, file); + + const stat = fs.lstatSync(filename); + if (stat.isDirectory()) { + return getFilesInDirectory(filename, regex); + } + else if (regex.test(filename)) { + return filename + } + }).filter(x => !!x) + + return result +} + +const allTestFiles = getFilesInDirectory(path.join(BASE, 'src'), /test.tsx?$/) +const entryPoints = ["src/index.ts", "src/stories.tsx", ...allTestFiles]; + export const buildConfig = { - entryPoints: ['src/index.ts', 'src/stories.tsx'], + entryPoints: [...entryPoints], bundle: true, outdir: 'dist', minify: false, |