diff --git a/.gitignore b/.gitignore index 5f2bc5b..4a4e4a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ node_modules/ +public/assets/*.png +public/assets/*.json public/css/*.css public/js/*.js +public/favicon.ico build/*.png db.sqlite diff --git a/Makefile b/Makefile index 61a127d..36f767c 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ public/assets/portal-d-anim.png: public/assets/portal-a-anim.png convert $^ -modulate 100,100,50 $@ public/assets/%.json: assets/%.json - ln -s ../../$^ $@ + cp $^ $@ public/css/snek.css: src/less/snek.less $(wildcard src/less/*.less) node_modules/.bin/lessc $< $@ diff --git a/README.md b/README.md index e0c0ced..222974d 100644 --- a/README.md +++ b/README.md @@ -25,20 +25,14 @@ A "simple" Snake, done as my final JS class project ## Running the game (dev) - `git clone` this repo -- `npm install` the dependencies (this will also build the less and js and initialize the database) +- `npm install` the dependencies (this will also build the ressources and initialize the database) - `npm start` the server -- `make` every time you change something -## Running the game (prod, docker) +## Running the game (prod) - Get the [Dockerfile](https://gitdab.com/Codinget/Snek/raw/branch/master/Dockerfile) - `docker build` it - `docker run -it -p80:3000` the container - ideally, put it behind a reverse proxy -## Running the game (prod, direct) -- `git clone` this repo -- `npm install` the dependencies (this will also build the less and js and initialize the database) -- `npm start` the server - ## License [MIT](https://opensource.org/licenses/MIT) diff --git a/install.js b/install.js index b615f3f..1b8c370 100644 --- a/install.js +++ b/install.js @@ -1,19 +1,5 @@ const DB=require('better-sqlite3'); const fs=require('fs'); -const child_process=require('child_process'); -// prepare database -console.log('Preparing database'); -fs.unlinkSync('db.sqlite'); const db=new DB('db.sqlite'); db.exec(fs.readFileSync('init.sql', 'utf8')); - -// compile less -console.log('Compiling less'); -child_process.execFileSync('node_modules/.bin/lessc', ['src/less/snek.less', 'public/css/snek.css']); - -// merge js -console.log('Merging js'); -const jsFiles=fs.readdirSync('src/js').map(f => 'src/js/'+f); -const merged=child_process.execFileSync('node', ['mergejs.js', ...jsFiles]); -fs.writeFileSync('public/js/snek.js', merged); diff --git a/package.json b/package.json index 4f33ad3..6127cb3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "start": "node index.js", - "prepare": "node install.js" + "prepare": "rm -f db.sqlite && make clean all && node install.js" }, "repository": { "type": "git", diff --git a/public/assets/apple32.png b/public/assets/apple32.png deleted file mode 100644 index 8800630..0000000 Binary files a/public/assets/apple32.png and /dev/null differ diff --git a/public/assets/config.json b/public/assets/config.json deleted file mode 120000 index 6a04fc8..0000000 --- a/public/assets/config.json +++ /dev/null @@ -1 +0,0 @@ -../../assets/config.json \ No newline at end of file diff --git a/public/assets/door32.png b/public/assets/door32.png deleted file mode 100644 index 2e893d9..0000000 Binary files a/public/assets/door32.png and /dev/null differ diff --git a/public/assets/fire-anim.png b/public/assets/fire-anim.png deleted file mode 100644 index fd28b20..0000000 Binary files a/public/assets/fire-anim.png and /dev/null differ diff --git a/public/assets/hole-ts.png b/public/assets/hole-ts.png deleted file mode 100644 index 7485ab4..0000000 Binary files a/public/assets/hole-ts.png and /dev/null differ diff --git a/public/assets/icon256.png b/public/assets/icon256.png deleted file mode 100644 index 6e1eef0..0000000 Binary files a/public/assets/icon256.png and /dev/null differ diff --git a/public/assets/icon32.png b/public/assets/icon32.png deleted file mode 100644 index 0fc8052..0000000 Binary files a/public/assets/icon32.png and /dev/null differ diff --git a/public/assets/key32.png b/public/assets/key32.png deleted file mode 100644 index 6f31e9d..0000000 Binary files a/public/assets/key32.png and /dev/null differ diff --git a/public/assets/levelList.json b/public/assets/levelList.json deleted file mode 120000 index 158dc97..0000000 --- a/public/assets/levelList.json +++ /dev/null @@ -1 +0,0 @@ -../../assets/levelList.json \ No newline at end of file diff --git a/public/assets/metaConfig.json b/public/assets/metaConfig.json deleted file mode 120000 index bdf92b8..0000000 --- a/public/assets/metaConfig.json +++ /dev/null @@ -1 +0,0 @@ -../../assets/metaConfig.json \ No newline at end of file diff --git a/public/assets/oil32.png b/public/assets/oil32.png deleted file mode 100644 index 07b94bf..0000000 Binary files a/public/assets/oil32.png and /dev/null differ diff --git a/public/assets/peach-decay-anim.png b/public/assets/peach-decay-anim.png deleted file mode 100644 index 3c5a034..0000000 Binary files a/public/assets/peach-decay-anim.png and /dev/null differ diff --git a/public/assets/peach-rainbow-anim.png b/public/assets/peach-rainbow-anim.png deleted file mode 100644 index 19b0e4f..0000000 Binary files a/public/assets/peach-rainbow-anim.png and /dev/null differ diff --git a/public/assets/portal-a-anim.png b/public/assets/portal-a-anim.png deleted file mode 100644 index fca9642..0000000 Binary files a/public/assets/portal-a-anim.png and /dev/null differ diff --git a/public/assets/portal-b-anim.png b/public/assets/portal-b-anim.png deleted file mode 100644 index 9f5e6a5..0000000 Binary files a/public/assets/portal-b-anim.png and /dev/null differ diff --git a/public/assets/portal-c-anim.png b/public/assets/portal-c-anim.png deleted file mode 100644 index f9fe1c9..0000000 Binary files a/public/assets/portal-c-anim.png and /dev/null differ diff --git a/public/assets/portal-d-anim.png b/public/assets/portal-d-anim.png deleted file mode 100644 index 081cee8..0000000 Binary files a/public/assets/portal-d-anim.png and /dev/null differ diff --git a/public/assets/snake.json b/public/assets/snake.json deleted file mode 120000 index e5bb132..0000000 --- a/public/assets/snake.json +++ /dev/null @@ -1 +0,0 @@ -../../assets/snake.json \ No newline at end of file diff --git a/public/assets/spikes-ts.png b/public/assets/spikes-ts.png deleted file mode 100644 index f8ca63d..0000000 Binary files a/public/assets/spikes-ts.png and /dev/null differ diff --git a/public/assets/switch-ts.png b/public/assets/switch-ts.png deleted file mode 100644 index 7c48535..0000000 Binary files a/public/assets/switch-ts.png and /dev/null differ diff --git a/public/assets/wall32.png b/public/assets/wall32.png deleted file mode 100644 index 055dea6..0000000 Binary files a/public/assets/wall32.png and /dev/null differ diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index f04b3c3..0000000 Binary files a/public/favicon.ico and /dev/null differ