generator-reshow 0.17.38 → 0.17.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,19 +4,34 @@ DIR=$(
4
4
  cd "$(dirname "$0")"
5
5
  pwd -P
6
6
  )
7
+ CHK_PHP=$(which php 2>/dev/null)
8
+ PHP_CONFIG=$DIR/cnfig/config.php
9
+ YO_CONFIG=$DIR/.yo
10
+ WEBPACK_SERVER_CONFIG="--config webpack.server.mjs"
11
+
7
12
  cd $DIR
8
- SWJS=${DIR}/service-worker.js
9
- webpackEnabled=$([ -e "$DIR/.yo" ] && awk -F "=" '/^webpackEnabled/ {print $2}' $DIR/.yo)
10
-
11
- conf='{'
12
- conf+='"assetsRoot":"./assets/",'
13
- conf+='"externals":{},'
14
- conf+='"indexTpl":"'${DIR}/index.tpl'",'
15
- conf+='"indexHtml":"'${DIR}/index.html'",'
16
- conf+='"swDest":"'${SWJS}'",'
17
- # conf+='"swDebug":true,'
18
- conf+='"hotPort": "'${hotPort:-3088}'"'
19
- conf+='}'
13
+ webpackEnabled=$([ -e "$YO_CONFIG" ] && awk -F "=" '/^webpackEnabled/ {print $2}' $YO_CONFIG)
14
+ serverEnabled=$([ -e "$YO_CONFIG" ] && awk -F "=" '/^serverEnabled/ {print $2}' $YO_CONFIG)
15
+ HTDOCS=${DIR}$([ -e "$YO_CONFIG" ] && awk -F "=" '/^HTDOCS/ {print $2}' $YO_CONFIG)
16
+ SWJS=${HTDOCS}/service-worker.js
17
+
18
+ if [ ! -z "$CHK_PHP" ] && [ -s "$PHP_CONFIG" ]; then
19
+ conf=`DUMP=cli php -r "include('$PHP_CONFIG');"`
20
+ else
21
+ conf='{'
22
+ conf+='"assetsRoot":"./assets/",'
23
+ conf+='"externals":{},'
24
+ if [ -z "$serverEnabled" ]; then
25
+ conf+='"indexTpl":"'${DIR}/index.tpl'",'
26
+ conf+='"indexHtml":"'${DIR}/index.html'",'
27
+ fi
28
+ conf+='"swDest":"'${SWJS}'",'
29
+ # conf+='"swDebug":true,'
30
+ conf+='"hotPort": "'${hotPort:-3088}'"'
31
+ conf+='}'
32
+ fi
33
+ echo $conf;
34
+
20
35
 
21
36
  OPEN=$(which xdg-open 2> /dev/null)
22
37
  if [ -z "$OPEN" ]; then
@@ -31,16 +46,6 @@ killBy() {
31
46
  ps -eo pid,args | grep $1 | grep -v grep | awk '{print $1}' | xargs -I{} kill -9 {}
32
47
  }
33
48
 
34
- stop() {
35
- killBy ${DIR}/node_modules/.bin/babel
36
- if [ ! -z "$webpack" ]; then
37
- cat webpack.pid | xargs -I{} kill -9 {}
38
- npm run clean:webpack
39
- fi
40
- [ -e "$SWJS" ] && rm $SWJS
41
- echo "Stop done"
42
- }
43
-
44
49
  stopServer() {
45
50
  killBy ${DIR}/node_modules/.bin/ws
46
51
  echo "stop server done"
@@ -63,12 +68,26 @@ startServer() {
63
68
  fi
64
69
  }
65
70
 
71
+ stop() {
72
+ killBy ${DIR}/node_modules/.bin/babel
73
+ if [ ! -z "$webpack" ]; then
74
+ cat webpack.pid | xargs -I{} kill -9 {}
75
+ npm run clean:webpack
76
+ rm $HTDOCS/workbox-*.js
77
+ fi
78
+ [ -e "$SWJS" ] && rm $SWJS
79
+ echo "Stop done"
80
+ }
81
+
66
82
  production() {
67
83
  stop
68
84
  echo "Production Mode"
69
85
  npm run build
70
86
  if [ ! -z "$webpack" ]; then
71
87
  ENABLE_SW=1 CONFIG=$conf NODE_ENV=production $webpack
88
+ if [ ! -z "$serverEnabled" ]; then
89
+ ENABLE_SW=1 CONFIG=$conf NODE_ENV=production $webpack $WEBPACK_SERVER_CONFIG
90
+ fi
72
91
  fi
73
92
  }
74
93
 
@@ -83,7 +102,7 @@ develop() {
83
102
  stop
84
103
  echo "Develop Mode"
85
104
  npm run build
86
- [ ! -z "$webpack" ] && CONFIG=$conf $webpack
105
+ [ ! -z "$webpack" ] && CONFIG=$conf $webpack && [ ! -z "$serverEnabled" ] CONFIG=$conf $webpack $WEBPACK_SERVER_CONFIG
87
106
  }
88
107
 
89
108
  watch() {
@@ -98,7 +117,15 @@ hot() {
98
117
  [ ! -z "$webpack" ] && sleep 10 && HOT_UPDATE=1 CONFIG=$conf $webpack serve &
99
118
  }
100
119
 
120
+ nodeTest(){
121
+ echo '{"themePath":"hello"}' | node ./server.js
122
+ echo ""
123
+ }
124
+
101
125
  case "$1" in
126
+ node)
127
+ nodeTest
128
+ ;;
102
129
  p)
103
130
  production
104
131
  ;;
@@ -30,7 +30,7 @@
30
30
  "webpack": "webpack",
31
31
  "start": "ws",
32
32
  "format": "prettier-eslint --write 'src/**/*.js'",
33
- "clean:webpack": "find ./assets -name '*.*' | xargs rm -rf && rm -rf workbox-*.js",
33
+ "clean:webpack": "find ./assets -name '*.*' | xargs rm -rf",
34
34
  "clean": "find ./build ./types -name '*.*' | xargs rm -rf",
35
35
  "build:cjs": "BABEL_ENV=cjs babel src -d build/cjs/src --ignore /**/__tests__<%= babelRootMode %>",
36
36
  "build:es": "BABEL_ENV=es babel src -d build/es/src --out-file-extension .mjs<%= babelRootMode %>",
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.17.38",
2
+ "version": "0.17.39",
3
3
  "name": "generator-reshow",
4
4
  "repository": {
5
5
  "type": "git",