mirror of https://github.com/Alia5/GlosSI
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
import typescript from '@rollup/plugin-typescript';
|
|
import { readdirSync, lstatSync } from 'fs';
|
|
import path from 'path';
|
|
|
|
const getFileListForDir = (dir) => {
|
|
return readdirSync(dir).map((file) => {
|
|
const absolute = path.resolve(dir, file);
|
|
if (file.endsWith('.ts')) {
|
|
return absolute;
|
|
}
|
|
if (lstatSync(absolute).isDirectory()) {
|
|
return getFileListForDir(absolute)
|
|
}
|
|
}).flat(999);
|
|
|
|
}
|
|
|
|
|
|
const tsPluginConf = typescript({
|
|
cacheDir: '.rollup.tscache'
|
|
});
|
|
|
|
export default [
|
|
{
|
|
input: 'src/GlosSITweaks.ts',
|
|
output: {
|
|
dir: 'dist',
|
|
sourcemap: "inline",
|
|
format: 'iife',
|
|
// name: 'GlosSITweaks' // don't use name; don't pollute global namespace
|
|
},
|
|
plugins: [tsPluginConf],
|
|
},
|
|
...getFileListForDir('src/Tweaks').map((file) => {
|
|
return {
|
|
input: file,
|
|
output: {
|
|
file: file.replace('src', 'dist').replace(/\.ts$/, '.js'),
|
|
sourcemap: "inline",
|
|
format: 'iife',
|
|
// name: path.basename(file).replace(/\.ts$/, '') // don't use name; don't pollute global namespace
|
|
},
|
|
plugins: [tsPluginConf],
|
|
}
|
|
})
|
|
]; |