Skip to content

Commit 69b3433

Browse files
committed
0.6.0
1 parent 849c225 commit 69b3433

File tree

15 files changed

+69
-46
lines changed

15 files changed

+69
-46
lines changed

.babelrc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
2-
"presets": [ "es2016-node5", "stage-1" ],
2+
"presets": [ "grind" ],
33
"plugins": [
4-
"babel-plugin-import-auto-name",
5-
"babel-plugin-transform-isnil",
64
[
75
"babel-plugin-module-alias", [
86
{ "src": "./app", "expose": "App" },

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: node_js
22
node_js:
3-
- "5"
43
- "6"
4+
- "7"
55
sudo: false
6-
install: "npm install"
76
script: "bin/lint"

README.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ bin/cli db:seed
1515
```bash
1616
# Use `watch` to automatically restart the server on file changes
1717
# Watch is recommended for development
18-
bin/watch
18+
bin/cli watch
1919

2020
# Use `serve --cluster` to launch a cluster of workers
2121
# Cluster is recommended for production
22-
bin/serve --cluster
22+
bin/cli serve --cluster
2323

2424
# Use `serve` to launch a single worker
25-
bin/serve
25+
bin/cli serve
2626
```
2727

2828
You should now be able to go to [localhost:3000/states](http://localhost:3000/states).

bin/.init

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ cd "`dirname "$BASH_SOURCE"`"
77

88
WORKING_DIR=`pwd`
99

10-
if [ -d "$WORKING_DIR/../node_modules" ];
11-
then
10+
if [ -d "$WORKING_DIR/../node_modules" ]; then
1211
NODE_ROOT="$WORKING_DIR/../node_modules"
13-
elif [ -d "$WORKING_DIR/../node_modules" ];
14-
then
12+
elif [ -d "$WORKING_DIR/../../node_modules" ]; then
1513
NODE_ROOT="$WORKING_DIR/../../node_modules"
1614
else
1715
NODE_ROOT=`npm root`

bin/build

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,29 @@ source ${0%/*}/.init
44

55
strip_babel() {
66
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+
814
rm "$1-tmp"
915
}
1016

1117
echo "Cleaning up old build"
1218
rm -fr build
1319

1420
echo "Building"
21+
1522
mkdir build build/app build/boot
1623
babel -s inline -d build/app/ app/
1724
babel -s inline -d build/boot/ boot/
1825

1926
echo "Setting up bins"
2027
cp -R bin build/bin
21-
rm build/bin/build build/bin/lint build/bin/watch
28+
rm build/bin/build build/bin/lint
2229

23-
strip_babel build/bin/serve
2430
strip_babel build/bin/cli
2531
chmod +x build/bin/* build/bin/.init
2632

bin/cli

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,19 @@ popd > /dev/null
66

77
source ${0%/*}/.init
88

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

bin/serve

Lines changed: 0 additions & 5 deletions
This file was deleted.

bin/watch

Lines changed: 0 additions & 5 deletions
This file was deleted.

boot/Cli.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import {CliProvider} from 'grind-cli'
1+
import { CliProvider } from 'grind-cli'
22
import 'App/Providers/CommandsProvider'
33

44
const app = require('App/Bootstrap')
55
app.providers.push(CliProvider, CommandsProvider)
66

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+
})

boot/Http.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
import {HttpServer} from 'grind-framework'
1+
import { HttpServer } from 'grind-framework'
22

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+
})

0 commit comments

Comments
 (0)