Commit a055b999 authored by Jeremy Morrell's avatar Jeremy Morrell Committed by GitHub

Make yarn available to application if defined in engines (#404)

* Make yarn available to application if defined in engines

Fixes #402 
parent 1fbe9b88
...@@ -103,8 +103,15 @@ install_bins() { ...@@ -103,8 +103,15 @@ install_bins() {
install_npm "$npm_engine" "$BUILD_DIR/.heroku/node" install_npm "$npm_engine" "$BUILD_DIR/.heroku/node"
mcount "version.node.$(node --version)" mcount "version.node.$(node --version)"
fi fi
if $YARN; then
# Download yarn if there is a yarn.lock file or if the user
# has specified a version of yarn under "engines". We'll still
# only install using yarn if there is a yarn.lock file
if $YARN || [ -n "$yarn_engine" ]; then
install_yarn "$BUILD_DIR/.heroku/yarn" "$yarn_engine" install_yarn "$BUILD_DIR/.heroku/yarn" "$yarn_engine"
fi
if $YARN; then
mcount "version.yarn.$(yarn --version)" mcount "version.yarn.$(yarn --version)"
else else
mcount "version.npm.$(npm --version)" mcount "version.npm.$(npm --version)"
......
{
"name": "yarn",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"engines": {
"yarn": "0.24.5"
},
"dependencies": {
"lodash": "^4.16.4"
}
}
...@@ -88,6 +88,15 @@ testYarnEngine() { ...@@ -88,6 +88,15 @@ testYarnEngine() {
assertCapturedSuccess assertCapturedSuccess
} }
# If they specify a version of yarn inside package.json but
# don't have a yarn.lock file download and make yarn available
# though we will only install using yarn if a yarn.lock exists
testYarnOnlyEngine() {
compile "yarn-only-engine"
assertCaptured "installing yarn (0.24.5)"
assertCapturedSuccess
}
testWarnUnmetDepNpm() { testWarnUnmetDepNpm() {
compile "unmet-dep" compile "unmet-dep"
assertCaptured "fail npm install" assertCaptured "fail npm install"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment