wallet-core/packages/taler-wallet-webextension/rollup.config.test.js

48 lines
1.0 KiB
JavaScript
Raw Normal View History

// rollup.config.js
import fs from 'fs';
import path from 'path';
import css from 'rollup-plugin-css-only';
import { makePlugins } from "./rollup.config"
function fromDir(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 fromDir(filename, regex);
}
else if (regex.test(filename)) {
return filename
}
}).filter(x => !!x)
return result
}
const tests = fromDir('./src', /.test.ts$/)
2022-03-23 21:50:06 +01:00
// .filter(t => t === 'src/wallet/DepositPage.test.ts')
.map(test => ({
input: test,
output: {
file: test.replace(/^src/, 'dist').replace(/\.ts$/, '.js'),
format: "iife",
exports: "none",
name: test,
},
plugins: [
...makePlugins(),
css({
output: 'walletEntryPoint.css',
}),
],
}))
export default [
...tests,
];