-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrollup.config.mjs
29 lines (26 loc) · 898 Bytes
/
rollup.config.mjs
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
'use strict';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import fs from 'fs';
import del from 'rollup-plugin-delete';
import screeps from 'rollup-plugin-screeps-world';
import typescript from 'rollup-plugin-typescript2';
let config;
const { DEST } = process.env;
if (!DEST) {
console.log('Compiling Screeps Autonomous Framework...');
} else if (!(config = JSON.parse(fs.readFileSync('./screeps.json'))[DEST])) {
throw new Error(`Upload destination "${DEST}" not found in screeps.json`);
}
/** @type {import('rollup').RollupOptions} */
export default {
input: 'src/main.ts',
output: { file: 'dist/main.js', format: 'cjs', sourcemap: true },
plugins: [
del({ targets: 'dist/*' }),
resolve({ rootDir: 'src' }),
commonjs(),
typescript({ tsconfig: './tsconfig.json' }),
screeps({ config, dryRun: !config })
]
};