+++ /dev/null
-find node_modules/ -name '*.info' -type f -delete
-node node_modules/bower/bin/bower install
function mysqldump_cmd() {
_mysql_vars
echo "mysqldump -u$DBUSER $PASSWDSECTION $HOSTSECTION $PORTSECTION $DBARGS"
-}
\ No newline at end of file
+}
+
+## Pick the first available command. If none, then abort.
+## example: COMPOSER=$(pickcmd composer composer.phar)
+function pickcmd() {
+ for name in "$@" ; do
+ if which $name >> /dev/null ; then
+ echo $name
+ return
+ fi
+ done
+ echo "ERROR: Failed to find any of these commands: $@"
+ exit 1
+}
+
+## usage: has_commands <cmd1> <cmd2> ...
+function has_commands() {
+ for cmd in "$@" ; do
+ if ! which $cmd >> /dev/null ; then
+ return 1
+ fi
+ done
+ return 0
+}
if [ -n "$DO_DOWNLOAD" ]; then
pushd "$CALLEDPATH/.."
- composer install
- # Install npm and bower modules
- npm install
+ COMPOSER=$(pickcmd composer composer.phar)
+ $COMPOSER install
+
+ if has_commands bower karma ; then
+ ## dev dependencies have been installed globally; don't force developer to redownload
+ npm install --production
+ else
+ npm install
+ fi
+
+ BOWER=$(pickcmd node_modules/bower/bin/bower bower)
+ $BOWER install
popd
fi
"main": "index.js",
"license": "MIT",
"name": "civicrm",
- "version": "5.0.0",
+ "version": "4.6.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/civicrm/civicrm-core.git"
+ },
"devDependencies": {
"bower": "^1.3.1",
"karma": "^0.12.16",
"karma-jasmine": "~0.3.2"
},
"scripts": {
- "postinstall": "bash bin/npm_postinstall.sh",
- "test": "node node_modules/karma/bin/karma start tests/karma.conf.js"
+ "postinstall": "bash tools/scripts/npm/postinstall.sh",
+ "test": "bash tools/scripts/npm/test.sh"
}
}
--- /dev/null
+#!/bin/bash
+if [ -d node_modules ]; then
+ find node_modules/ -name '*.info' -type f -delete
+fi
--- /dev/null
+#!/bin/bash
+if which node_modules/karma/bin/karma >> /dev/null; then
+ node node_modules/karma/bin/karma start tests/karma.conf.js
+elif which karma >> /dev/null ; then
+ karma start tests/karma.conf.js
+else
+ echo "ERROR: Failed to find karma"
+ exit 1
+fi