Skip to content

Commit

Permalink
Put local node_modules/.bin in PATH, fixes #22
Browse files Browse the repository at this point in the history
  • Loading branch information
CMTegner committed Jun 18, 2016
1 parent 63ed6ce commit 52e37e8
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 21 deletions.
6 changes: 6 additions & 0 deletions bin/rackt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
]
}
Expand Down
6 changes: 2 additions & 4 deletions tasks/build
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 1 addition & 3 deletions tasks/init
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash -e

originate=$RACKT_PATH/node_modules/.bin/originate

$originate react-component $1
originate react-component $1
2 changes: 1 addition & 1 deletion tasks/pages
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tasks/release
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 1 addition & 3 deletions tasks/server
Original file line number Diff line number Diff line change
@@ -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/ "$@"
7 changes: 2 additions & 5 deletions tasks/test
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion webpack.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
]
},
Expand Down

0 comments on commit 52e37e8

Please sign in to comment.