Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-nodejs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-nodejs
Commits
df910758
Commit
df910758
authored
Jan 13, 2012
by
David Dollar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try new approach for node_modules cache
parent
aa480b1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
24 deletions
+27
-24
compile
bin/compile
+27
-24
No files found.
bin/compile
View file @
df910758
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>
# fail fast
set
-e
mktmpdir
()
{
dir
=
$(
mktemp
-t
node-
$1
-XXXX
)
rm
-rf
$dir
...
...
@@ -19,6 +16,16 @@ function indent() {
esac
}
run_npm
()
{
command
=
"
$1
"
HOME
=
"
$BUILD_DIR
"
$VENDORED_NODE
/bin/node
$VENDORED_NPM
/cli.js
$command
2>&1 | indent
if
[
"
${
PIPESTATUS
[*]
}
"
!=
"0 0"
]
;
then
echo
" ! Failed to
$command
dependencies with npm"
exit
1
fi
}
# clean up leaking environment
unset
GIT_DIR
...
...
@@ -65,35 +72,31 @@ export CPPPATH="$INCLUDE_PATH"
# unpack existing cache
if
[
-d
$CACHE_STORE_DIR
]
;
then
TEMP_NODE_MODULES_DIR
=
$(
mktmpdir node_modules
)
# move existing node_modules out of the way
if
[
-f
$CACHE_TARGET_DIR
]
;
then
mv
$CACHE_TARGET_DIR
$TEMP_NODE_MODULES_DIR
/
fi
mkdir
-p
$CACHE_TARGET_DIR
cp
-R
$CACHE_STORE_DIR
/
*
$CACHE_TARGET_DIR
/
# move existing node_modules back into place
if
[
-d
$TEMP_NODE_MODULES_DIR
/node_modules
]
;
then
cp
-R
$TEMP_NODE_MODULES_DIR
/node_modules/
*
$CACHE_TARGET_DIR
/
fi
fi
# install dependencies with npm
echo
"-----> Installing dependencies with npm
$NPM_VERSION
"
cd
$BUILD_DIR
HOME
=
"
$BUILD_DIR
"
$VENDORED_NODE
/bin/node
$VENDORED_NPM
/cli.js prune 2>&1 | indent
if
[
"
${
PIPESTATUS
[*]
}
"
!=
"0 0"
]
;
then
echo
" ! Failed to prune dependencies with npm"
exit
1
fi
HOME
=
"
$BUILD_DIR
"
$VENDORED_NODE
/bin/node
$VENDORED_NPM
/cli.js
install
2>&1 | indent
if
[
"
${
PIPESTATUS
[*]
}
"
!=
"0 0"
]
;
then
echo
" ! Failed to install dependencies with npm"
exit
1
fi
HOME
=
"
$BUILD_DIR
"
$VENDORED_NODE
/bin/node
$VENDORED_NPM
/cli.js rebuild 2>&1 | indent
cd
$BUILD_DIR
run_npm
install
run_npm rebuild
if
[
"
${
PIPESTATUS
[*]
}
"
!=
"0 0"
]
;
then
echo
" ! Failed to rebuild dependencies with npm"
exit
1
fi
echo
" Dependencies installed"
echo
"Dependencies installed"
| indent
# repack cache with new assets
if
[
-d
$CACHE_TARGET_DIR
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment