1
0
Fork 0

Switch back to npm

This commit is contained in:
Michaël Lemaire 2018-03-06 18:59:36 +01:00
parent b4fff901cd
commit ca52167809
8 changed files with 5616 additions and 3938 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
.env
.venv
coverage
/node_modules
/out/vendor

View File

@ -1,7 +1,9 @@
language: node_js
sudo: false
cache: yarn
node_js:
- "6"
- "node"
after_success:
- yarn run codecov
- npm run codecov
cache:
directories:
- "node_modules"

View File

@ -16,17 +16,21 @@
## How to develop
The only hard dependency of the toolchain is [yarn](https://yarnpkg.com).
The only hard dependency of the toolchain is Node.js (with npm).
If yarn is not installed on your system but Python3 is, yarn will be automatically installed in a local virtual environment.
If Node.js is not installed on your system but Python3 is, you can use the following commands to (de)activate a virtual
and local Node.js environment:
source activate_node # From now on, "npm" command will be the one from virtual environment
deactivate_node # This restores the environment as before the "source" command
If you want to build on your computer, clone the repository, then run:
./spacetac install # Install dependencies
./spacetac run build # Build the final JS
./spacetac run atlas # Pack the images and sounds
./spacetac test # Run unit tests
./spacetac start # Start development server, and open game in web browser
npm install # Install dependencies
npm run build # Build the final JS
npm run atlas # Pack the images and sounds
npm test # Run unit tests
npm start # Start development server, and open game in web browser
## Credits

14
activate_node Normal file
View File

@ -0,0 +1,14 @@
# Activation script for virtual nodejs environment
# Usage:
# source activate_node
if [ \! -f "./activate_node" ]
then
echo "Not in project directory"
exit 1
fi
vdir="./.venv"
test -x "${vdir}/bin/nodeenv" || ( virtualenv -p python3 "${vdir}" && "${vdir}/bin/pip" install --upgrade nodeenv )
test -e "${vdir}/node/bin/activate" || "${vdir}/bin/nodeenv" --node=9.3.0 --force "${vdir}/node"
source "${vdir}/node/bin/activate"

5585
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@
"description": "A tactical RPG set in space",
"main": "src/build.js",
"scripts": {
"shell": "${SHELL} || true",
"postinstall": "rm -rf out/vendor && mkdir -p out/vendor && cp -r node_modules/phaser/build out/vendor/phaser && cp -r node_modules/parse/dist out/vendor/parse && cp -r node_modules/jasmine-core/lib/jasmine-core out/vendor/jasmine",
"build": "tsc -p .",
"atlas": "rm -f out/assets/atlas* && find graphics/exported -name '*.png' -print0 | xargs -0 gf-pack --name out/assets/atlas --fullpath --width 1024 --height 1024 --square --powerOfTwo --trim --padding 2",

View File

@ -1,19 +0,0 @@
#!/bin/bash
# Main build/run tool
# REQUIRES yarn
# If yarn is not found, python3 may be used to create a local node.js environment with yarn in it, and use it
yarn=$(which yarn 2>/dev/null)
set -e
if [ "x${yarn}" != "x" ]
then
"${yarn}" "$@"
else
dir=$(dirname $0)
test -x "${dir}/.env/bin/nodeenv" || ( virtualenv -p python3 "${dir}/.env" && "${dir}/.env/bin/pip" install --upgrade nodeenv )
test -e "${dir}/.env/node/bin/activate" || "${dir}/.env/bin/nodeenv" --node=9.3.0 --force "${dir}/.env/node"
test -e "${dir}/.env/node/bin/yarn" || "${dir}/.env/node/bin/shim" "${dir}/.env/node/bin/npm" install -g yarn@1.3.2
PATH="${dir}/.env/node/bin:${PATH}" yarn "$@"
fi

3907
yarn.lock

File diff suppressed because it is too large Load Diff