change to rollup-plugin-screeps
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
"rollup-plugin-clean": "^1.0.0",
|
"rollup-plugin-clean": "^1.0.0",
|
||||||
"rollup-plugin-commonjs": "^8.2.6",
|
"rollup-plugin-commonjs": "^8.2.6",
|
||||||
"rollup-plugin-node-resolve": "^3.0.0",
|
"rollup-plugin-node-resolve": "^3.0.0",
|
||||||
"rollup-plugin-screeps-upload": "git+https://github.com/ezolenko/rollup-plugin-screeps-upload.git#master",
|
"rollup-plugin-screeps": "0.0.0",
|
||||||
"rollup-plugin-typescript2": "^0.8.1",
|
"rollup-plugin-typescript2": "^0.8.1",
|
||||||
"tslint": "^5.8.0",
|
"tslint": "^5.8.0",
|
||||||
"typed-screeps": "^1.0.4",
|
"typed-screeps": "^1.0.4",
|
||||||
|
|||||||
@@ -1,37 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
import fs from "fs";
|
|
||||||
import path from "path";
|
|
||||||
import clean from "rollup-plugin-clean";
|
import clean from "rollup-plugin-clean";
|
||||||
import resolve from "rollup-plugin-node-resolve";
|
import resolve from "rollup-plugin-node-resolve";
|
||||||
import commonjs from "rollup-plugin-commonjs";
|
import commonjs from "rollup-plugin-commonjs";
|
||||||
import screepsUpload from "rollup-plugin-screeps-upload";
|
import screeps from "rollup-plugin-screeps";
|
||||||
import typescript from "rollup-plugin-typescript2";
|
import typescript from "rollup-plugin-typescript2";
|
||||||
|
|
||||||
// In Screeps, require only works for exported content
|
|
||||||
// This "plugin" prepends an export to source maps so that it can be loaded in screeps via require`
|
|
||||||
function exportSourceMaps(options) {
|
|
||||||
return {
|
|
||||||
name: "export-source-maps",
|
|
||||||
ongenerate: function (options, bundle) {
|
|
||||||
let tmp = bundle.map.toString;
|
|
||||||
|
|
||||||
delete bundle.map.sourcesContent;
|
|
||||||
|
|
||||||
bundle.map.toString = function () {
|
|
||||||
return "module.exports = " + tmp.apply(this, arguments) + ";";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onwrite: function () {
|
|
||||||
// Rename generated source file
|
|
||||||
fs.renameSync(
|
|
||||||
path.resolve(__dirname, "./dist", "main.js.map"),
|
|
||||||
path.resolve(__dirname, "./dist", options.filename || "main.js.map.js")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
input: "src/main.ts",
|
input: "src/main.ts",
|
||||||
output: {
|
output: {
|
||||||
@@ -46,7 +20,6 @@ export default {
|
|||||||
resolve(),
|
resolve(),
|
||||||
commonjs(),
|
commonjs(),
|
||||||
typescript({tsconfig: "./tsconfig.json"}),
|
typescript({tsconfig: "./tsconfig.json"}),
|
||||||
exportSourceMaps({filename: "./main.js.map.js"}),
|
screeps({configFile: "./screeps.json"})
|
||||||
screepsUpload("./screeps.json")
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,6 @@
|
|||||||
"protocol": "https",
|
"protocol": "https",
|
||||||
"hostname": "screeps.com",
|
"hostname": "screeps.com",
|
||||||
"port": 443,
|
"port": 443,
|
||||||
"path": "/"
|
"path": "/",
|
||||||
|
"branch": "auto"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user