Compare commits

..

No commits in common. "200c716393dcaf2db75bacb3a9f627f38cea0992" and "3e8eb69329af84451d28efeb13222cba29bae693" have entirely different histories.

27 changed files with 7 additions and 28 deletions

3
.gitignore vendored
View file

@ -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

View file

@ -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 $< $@

View file

@ -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)

View file

@ -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);

View file

@ -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",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

View file

@ -1 +0,0 @@
../../assets/config.json

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -1 +0,0 @@
../../assets/levelList.json

View file

@ -1 +0,0 @@
../../assets/metaConfig.json

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

View file

@ -1 +0,0 @@
../../assets/snake.json

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB