add readme and change some scripts

This commit is contained in:
Zutatensuppe 2021-05-22 13:19:39 +02:00
parent 239c879649
commit 6474c2fd8c
15 changed files with 265 additions and 231 deletions

3
scripts/dev-frontend Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
npm run vite

8
scripts/dev-server Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
nodemon \
-x "node --experimental-specifier-resolution=node --loader ts-node/esm" \
-w src/server \
-w src/common \
src/server/main.ts \
-- -c config.json

8
scripts/fix_image.js → scripts/fix_image.ts Executable file → Normal file
View file

@ -1,8 +1,6 @@
#!/bin/env node
import GameCommon from '../common/GameCommon.js'
import { logger } from '../common/Util.js'
import GameStorage from '../server/GameStorage.js'
import GameCommon from '../src/common/GameCommon'
import { logger } from '../src/common/Util'
import GameStorage from '../src/server/GameStorage'
const log = logger('fix_image.js')

View file

@ -1,6 +1,6 @@
import GameCommon from '../common/GameCommon.js'
import { logger } from '../common/Util.js'
import GameStorage from '../server/GameStorage.js'
import GameCommon from '../src/common/GameCommon'
import { logger } from '../src/common/Util'
import GameStorage from '../src/server/GameStorage'
const log = logger('fix_tiles.js')

View file

@ -2,6 +2,6 @@
npm install
if [ ! -e "$RUN_DIR/server/config.js" ]; then
cp "$RUN_DIR/server/config.example.js" "$RUN_DIR/server/config.js"
if [ ! -e "$RUN_DIR/config.json" ]; then
cp "$RUN_DIR/config.example.json" "$RUN_DIR/config.json"
fi

View file

@ -1,9 +0,0 @@
#!/bin/env node
import Images from './../server/Images.js'
const images = Images.allImages()
images.forEach(async (image) => {
console.log(image)
Images.resizeImage(image.filename)
})

7
scripts/resize_images.ts Normal file
View file

@ -0,0 +1,7 @@
import Images from './../src/server/Images'
const images = Images.allImagesFromDisk('', 'date_asc')
images.forEach(async (image) => {
console.log(image)
Images.resizeImage(image.filename)
})

View file

@ -1,7 +1,7 @@
import fs from 'fs'
import Protocol from '../common/Protocol.js'
import { logger } from '../common/Util.js'
import { DATA_DIR } from '../server/Dirs.js'
import Protocol from '../src/common/Protocol'
import { logger } from '../src/common/Util'
import { DATA_DIR } from '../src/server/Dirs'
const log = logger('rewrite_logs')

View file

@ -1,11 +1,4 @@
#!/bin/sh
# TODO: add switch via param
# server for built files
cd "$RUN_DIR/build/server"
nodemon --max-old-space-size=64 main.js -c ../../config.json
# dev server
# npm run ts-node src/server/main.ts -- -c config.json
nodemon --max-old-space-size=64 build/server/main.js -c config.json

5
scripts/start Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh -e
"$RUN_BIN" install
"$RUN_BIN" build
"$RUN_BIN" server

3
scripts/ts Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh -e
node --experimental-specifier-resolution=node --loader ts-node/esm $@