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
649802e7
Commit
649802e7
authored
Mar 11, 2016
by
Hunter Loftis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify a bit
parent
5085334c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
18 deletions
+28
-18
compile
bin/compile
+4
-5
dependencies.sh
lib/dependencies.sh
+10
-4
run
test/run
+14
-9
No files found.
bin/compile
View file @
649802e7
...
@@ -118,15 +118,14 @@ header "Restoring cache"
...
@@ -118,15 +118,14 @@ header "Restoring cache"
restore_cache | output
"
$LOG_FILE
"
restore_cache | output
"
$LOG_FILE
"
build_dependencies
()
{
build_dependencies
()
{
local
has_prebuild_script
=
$(
read_json
"
$BUILD_DIR
/package.json"
".scripts[
\"
heroku-prebuild
\"
]"
)
run_if_present
'heroku-prebuild'
local
has_postbuild_script
=
$(
read_json
"
$BUILD_DIR
/package.json"
".scripts[
\"
heroku-postbuild
\"
]"
)
if
$PREBUILD
;
then
if
$PREBUILD
;
then
echo
"Prebuild detected (node_modules already exists)"
echo
"Prebuild detected (node_modules already exists)"
rebuild_node_modules
"
$BUILD_DIR
"
"
$has_prebuild_script
"
"
$has_postbuild_script
"
rebuild_node_modules
"
$BUILD_DIR
"
else
else
install_node_modules
"
$BUILD_DIR
"
"
$has_prebuild_script
"
"
$has_postbuild_script
"
install_node_modules
"
$BUILD_DIR
"
fi
fi
run_if_present
'heroku-postbuild'
}
}
header
"Building dependencies"
header
"Building dependencies"
...
...
lib/dependencies.sh
View file @
649802e7
run_if_present
()
{
local
script_name
=
${
1
:-}
local
has_script
=
$(
read_json
"
$BUILD_DIR
/package.json"
".scripts[
\"
$script_name
\"
]"
)
if
[
-n
"
$has_script
"
]
;
then
echo
"Running
$script_name
"
npm run
"
$script_name
"
--if-present
fi
}
install_node_modules
()
{
install_node_modules
()
{
local
build_dir
=
${
1
:-}
local
build_dir
=
${
1
:-}
local
has_prebuild_script
=
${
2
:-}
local
has_prebuild_script
=
${
2
:-}
...
@@ -5,10 +14,7 @@ install_node_modules() {
...
@@ -5,10 +14,7 @@ install_node_modules() {
if
[
-e
$build_dir
/package.json
]
;
then
if
[
-e
$build_dir
/package.json
]
;
then
cd
$build_dir
cd
$build_dir
if
[
-n
"
$has_prebuild_script
"
]
;
then
echo
"Running prebuild script"
npm run heroku-prebuild
fi
echo
"Pruning any extraneous modules"
echo
"Pruning any extraneous modules"
npm prune
--unsafe-perm
--userconfig
$build_dir
/.npmrc 2>&1
npm prune
--unsafe-perm
--userconfig
$build_dir
/.npmrc 2>&1
if
[
-e
$build_dir
/npm-shrinkwrap.json
]
;
then
if
[
-e
$build_dir
/npm-shrinkwrap.json
]
;
then
...
...
test/run
View file @
649802e7
#!/usr/bin/env bash
#!/usr/bin/env bash
# See README.md for info on running these tests.
# See README.md for info on running these tests.
testPrePostBuildScripts
()
{
compile
"pre-post-build-scripts"
assertCaptured
"Running heroku-prebuild"
assertCaptured
"echo heroku-prebuild hook message"
assertCaptured
"Running heroku-postbuild"
assertCaptured
"echo heroku-postbuild hook message"
assertCapturedSuccess
compile
"stable-node"
assertNotCaptured
"Running heroku-prebuild"
assertNotCaptured
"Running heroku-postbuild"
assertCapturedSuccess
}
testWarningsOnFailure
()
{
testWarningsOnFailure
()
{
compile
"many-warnings"
compile
"many-warnings"
assertCaptured
"troubleshooting-node-deploys"
assertCaptured
"troubleshooting-node-deploys"
...
@@ -471,15 +485,6 @@ testMultiExport() {
...
@@ -471,15 +485,6 @@ testMultiExport() {
assertCapturedSuccess
assertCapturedSuccess
}
}
testPrePostBuildScripts
()
{
compile
"pre-post-build-scripts"
assertCaptured
"Running prebuild script"
assertCaptured
"echo heroku-prebuild hook message"
assertCaptured
"Running postbuild script"
assertCaptured
"echo heroku-postbuild hook message"
assertCapturedSuccess
}
# Utils
# Utils
pushd
$(
dirname
0
)
>
/dev/null
pushd
$(
dirname
0
)
>
/dev/null
...
...
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