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
7b28eb31
Commit
7b28eb31
authored
Jan 08, 2015
by
Hunter Loftis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split up warnings
parent
20014650
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
42 deletions
+64
-42
common.sh
bin/common.sh
+21
-0
compile
bin/compile
+7
-13
test
bin/test
+3
-2
warnings.sh
bin/warnings.sh
+29
-26
package.json
test/npm-version-specific/package.json
+3
-0
package.json
test/old-npm/package.json
+1
-1
No files found.
bin/common.sh
View file @
7b28eb31
...
...
@@ -13,6 +13,27 @@ info() {
echo
"
$*
"
}
warning
()
{
tip
=
$1
url
=
$2
echo
"WARNING:
$tip
"
>>
$warnings
echo
"
${
url
:-
https
://devcenter.heroku.com/articles/nodejs-support
}
"
>>
$warnings
echo
""
>>
$warnings
}
build_failed
()
{
head
"Build failed"
echo
""
cat
$warnings
| indent
info
"We're sorry this build is failing! If you can't find the issue in application code,"
info
"please submit a ticket so we can help: https://help.heroku.com/"
info
"You can also try reverting to our legacy Node.js buildpack:"
info
"heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#v63"
info
""
info
"Love,"
info
"Heroku"
}
file_contents
()
{
if
test
-f
$1
;
then
echo
"
$(
cat
$1
)
"
...
...
bin/compile
View file @
7b28eb31
...
...
@@ -17,23 +17,12 @@ warnings=$(mktemp)
# Load some convenience functions like status(), echo(), and indent()
source
$bp_dir
/bin/common.sh
source
$bp_dir
/bin/warnings.sh
# Avoid GIT_DIR leak from previous build steps
unset
GIT_DIR
# Provide hook to deal with errors
build_failed
()
{
head
"Build failed"
echo
""
cat
$warnings
| indent
info
"We're sorry this build is failing! If you can't find the issue in application code,"
info
"please submit a ticket so we can help: https://help.heroku.com/"
info
"You can also try reverting to our legacy Node.js buildpack:"
info
"heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#v63"
info
""
info
"Love,"
info
"Heroku"
}
trap
build_failed ERR
# Load config vars into environment; start with defaults
...
...
@@ -82,7 +71,8 @@ echo ""
printenv
|
grep
^NPM_CONFIG_ | indent
info
"NODE_MODULES_CACHE=
$NODE_MODULES_CACHE
"
source
$bp_dir
/bin/warnings.sh
warn_node_engine
"
$node_engine
"
warn_node_modules
"
$modules_source
"
####### Vendor in binaries
...
...
@@ -118,6 +108,8 @@ if [ "$npm_engine" != "" ]; then
fi
fi
warn_old_npm
`
npm
--version
`
# Run subsequent commands from the build directory
cd
$build_dir
...
...
@@ -180,6 +172,8 @@ elif [ "$start_method" == "server.js" ]; then
echo
"web: node server.js"
>
$build_dir
/Procfile
fi
warn_start
"
$start_method
"
####### Create the runtime environment (profile.d)
head
"Finalizing build"
...
...
bin/test
View file @
7b28eb31
...
...
@@ -37,7 +37,6 @@ testSpecificVersion() {
testStableVersion
()
{
compile
"stable-node"
assertCaptured
"Downloading and installing node 0.10"
assertNotCaptured
"WARNING"
assertCapturedSuccess
}
...
...
@@ -50,7 +49,8 @@ testUnstableVersion() {
testOldNpm
()
{
compile
"old-npm"
assertCaptured
"WARNING: This version of npm has several known issues"
assertCaptured
"WARNING: This version of npm (1.2.8000) has several known issues - consider upgrading to the latest release (2."
assertNotCaptured
"integer expression expected"
assertCapturedSuccess
}
...
...
@@ -295,6 +295,7 @@ testNpmVersionSpecific() {
compile
"npm-version-specific"
assertCaptured
"installing npm 2.1.11"
assertNotCaptured
"Resolving npm version"
assertNotCaptured
"WARNING"
assertCapturedSuccess
}
...
...
bin/warnings.sh
View file @
7b28eb31
warning
()
{
tip
=
$1
url
=
$2
echo
"WARNING:
$tip
"
>>
$warnings
echo
"
${
url
:-
https
://devcenter.heroku.com/articles/nodejs-support
}
"
>>
$warnings
echo
""
>>
$warnings
}
if
[
"
$node_engine
"
==
""
]
;
then
warn_node_engine
()
{
local
node_engine
=
$1
if
[
"
$node_engine
"
==
""
]
;
then
warning
"Node version not specified in package.json"
"https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version"
elif
[
"
$node_engine
"
==
"*"
]
;
then
elif
[
"
$node_engine
"
==
"*"
]
;
then
warning
"Avoid semver ranges like '*' in engines.node"
"https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version"
elif
[
${
node_engine
:0:1
}
==
">"
]
;
then
elif
[
${
node_engine
:0:1
}
==
">"
]
;
then
warning
"Avoid semver ranges starting with '>' in engines.node"
"https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version"
fi
if
[
"
$npm_engine
"
!=
""
]
;
then
if
[
"
${
npm_engine
:0:1
}
"
-lt
"2"
]
;
then
warning
"This version of npm has several known issues - consider upgrading to the latest release"
fi
fi
}
if
[
"
$modules_source
"
==
"prebuilt"
]
;
then
warn_node_modules
()
{
local
modules_source
=
$1
if
[
"
$modules_source
"
==
"prebuilt"
]
;
then
warning
"Avoid checking node_modules into source control"
"https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-"
elif
[
"
$modules_source
"
==
""
]
;
then
elif
[
"
$modules_source
"
==
""
]
;
then
warning
"No package.json found"
fi
fi
}
if
[
"
$start_method
"
==
""
]
;
then
warn_start
()
{
local
start_method
=
$1
if
[
"
$start_method
"
==
""
]
;
then
warning
"No Procfile, package.json start script, or server.js file found"
"https://devcenter.heroku.com/articles/nodejs-support#runtime-behavior"
fi
fi
}
warn_old_npm
()
{
local
npm_version
=
$1
if
[
"
${
npm_version
:0:1
}
"
-lt
"2"
]
;
then
local
latest_npm
=
$(
curl
--silent
--get
https://semver.herokuapp.com/npm/stable
)
warning
"This version of npm (
$npm_version
) has several known issues - consider upgrading to the latest release (
$latest_npm
)"
fi
}
test/npm-version-specific/package.json
View file @
7b28eb31
...
...
@@ -6,6 +6,9 @@
"type"
:
"git"
,
"url"
:
"http://github.com/example/example.git"
},
"scripts"
:
{
"start"
:
"node index.js"
},
"dependencies"
:
{
"hashish"
:
"*"
},
...
...
test/old-npm/package.json
View file @
7b28eb31
...
...
@@ -11,7 +11,7 @@
},
"engines"
:
{
"node"
:
"0.10.x"
,
"npm"
:
"1.2"
"npm"
:
"
~
1.2"
},
"scripts"
:
{
"start"
:
"node server.js"
...
...
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