From 52e37e8612dbcd9b566a07ccfc94c9c02731a329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Tegn=C3=A9r?= Date: Sun, 12 Jun 2016 19:15:04 +0200 Subject: [PATCH] Put local node_modules/.bin in PATH, fixes #22 --- bin/rackt | 6 ++++++ karma.conf.js | 2 +- tasks/build | 6 ++---- tasks/init | 4 +--- tasks/pages | 2 +- tasks/release | 4 ++-- tasks/server | 4 +--- tasks/test | 7 ++----- webpack.build.js | 2 +- webpack.config.js | 2 +- 10 files changed, 18 insertions(+), 21 deletions(-) diff --git a/bin/rackt b/bin/rackt index 0345f8b..8a8788a 100755 --- a/bin/rackt +++ b/bin/rackt @@ -25,6 +25,12 @@ cd "`dirname "${SCRIPT_PATH}"`" > /dev/null SCRIPT_PATH="`pwd`"; popd > /dev/null +# put local module binaries first in PATH, to 1) enable the +# shell scripts to find them, and 2) ensure they are loaded +# before any other (parent) binaries since npm will put +# parent node_modules in PATH when run via npm run +export PATH="${SCRIPT_PATH}/../node_modules/.bin:${PATH}" + # get the path to the task TASK_PATH=$SCRIPT_PATH/../tasks/$TASK diff --git a/karma.conf.js b/karma.conf.js index afc5b5f..c00f6e1 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -52,7 +52,7 @@ module.exports = function(config) { { test: /\.js$/, exclude: /node_modules/, - loader: path.resolve(process.env.RACKT_PATH, 'node_modules/babel-loader') + loader: 'babel-loader' } ] } diff --git a/tasks/build b/tasks/build index 7fbaafe..24ec1df 100755 --- a/tasks/build +++ b/tasks/build @@ -1,14 +1,12 @@ #!/bin/bash -e -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" +BUILD="webpack --devtool source-map --config $RACKT_PATH/webpack.build.js" # Clean old build rm -rf build/ # Transpile ES6 -$babel -d build/lib ./lib +babel -d build/lib ./lib # Generate bundle mkdir -p dist diff --git a/tasks/init b/tasks/init index 58a3de2..99b8f34 100755 --- a/tasks/init +++ b/tasks/init @@ -1,5 +1,3 @@ #!/bin/bash -e -originate=$RACKT_PATH/node_modules/.bin/originate - -$originate react-component $1 +originate react-component $1 diff --git a/tasks/pages b/tasks/pages index fe66b1a..5ce8379 100755 --- a/tasks/pages +++ b/tasks/pages @@ -20,7 +20,7 @@ git branch -D gh-pages git push origin :gh-pages # build examples -$RACKT_PATH/node_modules/.bin/webpack --config $RACKT_PATH/webpack.config.js +webpack --config $RACKT_PATH/webpack.config.js # remove superfluous files find . -type f | egrep -v ".git/|examples/" | xargs rm diff --git a/tasks/release b/tasks/release index cba1c83..0a18c02 100755 --- a/tasks/release +++ b/tasks/release @@ -2,7 +2,7 @@ if [ "$1" == "--preview" ] || [ "$1" == "-P" ] || [ "$1" == "-p" ]; then # Preview release - $RACKT_PATH/node_modules/rf-release/node_modules/.bin/changelog -t preview -s + changelog -t preview -s else # build task has to be run prior to release module # the release module is what prompts for next version number @@ -28,5 +28,5 @@ else # Release to npm $RACKT_PATH/tasks/build update_version 'build/package.json' $next_version - $RACKT_PATH/node_modules/.bin/release -v $next_version -f ./build + release -v $next_version -f ./build fi diff --git a/tasks/server b/tasks/server index 7f71e55..1941a9d 100755 --- a/tasks/server +++ b/tasks/server @@ -1,5 +1,3 @@ #!/bin/bash -server=$RACKT_PATH/node_modules/.bin/webpack-dev-server - -$server --inline --config $RACKT_PATH/webpack.config.js --content-base examples/ "$@" +webpack-dev-server --inline --config $RACKT_PATH/webpack.config.js --content-base examples/ "$@" diff --git a/tasks/test b/tasks/test index bf16282..6cadb50 100755 --- a/tasks/test +++ b/tasks/test @@ -1,7 +1,4 @@ #!/bin/bash -eslint=$RACKT_PATH/node_modules/.bin/eslint -karma=$RACKT_PATH/node_modules/.bin/karma - -$eslint -c $RACKT_PATH/eslint.json lib examples && \ -NODE_ENV=test $karma start $RACKT_PATH/karma.conf.js "$@" +eslint -c $RACKT_PATH/eslint.json lib examples && \ +NODE_ENV=test karma start $RACKT_PATH/karma.conf.js "$@" diff --git a/webpack.build.js b/webpack.build.js index f90b9b1..cbd148c 100644 --- a/webpack.build.js +++ b/webpack.build.js @@ -33,7 +33,7 @@ module.exports = { { test: /\.js$/, exclude: /node_modules/, - loader: path.resolve(process.env.RACKT_PATH, 'node_modules/babel-loader') + loader: 'babel-loader' } ] }, diff --git a/webpack.config.js b/webpack.config.js index 8a49b0a..57c3061 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -36,7 +36,7 @@ module.exports = { { test: /\.js$/, exclude: /node_modules/, - loader: path.resolve(process.env.RACKT_PATH, 'node_modules/babel-loader') + loader: 'babel-loader' } ] },