Skip to content

Commit 24477d3

Browse files
committed
fixing compile process
1 parent a428a48 commit 24477d3

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

bin/compile-lib.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -z "$1" ]; then
4+
echo "You must provide library path"
5+
exit 1
6+
fi
7+
8+
_pwd=$(pwd)
9+
_lib="$1"
10+
11+
# todo: find a smarter fix
12+
# Fixing "spawn sh ENOENT" issue
13+
cd /
14+
15+
REQUIRED_DEPS=("babel-cli" "babel-plugin-add-module-exports" "babel-preset-node6");
16+
NPM_BIN=`which npm`
17+
NPM_GLOBAL_NM=`$NPM_BIN root -g`
18+
19+
echo "Checking babel-* dependencies in $NPM_GLOBAL_NM"
20+
21+
for DEP in ${REQUIRED_DEPS[@]}; do
22+
if [ ! -d "$NPM_GLOBAL_NM/$DEP" ]; then
23+
echo "Installing missing $DEP"
24+
"$NPM_BIN" install -g "$DEP" || (echo "Failed to install $DEP" && exit 1)
25+
echo "$DEP has been installed"
26+
echo ""
27+
fi
28+
done
29+
30+
cd "$_pwd" || (echo "Failed to resume to $_pwd" && exit 1)
31+
cd "$_lib" || (echo "Failed to pwd to lib path $_pwd" && exit 1)
32+
babel lib/ --extensions='.js' --plugins="$NPM_GLOBAL_NM/babel-plugin-add-module-exports" --presets="$NPM_GLOBAL_NM/babel-preset-node6" --out-dir="lib.es6" || (echo "Failed to compile $_pwd" && exit 1)

src/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@
4848
"url": "https://github.com/MitocGroup/deepify.git"
4949
},
5050
"scripts": {
51-
"postinstall": "bash hooks/autocomplete_deepify.sh && bash hooks/install_templates.sh && bash hooks/ensure_es.sh && bash node-bin/assure-deps.sh",
52-
"test": "bash node-bin/test.sh",
51+
"compile-travis": "bash ../../bin/compile-lib.sh .",
5352
"compile": "bash node-bin/compile.sh",
54-
"prepublish": "bash node-bin/assure-deps.sh && bash node-bin/compile.sh && node hooks/dump_comp.js"
53+
"prepublish": "npm run compile"
5554
},
5655
"dependencies": {
5756
"aws-sdk": "^2.39.x",

0 commit comments

Comments
 (0)