Skip to content

Commit 1b3599c

Browse files
committed
build system implemented
1 parent d3cb2f2 commit 1b3599c

4 files changed

Lines changed: 12 additions & 37 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ typings/
6363
# skip dist files
6464
dist
6565
package-lock.json
66-
target/build.js
66+
target*

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"description": "my entry for the #js13k 2018",
55
"main": "index.js",
66
"scripts": {
7-
"concat": "./scripts/concat.sh > target/build.js",
7+
"concat": "./scripts/concat.sh > dist/build.js",
8+
"clean": "rm target.zip; rm -rf dist/; rm -rf target/; mkdir -p dist target",
9+
"minify": "npx google-closure-compiler --compilation_level=ADVANCED_OPTIMIZATIONS --js=dist/build.js --js_output_file=dist/build.min.js",
10+
"gen": "cp src/index.html target/index.html && cp dist/build.min.js target/b.js",
11+
"zip": "cd target; zip -r ../target.zip .; cd ..; wc -c target.zip",
12+
"build": "export NODE_ENV=production; npm run clean && npm run concat && npm run minify && npm run gen && npm run zip",
813
"watch": "nodemon -e js,sh --watch src --watch scripts --exec npm run concat",
914
"liveserver": "mkdir -p target; cd target; live-server --no-browser",
1015
"start": "npm run watch & npm run liveserver"
@@ -25,5 +30,8 @@
2530
"devDependencies": {
2631
"live-server": "^1.2.0",
2732
"nodemon": "^1.18.3"
33+
},
34+
"dependencies": {
35+
"google-closure-compiler": "^20180805.0.0"
2836
}
2937
}

src/index.html

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1 @@
1-
<head>
2-
<title>JS13K 2018 @agar3s</title>
3-
<style>
4-
body{
5-
background:#333;
6-
margin:0;
7-
padding:0;
8-
}
9-
canvas{
10-
}
11-
#c{
12-
background: #fff;
13-
}
14-
#f{
15-
font-family:monospace;
16-
position:absolute;
17-
bottom:10px;
18-
left:10px;
19-
font-size:21px;
20-
color:#993;
21-
text-decoration:none;
22-
}
23-
#f:hover{
24-
color:#9aa;
25-
}
26-
</style>
27-
</head>
28-
<body allowfullscreen>
29-
<div id="d">
30-
<canvas id="c" width="320" height="240"></canvas>
31-
</div>
32-
<a href='#' id='f' title='fullscreen'>FullScreen</a>
33-
<script src="../dist/build.js"></script>
34-
</body>
1+
<head><title>JS13K 2018 @agar3s</title><style>body{background:#333;margin:0;padding:0;}#c{background: #fff;}#f{font-family:monospace;position:absolute;bottom:10px;left:10px;font-size:21px;color:#993;text-decoration:none;}#f:hover{color:#9aa;}</style></head><body allowfullscreen><div id="d"><canvas id="c" width="320" height="240"></canvas></div><a href='#' id='f' title='fullscreen'>FullScreen</a><script src="b.js"></script></body>

src/player.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ function Sprite() {
1010
}
1111
}
1212

13-
var player = new Sprite();
13+
var player = Sprite();

0 commit comments

Comments
 (0)