File tree Expand file tree Collapse file tree 15 files changed +69
-46
lines changed Expand file tree Collapse file tree 15 files changed +69
-46
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "presets" : [ " es2016-node5 " , " stage-1 " ],
2
+ "presets" : [ " grind " ],
3
3
"plugins" : [
4
- " babel-plugin-import-auto-name" ,
5
- " babel-plugin-transform-isnil" ,
6
4
[
7
5
" babel-plugin-module-alias" , [
8
6
{ "src" : " ./app" , "expose" : " App" },
Original file line number Diff line number Diff line change 1
1
language : node_js
2
2
node_js :
3
- - " 5"
4
3
- " 6"
4
+ - " 7"
5
5
sudo : false
6
- install : " npm install"
7
6
script : " bin/lint"
Original file line number Diff line number Diff line change @@ -15,14 +15,14 @@ bin/cli db:seed
15
15
``` bash
16
16
# Use `watch` to automatically restart the server on file changes
17
17
# Watch is recommended for development
18
- bin/watch
18
+ bin/cli watch
19
19
20
20
# Use `serve --cluster` to launch a cluster of workers
21
21
# Cluster is recommended for production
22
- bin/serve --cluster
22
+ bin/cli serve --cluster
23
23
24
24
# Use `serve` to launch a single worker
25
- bin/serve
25
+ bin/cli serve
26
26
```
27
27
28
28
You should now be able to go to [ localhost:3000/states] ( http://localhost:3000/states ) .
Original file line number Diff line number Diff line change @@ -7,11 +7,9 @@ cd "`dirname "$BASH_SOURCE"`"
7
7
8
8
WORKING_DIR=` pwd`
9
9
10
- if [ -d " $WORKING_DIR /../node_modules" ];
11
- then
10
+ if [ -d " $WORKING_DIR /../node_modules" ]; then
12
11
NODE_ROOT=" $WORKING_DIR /../node_modules"
13
- elif [ -d " $WORKING_DIR /../node_modules" ];
14
- then
12
+ elif [ -d " $WORKING_DIR /../../node_modules" ]; then
15
13
NODE_ROOT=" $WORKING_DIR /../../node_modules"
16
14
else
17
15
NODE_ROOT=` npm root`
Original file line number Diff line number Diff line change @@ -4,23 +4,29 @@ source ${0%/*}/.init
4
4
5
5
strip_babel () {
6
6
cp " $1 " " $1 -tmp"
7
- cat " $1 -tmp" | sed ' s/babel-node/node \-\-es_staging/g' > " $1 "
7
+
8
+ if [ $( node -e ' console.log(Number.parseFloat(process.version.substring(1)) >= 7)' ) == " true" ]; then
9
+ cat " $1 -tmp" | sed ' s/babel-node/node/g' | sed ' s/FLAGS=.*$/FLAGS="--harmony-async-await"/g' > " $1 "
10
+ else
11
+ cat " $1 -tmp" | sed ' s/babel-node/node/g' | sed ' s/FLAGS=.*$/FLAGS=""/g' > " $1 "
12
+ fi
13
+
8
14
rm " $1 -tmp"
9
15
}
10
16
11
17
echo " Cleaning up old build"
12
18
rm -fr build
13
19
14
20
echo " Building"
21
+
15
22
mkdir build build/app build/boot
16
23
babel -s inline -d build/app/ app/
17
24
babel -s inline -d build/boot/ boot/
18
25
19
26
echo " Setting up bins"
20
27
cp -R bin build/bin
21
- rm build/bin/build build/bin/lint build/bin/watch
28
+ rm build/bin/build build/bin/lint
22
29
23
- strip_babel build/bin/serve
24
30
strip_babel build/bin/cli
25
31
chmod +x build/bin/* build/bin/.init
26
32
Original file line number Diff line number Diff line change @@ -6,4 +6,19 @@ popd > /dev/null
6
6
7
7
source ${0%/* } /.init
8
8
9
- IN_CLI=true CLI_BIN=" $CLI_BIN " exec babel-node boot/Cli.js " $@ "
9
+ COMMAND=$1
10
+
11
+ if [[ " $@ " == * " --help" * ]]; then
12
+ COMMAND=" $COMMAND -help"
13
+ fi
14
+
15
+ FLAGS=$( node -e ' console.log(Number.parseFloat(process.version.substring(1)) >= 7 ? "--harmony-async-await" : "")' )
16
+
17
+ case $COMMAND in
18
+ watch) exec babel-node $FLAGS boot/Http.js --watch=app,config $@
19
+ ;;
20
+ serve) exec babel-node $FLAGS boot/Http.js $@
21
+ ;;
22
+ * ) IN_CLI=true CLI_BIN=" $CLI_BIN " exec babel-node $FLAGS boot/Cli.js " $@ "
23
+ ;;
24
+ esac
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- import { CliProvider } from 'grind-cli'
1
+ import { CliProvider } from 'grind-cli'
2
2
import 'App/Providers/CommandsProvider'
3
3
4
4
const app = require ( 'App/Bootstrap' )
5
5
app . providers . push ( CliProvider , CommandsProvider )
6
6
7
- app . boot ( ) . then ( ( ) => app . cli . run ( ) )
7
+ app . boot ( ) . then ( ( ) => app . cli . run ( ) ) . catch ( err => {
8
+ Log . error ( 'Boot Error' , err )
9
+ process . exit ( 1 )
10
+ } )
Original file line number Diff line number Diff line change 1
- import { HttpServer } from 'grind-framework'
1
+ import { HttpServer } from 'grind-framework'
2
2
3
- ( new HttpServer ( ( ) => require ( 'App/Bootstrap' ) ) ) . start ( )
3
+ ( new HttpServer ( ( ) => require ( 'App/Bootstrap' ) ) ) . start ( ) . catch ( err => {
4
+ Log . error ( 'Boot Error' , err )
5
+ process . exit ( 1 )
6
+ } )
You can’t perform that action at this time.
0 commit comments