1
0
Fork 0

Removed tests from deployed build

This commit is contained in:
Michaël Lemaire 2018-03-08 22:48:33 +01:00
parent ce2b94fe83
commit e41cfa8299
4 changed files with 20 additions and 10 deletions

View file

@ -94,7 +94,6 @@ Common UI
Technical Technical
--------- ---------
* Remove testing code from optimized build
* Fix alpha being altered in atlases * Fix alpha being altered in atlases
* Pack sounds * Pack sounds
* Add toggles for shaders, automatically disable them if too slow, and initially disable them on mobile * Add toggles for shaders, automatically disable them if too slow, and initially disable them on mobile

View file

@ -33,9 +33,9 @@ function exec(command) {
/** /**
* Build app from typescript sources * Build app from typescript sources
*/ */
function ts() { function ts(dist = false) {
console.log("Building app..."); 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 * Trigger a single build
*/ */
function build() { function build(dist = false) {
return Promise.all([ return Promise.all([
ts(), ts(dist),
data(), data(),
vendors() vendors()
]); ]);
@ -172,14 +172,15 @@ function build() {
* Optimize the build for production * Optimize the build for production
*/ */
function optimize() { 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 * Deploy to production
*/ */
function deploy(task) { 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/") 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 * Run tests in karma, using freshly built app
*/ */
function test(task) { function test(task) {
return build().then(() => { return ts().then(() => {
return exec("karma start spec/support/karma.conf.js"); return exec("karma start spec/support/karma.conf.js");
}).then(() => { }).then(() => {
return exec("remap-istanbul -i out/coverage/coverage.json -o out/coverage -t html"); return exec("remap-istanbul -i out/coverage/coverage.json -o out/coverage -t html");

10
tsconfig.dist.json Normal file
View file

@ -0,0 +1,10 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"out": "out/build.dist.js",
"removeComments": true
},
"exclude": [
"src/**/*.spec.ts"
]
}

View file

@ -4,7 +4,7 @@
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"removeComments": true, "removeComments": false,
"preserveConstEnums": true, "preserveConstEnums": true,
"out": "out/build.js", "out": "out/build.js",
"strict": true, "strict": true,
@ -17,6 +17,6 @@
"target": "es5" "target": "es5"
}, },
"include": [ "include": [
"src" "src/**/*.ts"
] ]
} }