Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use libnodejs function to resolve nodejs version #688

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/paketo-buildpacks/packit/v2/postal"
"github.com/paketo-buildpacks/packit/v2/sbom"
"github.com/paketo-buildpacks/packit/v2/scribe"
"github.com/paketo-buildpacks/libnodejs"
)

//go:generate faux --interface EntryResolver --output fakes/entry_resolver.go
Expand Down Expand Up @@ -67,14 +68,7 @@ func Build(entryResolver EntryResolver, dependencyManager DependencyManager, sbo

logger.Process("Resolving Node Engine version")

priorities := []interface{}{
"BP_NODE_VERSION",
"package.json",
".nvmrc",
".node-version",
}

entry, allEntries := entryResolver.Resolve("node", context.Plan.Entries, priorities)
entry, allEntries := libnodejs.ResolveNodeVersion(entryResolver.Resolve, context.Plan)
if entry.Name == "" && len(allEntries) == 0 {
logger.Process("Node no longer requested by plan, satisfied by extension")

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/BurntSushi/toml v1.3.2
github.com/Masterminds/semver/v3 v3.2.1
github.com/onsi/gomega v1.27.10
github.com/paketo-buildpacks/libnodejs v0.2.0
github.com/paketo-buildpacks/occam v0.17.0
github.com/paketo-buildpacks/packit/v2 v2.11.0
github.com/sclevine/spec v1.4.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2568,6 +2568,8 @@ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/paketo-buildpacks/libnodejs v0.2.0 h1:y7G6BQIeeMUnIlzREiAipQlAcaXJ82VMPldkTTiv9o4=
github.com/paketo-buildpacks/libnodejs v0.2.0/go.mod h1:JLs6tu5TD6la8p1IKo3UYO1C93/ywGesa74FpM82wPw=
github.com/paketo-buildpacks/occam v0.17.0 h1:2Xt4Vc4MbSAsLyu+WLttd6gpR4ORsBwcoqAfWz4QaD4=
github.com/paketo-buildpacks/occam v0.17.0/go.mod h1:OfGaY+04G+zPoX3HVnMj3dXnBkFEjPC3UyM8eAIeBqk=
github.com/paketo-buildpacks/packit/v2 v2.6.1/go.mod h1:iBArWOfC5xZQF01o+zwnVKS+/hUBuFG+O1jCvzqBujs=
Expand Down