-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.ts
39 lines (33 loc) · 1.06 KB
/
rollup.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sourceMaps from 'rollup-plugin-sourcemaps';
const path = require('path');
const fs = require('fs');
const inputBasePath = 'es';
const outputBasePath = 'dist';
function createBundleConfig(input, outputName = undefined, bundleName = undefined) {
const inputFile = path.join(inputBasePath, input);
const outFile = path.join(outputBasePath, outputName || input);
return {
input: inputFile,
output: {
file: outFile,
format: "umd"
},
sourcemap: true,
name: bundleName,
plugins: [
sourceMaps()
]
}
}
const examples = fs.readdirSync('examples').map(exampleDir => {
const example = path.join('examples', exampleDir, 'index.ts');
if (fs.existsSync(example)) {
return example.replace('.ts', '.js');
}
}).filter(exampleFile => !!exampleFile);
const exampleConfigs = examples.map(input => createBundleConfig(input));
export default [
createBundleConfig('spui/index.js', 'spui.js', 'spui'),
createBundleConfig('tests/spec.js'),
...exampleConfigs
]