forked from heroku/nodejs-yarn-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add yarn custom path and cache layer
- Loading branch information
Showing
6 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,16 @@ cd .. # change from nodejs-npm-buildpack directory | |
git clone [email protected]:heroku/nodejs-engine-buildpack.git | ||
``` | ||
|
||
### Define a custom path for yarn (optional) | ||
|
||
You can optionally create a `yarn.lock` file in the root directory with a line like this: | ||
|
||
``` | ||
# yarn_path:public/my-custom-path | ||
``` | ||
|
||
Make sure you place the actual `package.json` and `yarn.lock` in that path | ||
|
||
### Build the image | ||
|
||
#### with buildpacks | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
extract_path_from_yarn_lock() { | ||
local build_dir=$1 | ||
|
||
if grep -q -e "^# :yarn_path:" $build_dir/yarn.lock; then | ||
echo "$1/$(cat $build_dir/yarn.lock | grep -s -e "^# :yarn_path:" | sed 's/^# :yarn_path:\(.*\)\s*$/\1/g')" | ||
else | ||
echo "$1" | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[buildpack] | ||
uri = "." | ||
|
||
[[dependencies]] | ||
uri = "docker://public.ecr.aws/heroku-buildpacks/heroku-nodejs-engine-buildpack@sha256:4fa85f23b1df1138039ec6f5667da48da2af7858767b8840a754c54b39b42ca1" |