forked from bencbartlett/Overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
72 lines (63 loc) · 2.48 KB
/
rollup.config.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"use strict";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import progress from "rollup-plugin-progress";
import typescript from "rollup-plugin-typescript2";
import screeps from "rollup-plugin-screeps";
let cfg;
const dest = process.env.DEST;
if (!dest) {
console.log('\x1b[46m%s\x1b[0m \x1b[36m%s\x1b[0m', 'Compiling Overmind...', '(deploy destination: none)');
} else if ((cfg = require("./screeps")[dest]) == null) {
throw new Error("Invalid upload destination");
} else {
console.log('\x1b[46m%s\x1b[0m \x1b[36m%s\x1b[0m', 'Compiling Overmind...', `(deploy destination: ${dest})`);
}
const ignoreWarnings = ['commonjs-proxy',
'Circular dependency',
"The 'this' keyword is equivalent to 'undefined'",
"Use of eval is strongly discouraged"];
export default {
input: "src/main.ts",
plugins: [
progress({clearLine: true}),
resolve(),
commonjs({
namedExports: {
'src/Overmind_obfuscated': ['_Overmind'],
'screeps-profiler': ['profiler'],
'columnify': ['columnify']
}
}),
typescript({tsconfig: "./tsconfig.json"}),
screeps({config: cfg, dryRun: cfg == null})
],
onwarn: function (warning) {
// Skip default export warnings from using obfuscated overmind file in main
for (let ignoreWarning of ignoreWarnings) {
if (warning.toString().includes(ignoreWarning)) {
return;
}
}
// console.warn everything else
console.warn(warning.message);
},
treeshake: false,
output: {
file: "dist/main.js",
format: "cjs",
sourcemap: false,
banner: '//\n' +
'// ___________________________________________________________\n' +
'//\n' +
'// _____ _ _ _______ ______ _______ _____ __ _ ______\n' +
'// | | \\ / |______ |_____/ | | | | | \\ | | \\\n' +
'// |_____| \\/ |______ | \\_ | | | __|__ | \\_| |_____/\n' +
'//\n' +
'// _______________________ Screeps AI ________________________\n' +
'//\n' +
'//\n' +
'// Overmind repository: github.com/bencbartlett/overmind\n' +
'//\n'
},
}