-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
33 lines (26 loc) · 886 Bytes
/
rollup.config.js
File metadata and controls
33 lines (26 loc) · 886 Bytes
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
import typescript from '@rollup/plugin-typescript';
const ifDefPlugin = require('./vite-plugin-ifdef/index.js');
const path = require("path");
const fs = require('fs');
let srcImports = ['// autogenerated file CRUD-JS engine.'];
let srcExports = ['export default {'];
for(let fileName of fs.readdirSync(path.join(__dirname, './core/events'))) {
if(!fileName.startsWith('___')) {
const nodeName = fileName.replace(/\.ts$/gm, '');
srcImports.push('import ' + nodeName + ' from "./' + nodeName + '";');
srcExports.push('\t' + nodeName + ',');
}
}
srcExports.push("};");
let src = srcImports.concat(srcExports);
fs.writeFileSync(path.join(__dirname, './core/events/___index.ts'), src.join('\n'));
export default {
input: "./core/index.ts",
output: {
dir: 'build-prod',
format: 'cjs'
},
plugins: [ifDefPlugin(), typescript({
tsconfig: './tsconfig-prod.json'
})]
};