docker-env.sh 940 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#!/bin/sh

# README
#
# You can source this file and use the commands defined below:
#
# . ./docker-env.sh
# setup
# dev

dockerrun(){
  P=/app/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  sudo docker run -u "$UID" -e PATH="$P" -v $PWD:/app -w /app "$@"
}

unalias npm yarn bower pulp repl &>/dev/null || :
unset   npm yarn bower pulp repl &>/dev/null || :

npm(){
  dockerrun node npm "$@"
}

yarn(){
  dockerrun node yarn "$@"
}

bower(){
  dockerrun node bower "$@"
}

dependencies(){
  dockerrun node psc-dependencies "$@"
}

package(){
  dockerrun node psc-package "$@"
}

pulp(){
40
  dockerrun node pulp --psc-package "$@"
41 42 43
}

repl(){
44 45 46 47 48
  dockerrun -ti node pulp --psc-package repl "$@"
}

check(){
  pulp test "$@"
49 50 51 52 53 54 55 56
}

setup(){
  yarn  install &&
  bower install
}

build(){
57
  pulp browserify --to dist/bundle.js
58 59 60 61 62 63 64 65 66
}

serve(){
  dockerrun node http-server -p 2015 --cors dist
}

dev(){
  build && serve
}