diff --git a/.eslintrc.yml b/.eslintrc.yml index 94cde6dc7..40e1c5897 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -13,7 +13,8 @@ plugins: ignorePatterns: - src/_old/**/* - src/error_mapper/**/* - - rollup.config.js + - rollup_build.config.js + - rollup_deploy.config.js - dist/**/* rules: indent: diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 000000000..a34efb98a --- /dev/null +++ b/deploy.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +TEMP_FILE=temp/temp.js + +if [ -e TEMP_FILE ]; then + rm TEMP_FILE +fi + +yarn rollup -c rollup_build.config.js +java -jar compiler.jar --language_out ECMASCRIPT_2015 --js $TEMP_FILE --js_output_file dist/main.js +yarn rollup -c rollup_deploy.config.js + diff --git a/package.json b/package.json index 77946a7b9..6022755ae 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "ts-polyfill": "^3.8.2" }, "scripts": { - "deploy": "rollup -c && echo '\\007'", + "deploy": "./deploy.sh && echo '\\007'", "test": "jest && echo '\\007'" }, "jest": { diff --git a/rollup.config.js b/rollup_build.config.js similarity index 76% rename from rollup.config.js rename to rollup_build.config.js index 0c8ce5085..1f99e3680 100644 --- a/rollup.config.js +++ b/rollup_build.config.js @@ -4,7 +4,6 @@ import clean from "rollup-plugin-clean"; import resolve from "rollup-plugin-node-resolve"; import commonjs from "rollup-plugin-commonjs"; import typescript from "rollup-plugin-typescript2"; -import screeps from "rollup-plugin-screeps"; let cfg; const dest = process.env.DEST; @@ -17,16 +16,15 @@ if (!dest) { export default { input: "src/main.ts", output: { - file: "dist/main.js", + file: "temp/temp.js", format: "cjs", - sourcemap: true + sourcemap: false }, plugins: [ clean(), resolve(), commonjs(), - typescript({tsconfig: "./tsconfig.json"}), - screeps({config: cfg, dryRun: cfg == null}) + typescript({ tsconfig: "./tsconfig.json" }) ] } diff --git a/rollup_deploy.config.js b/rollup_deploy.config.js new file mode 100644 index 000000000..ee647218c --- /dev/null +++ b/rollup_deploy.config.js @@ -0,0 +1,24 @@ +"use strict"; + +import screeps from "rollup-plugin-screeps"; + +let cfg; +const dest = process.env.DEST; +if (!dest) { + console.log("No destination specified - code will be compiled but not uploaded"); +} else if ((cfg = require("./screeps")[dest]) == null) { + throw new Error("Invalid upload destination"); +} + +export default { + input: "dist/main.js", + output: { + file: "dist/main.js", + format: "cjs", + sourcemap: false + }, + + plugins: [ + screeps({config: cfg, dryRun: cfg == null}) + ] +} diff --git a/submodules/private b/submodules/private index b456bf0f9..2ad6b3854 160000 --- a/submodules/private +++ b/submodules/private @@ -1 +1 @@ -Subproject commit b456bf0f9d4f501f41b88ca500373198a7074401 +Subproject commit 2ad6b38545ef94285186bae6ea84f5f5939079f0