From 14e720de61dd59b47170919dcd9736ffeab997f1 Mon Sep 17 00:00:00 2001 From: mzabriskie Date: Tue, 16 Jun 2015 18:53:54 -0600 Subject: [PATCH] Supporting ES6 syntax via babel --- package.json | 3 ++- tasks/build | 15 ++++++++++++++- tasks/release | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 745c696..cecb3ea 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ }, "homepage": "https://github.com/mzabriskie/rackt-cli", "dependencies": { + "babel": "^5.5.8", "babel-core": "^5.5.6", "babel-loader": "^5.1.4", "karma": "^0.12.36", @@ -35,7 +36,7 @@ "minimist": "^1.1.1", "mocha": "^2.2.5", "react": "^0.13.3", - "rf-release": "^0.4.0", + "rf-release": "git@github.com:mzabriskie/rf-release.git", "webpack": "^1.9.10", "webpack-dev-server": "^1.9.0" } diff --git a/tasks/build b/tasks/build index e4ebfda..f5388b0 100755 --- a/tasks/build +++ b/tasks/build @@ -1,7 +1,20 @@ #!/bin/bash -e -BUILD="$RACKT_PATH/node_modules/.bin/webpack --devtool source-map --config $RACKT_PATH/webpack.build.js" +babel=$RACKT_PATH/node_modules/.bin/babel +webpack=$RACKT_PATH/node_modules/.bin/webpack +BUILD="$webpack --devtool source-map --config $RACKT_PATH/webpack.build.js" +# Clean old build +rm -rf build/ + +# Transpile ES6 +$babel -d build/lib ./lib + +# Generate bundle mkdir -p dist eval $BUILD eval "MINIFY=1 $BUILD" + +# Copy package +cp README.md build/ +node -p 'p=require("./package");p.main="lib/main.js";p.scripts=p.devDependencies=undefined;JSON.stringify(p,null,2)' > build/package.json diff --git a/tasks/release b/tasks/release index 459b015..4bf2bd2 100755 --- a/tasks/release +++ b/tasks/release @@ -6,5 +6,5 @@ if [ "$1" == "--preview" ] || [ "$1" == "-P" ] || [ "$1" == "-p" ]; then else # Release to npm $RACKT_PATH/tasks/build - $RACKT_PATH/node_modules/.bin/release + $RACKT_PATH/node_modules/.bin/release -f ./build fi