Skip to content

Commit 4d568ef

Browse files
committed
Make the setup.sh script more robust
This changes the setup.sh script so that we will pass a -f command to rm in clean (this avoids a failure error code if it is run twice) and forces us to use the local versions of both bower and grunt giving us better control over those packages if neded. This also removes automatically running bower after doing npm install since the user should, in theory, never run that directly.
1 parent 1bb0b1b commit 4d568ef

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"fs-extra": "^0.12.0",
3131
"grunt": "^0.4.2",
3232
"grunt-browserify": "^3.3.1",
33+
"grunt-cli": "^0.1.13",
3334
"grunt-contrib-clean": "^0.6.0",
3435
"grunt-contrib-copy": "^0.8.0",
3536
"grunt-contrib-jasmine": "^0.8.0",
@@ -53,8 +54,5 @@
5354
"peerDependencies": {
5455
"freedom": "^0.6.18"
5556
},
56-
"scripts": {
57-
"install": "./node_modules/.bin/bower install"
58-
},
5957
"private": true
6058
}

setup.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# allows script to be run from different directories but always act on the
55
# directory of the project (which is where this script is located).
66
ROOT_DIR="$(cd "$(dirname $0)"; pwd)";
7+
NPM_BIN_DIR="$ROOT_DIR/node_modules/.bin"
78

89
# A simple bash script to run commands to setup and install all dev dependencies
910
# (including non-npm ones)
@@ -27,7 +28,7 @@ function runCmd ()
2728

2829
function clean ()
2930
{
30-
runCmd "rm -r $ROOT_DIR/node_modules $ROOT_DIR/build $ROOT_DIR/.tscache"
31+
runCmd "rm -rf $ROOT_DIR/node_modules $ROOT_DIR/build $ROOT_DIR/.tscache"
3132
}
3233

3334
function installTools ()
@@ -38,9 +39,9 @@ function installTools ()
3839

3940
function installThirdParty ()
4041
{
41-
runAndAssertCmd "bower install --allow-root"
42-
runAndAssertCmd "node_modules/.bin/tsd reinstall --config ./third_party/tsd.json"
43-
runAndAssertCmd "grunt copy:thirdParty"
42+
runAndAssertCmd "$NPM_BIN_DIR/bower install --allow-root"
43+
runAndAssertCmd "$NPM_BIN_DIR/tsd reinstall --config ./third_party/tsd.json"
44+
runAndAssertCmd "$NPM_BIN_DIR/grunt copy:thirdParty"
4445
}
4546

4647
function installDevDependencies ()

0 commit comments

Comments
 (0)