docker-env.sh 1.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/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 "$@"
}

16 17 18 19 20 21
NODE=node:buster-garg

dockerrunnode(){
  dockerrun "$NODE" "$@"
}

22 23 24 25
unalias npm yarn bower pulp repl &>/dev/null || :
unset   npm yarn bower pulp repl &>/dev/null || :

npm(){
26
  dockerrunnode npm "$@"
27 28 29
}

yarn(){
30
  dockerrunnode yarn "$@"
31 32 33
}

bower(){
34
  dockerrunnode bower "$@"
35 36 37
}

dependencies(){
38
  dockerrunnode psc-dependencies "$@"
39 40 41
}

package(){
42
  dockerrunnode psc-package "$@"
43 44 45
}

pulp(){
46
  dockerrunnode pulp --psc-package "$@"
47 48 49
}

repl(){
50 51 52 53 54
  dockerrun -ti "$NODE" pulp --psc-package repl "$@"
}

sass(){
  dockerrunnode yarn sass
55 56 57 58
}

check(){
  pulp test "$@"
59 60
}

61 62 63 64
pscpackagehack(){
  cp $HOME/bin/psc-package node_modules/.bin
}

65
setup(){
66 67
  yarn install     &&
  yarn rebuild-set &&
68
  pscpackagehack   &&
69
  yarn install-ps
70 71 72
}

build(){
73 74 75 76 77 78 79
  echo prefer: compile
  yarn build
 #pulp browserify --to dist/bundle.js
}

compile(){
  yarn compile
80 81 82
}

serve(){
83 84 85
 #yarn dev
 #dockerrunnode http-server -p 2015 --cors dist
  dockerrunnode webpack-dev-server --env dev --mode development
86 87 88 89 90
}

dev(){
  build && serve
}