diff --git a/TODO.md b/TODO.md index 20a1d8b..e429670 100644 --- a/TODO.md +++ b/TODO.md @@ -94,7 +94,6 @@ Common UI Technical --------- -* Remove testing code from optimized build * Fix alpha being altered in atlases * Pack sounds * Add toggles for shaders, automatically disable them if too slow, and initially disable them on mobile diff --git a/runfile.js b/runfile.js index e35c86e..be4ace9 100644 --- a/runfile.js +++ b/runfile.js @@ -33,9 +33,9 @@ function exec(command) { /** * Build app from typescript sources */ -function ts() { +function ts(dist = false) { console.log("Building app..."); - return exec("tsc -p ."); + return exec(`tsc -p ${dist ? "./tsconfig.dist.json" : "."}`); } /** @@ -160,9 +160,9 @@ function watch_vendors() { /** * Trigger a single build */ -function build() { +function build(dist = false) { return Promise.all([ - ts(), + ts(dist), data(), vendors() ]); @@ -172,14 +172,15 @@ function build() { * Optimize the build for production */ function optimize() { - return exec("uglifyjs out/build.js --source-map --output out/build.min.js"); + // TODO do not overwrite dev build + return exec("uglifyjs out/build.dist.js --source-map --output out/build.js"); } /** * Deploy to production */ function deploy(task) { - return build().then(optimize).then(() => { + return build(true).then(optimize).then(() => { return exec("rsync -avz --delete ./out/ hosting.thunderk.net:/srv/website/spacetac/") }); } @@ -188,7 +189,7 @@ function deploy(task) { * Run tests in karma, using freshly built app */ function test(task) { - return build().then(() => { + return ts().then(() => { return exec("karma start spec/support/karma.conf.js"); }).then(() => { return exec("remap-istanbul -i out/coverage/coverage.json -o out/coverage -t html"); diff --git a/tsconfig.dist.json b/tsconfig.dist.json new file mode 100644 index 0000000..da0a91e --- /dev/null +++ b/tsconfig.dist.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "out": "out/build.dist.js", + "removeComments": true + }, + "exclude": [ + "src/**/*.spec.ts" + ] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 2183898..b265a5f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, - "removeComments": true, + "removeComments": false, "preserveConstEnums": true, "out": "out/build.js", "strict": true, @@ -17,6 +17,6 @@ "target": "es5" }, "include": [ - "src" + "src/**/*.ts" ] } \ No newline at end of file