Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
c3d5e7a
Bump github.com/paketo-buildpacks/occam in the go-modules group
dependabot[bot] Jun 20, 2025
d2d5046
Updating github-config
paketo-bot Jun 20, 2025
4ed51c8
Bump github.com/andybalholm/brotli in the go-modules group
dependabot[bot] Jun 24, 2025
c05f509
Bump the go-modules group with 4 updates
dependabot[bot] Jun 25, 2025
a9531ef
Bump github.com/docker/docker
dependabot[bot] Jun 25, 2025
5203a69
Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
dependabot[bot] Jun 26, 2025
6b24e78
Bump github.com/mholt/archives in the go-modules group
dependabot[bot] Jun 27, 2025
e62e16a
Updating github-config
paketo-bot Jun 29, 2025
88887c1
Bump github.com/Masterminds/semver/v3 in the go-modules group
dependabot[bot] Jun 30, 2025
d4bac10
Bump github.com/shirou/gopsutil/v4 in the go-modules group
dependabot[bot] Jul 1, 2025
a78bda4
Bump github.com/paketo-buildpacks/packit/v2 in the go-modules group
dependabot[bot] Jul 2, 2025
1fb2d03
Bump github.com/docker/docker
dependabot[bot] Jul 3, 2025
a486baf
Bump github.com/anchore/stereoscope from 0.1.5 to 0.1.6
dependabot[bot] Jul 3, 2025
decfc48
Bump the go-modules group across 1 directory with 5 updates
dependabot[bot] Jul 8, 2025
011b169
Updating github-config
paketo-bot Jul 8, 2025
02bbcd3
Bump the go-modules group with 19 updates
dependabot[bot] Jul 9, 2025
e1b7a47
Bump github.com/olekukonko/errors
dependabot[bot] Jul 9, 2025
c7d6f65
Update integration.json
pacostas Jul 9, 2025
db8d6a2
Bump the go-modules group with 14 updates
dependabot[bot] Jul 10, 2025
617334b
Bump github.com/docker/docker
dependabot[bot] Jul 10, 2025
347c92e
Bump the go-modules group with 5 updates
dependabot[bot] Jul 11, 2025
689f9f1
Bump github.com/testcontainers/testcontainers-go from 0.37.0 to 0.38.0
dependabot[bot] Jul 15, 2025
ce1f1a6
Bump the go-modules group across 1 directory with 3 updates
dependabot[bot] Jul 15, 2025
ffe956a
Updates go mod version to 1.24.5
paketo-bot Jul 14, 2025
09d6454
Updating github-config
paketo-bot Jul 15, 2025
e689351
Bump the go-modules group with 3 updates
dependabot[bot] Jul 17, 2025
4a13cef
Updating github-config
paketo-bot Jul 18, 2025
d05cf0e
Updating github-config
paketo-bot Jul 19, 2025
dedc70a
Bump the go-modules group with 2 updates
dependabot[bot] Jul 18, 2025
b6d9e23
Bump the go-modules group with 3 updates
dependabot[bot] Jul 22, 2025
fa6c709
Updating github-config
paketo-bot Jul 22, 2025
8b4b8e0
Bump the go-modules group across 1 directory with 7 updates
dependabot[bot] Jul 25, 2025
cf474d5
Bump the go-modules group with 4 updates
dependabot[bot] Jul 29, 2025
89f73f9
Bump github.com/docker/docker
dependabot[bot] Jul 29, 2025
52681dc
Bump github.com/containerd/containerd from 1.7.27 to 1.7.28
dependabot[bot] Jul 29, 2025
bfc5990
Bump github.com/anchore/stereoscope
dependabot[bot] Jul 30, 2025
d449a01
Bump the go-modules group with 2 updates
dependabot[bot] Jul 30, 2025
c3231f9
Updating github-config
paketo-bot Jul 30, 2025
3c204d6
Bump the go-modules group with 5 updates
dependabot[bot] Jul 31, 2025
531b441
Bump the go-modules group with 2 updates
dependabot[bot] Aug 1, 2025
253d6c7
Bump github.com/go-jose/go-jose/v4 in the go-modules group
dependabot[bot] Aug 4, 2025
a2b4c37
Bump the go-modules group with 2 updates
dependabot[bot] Aug 6, 2025
2225988
Bump the go-modules group with 4 updates
dependabot[bot] Aug 7, 2025
9668042
Bump the go-modules group with 8 updates
dependabot[bot] Aug 8, 2025
67e7e74
Updates go mod version to 1.24.6
paketo-bot Aug 11, 2025
1488f80
Bump github.com/anchore/syft in the go-modules group
dependabot[bot] Aug 11, 2025
af1b4e5
fix: Adding ubi9 builder on integration tests
pacostas Aug 12, 2025
def50ae
Updating github-config
paketo-bot Aug 13, 2025
4fb00e9
Updating github-config
paketo-bot Aug 14, 2025
fa7d4dd
Updating github-config
paketo-bot Aug 16, 2025
9d5ee0c
Updating github-config
paketo-bot Aug 22, 2025
f398f20
Updating github-config
paketo-bot Aug 23, 2025
13d6539
Updating github-config
paketo-bot Aug 24, 2025
a9af00a
fix: fixing unit tests by replacing versions and uuids with regex
pacostas Aug 16, 2025
2175764
Bump the go-modules group across 1 directory with 22 updates
dependabot[bot] Aug 27, 2025
8d92455
Bump github.com/anchore/stereoscope from 0.1.8 to 0.1.9
dependabot[bot] Aug 27, 2025
ac8a047
Bump the go-modules group with 5 updates
dependabot[bot] Aug 28, 2025
3ab6d2a
Bump github.com/ulikunitz/xz in the go-modules group
dependabot[bot] Aug 29, 2025
0713316
Bump the go-modules group with 15 updates
dependabot[bot] Sep 3, 2025
5b0f919
Bump the go-modules group with 2 updates
dependabot[bot] Sep 4, 2025
1cd51c3
Bump the go-modules group with 2 updates
dependabot[bot] Sep 4, 2025
763aca1
Bump the go-modules group with 18 updates
dependabot[bot] Sep 5, 2025
2b0caaa
Bump github.com/hashicorp/aws-sdk-go-base/v2
dependabot[bot] Sep 5, 2025
f0fe81c
Bump github.com/docker/docker
dependabot[bot] Sep 5, 2025
c5eb9e1
Bump the go-modules group with 11 updates
dependabot[bot] Sep 8, 2025
54d7397
Updating github-config
paketo-bot Sep 6, 2025
0e5b1a0
Bump the go-modules group with 22 updates
dependabot[bot] Sep 9, 2025
31a626a
Bump the go-modules group with 4 updates
dependabot[bot] Sep 10, 2025
a993119
Bump the go-modules group with 7 updates
dependabot[bot] Sep 11, 2025
eb7b851
feat: adding multi-arch support
pacostas Sep 11, 2025
ba04951
Bump go.opentelemetry.io/auto/sdk in the go-modules group
dependabot[bot] Sep 12, 2025
9ea04b2
Updating github-config
paketo-bot Sep 12, 2025
47876d1
Bump modernc.org/sqlite from 1.38.2 to 1.39.0 in the go-modules group
dependabot[bot] Sep 15, 2025
1248414
Bump github.com/anchore/stereoscope from 0.1.9 to 0.1.10
dependabot[bot] Sep 16, 2025
2abc149
Bump the go-modules group with 3 updates
dependabot[bot] Sep 16, 2025
c509348
Bump the go-modules group with 2 updates
dependabot[bot] Sep 17, 2025
c0de0a8
Bump the go-modules group with 3 updates
dependabot[bot] Sep 18, 2025
56fa9f4
Bump cloud.google.com/go/compute/metadata in the go-modules group
dependabot[bot] Sep 19, 2025
23f68c0
Bump github.com/testcontainers/testcontainers-go from 0.38.0 to 0.39.0
dependabot[bot] Sep 19, 2025
9b4b82d
Updating github-config
paketo-bot Sep 19, 2025
2da8851
Bump the go-modules group with 3 updates
dependabot[bot] Sep 22, 2025
90a14a9
Bump the go-modules group with 4 updates
dependabot[bot] Sep 23, 2025
a660a35
Updating github-config
paketo-bot Sep 23, 2025
2cf7cee
Bump the go-modules group with 15 updates
dependabot[bot] Sep 24, 2025
cf4ecf7
Bump cloud.google.com/go/compute/metadata in the go-modules group
dependabot[bot] Sep 25, 2025
052acb3
Bump the go-modules group with 9 updates
dependabot[bot] Sep 26, 2025
5eda436
Bump the go-modules group with 16 updates
dependabot[bot] Sep 29, 2025
ec3d6ee
Bump the go-modules group with 5 updates
dependabot[bot] Sep 30, 2025
d21996c
Bump the go-modules group with 4 updates
dependabot[bot] Oct 1, 2025
d8699c3
Adding paketobuildpacks/ubuntu-noble-builder-buildpackless to the int…
pacostas Oct 1, 2025
ac8d59c
Bump the go-modules group with 3 updates
dependabot[bot] Oct 2, 2025
08f8b09
Bump the go-modules group with 4 updates
dependabot[bot] Oct 3, 2025
30b4691
Bump github.com/hashicorp/aws-sdk-go-base/v2
dependabot[bot] Oct 3, 2025
4544a35
Bump github.com/docker/docker
dependabot[bot] Oct 3, 2025
131c318
Updating github-config
paketo-bot Oct 8, 2025
d803a0d
Bump github.com/docker/docker
dependabot[bot] Oct 9, 2025
091cd36
Updating github-config
paketo-bot Oct 9, 2025
1e174c5
Bump the go-modules group across 1 directory with 25 updates
dependabot[bot] Oct 13, 2025
5ff2e97
Bump the go-modules group with 2 updates
dependabot[bot] Oct 14, 2025
14afe45
Bump github.com/ncruces/go-strftime from 0.1.9 to 1.0.0
dependabot[bot] Oct 14, 2025
f93a257
Bump the go-modules group with 2 updates
dependabot[bot] Oct 15, 2025
7f89a0e
Bump the go-modules group with 2 updates
dependabot[bot] Oct 16, 2025
056d77e
Bump the go-modules group with 19 updates
dependabot[bot] Oct 17, 2025
56d8aec
Bump the go-modules group across 1 directory with 21 updates
dependabot[bot] Oct 27, 2025
8e6711a
Bump github.com/containerd/cgroups/v3 in the go-modules group
dependabot[bot] Oct 28, 2025
e1afcf9
Bump the go-modules group with 4 updates
dependabot[bot] Oct 29, 2025
2237e2d
Bump github.com/gabriel-vasile/mimetype in the go-modules group
dependabot[bot] Oct 30, 2025
9ae9b27
Updating github-config
paketo-bot Oct 30, 2025
5762e59
Bump the go-modules group with 15 updates
dependabot[bot] Oct 31, 2025
97b01c1
Updating github-config
paketo-bot Oct 31, 2025
b2a102f
Bump the go-modules group with 4 updates
dependabot[bot] Nov 3, 2025
aea6106
Bump github.com/anchore/stereoscope from 0.1.11 to 0.1.12
dependabot[bot] Nov 4, 2025
d47d1fb
Bump github.com/containerd/containerd from 1.7.28 to 1.7.29
dependabot[bot] Nov 6, 2025
fe1fe47
Bump github.com/docker/docker
dependabot[bot] Nov 6, 2025
8301a53
Bump github.com/testcontainers/testcontainers-go from 0.39.0 to 0.40.0
dependabot[bot] Nov 7, 2025
c0d8713
Bump github.com/hashicorp/aws-sdk-go-base/v2
dependabot[bot] Nov 12, 2025
6985bb5
Bump github.com/docker/cli
dependabot[bot] Nov 12, 2025
b46a4fa
Updating github-config
paketo-bot Nov 17, 2025
6bf505f
Bump github.com/anchore/stereoscope from 0.1.12 to 0.1.13
dependabot[bot] Nov 18, 2025
0702afc
Updating github-config
paketo-bot Nov 25, 2025
faf9e54
Updating github-config
paketo-bot Nov 26, 2025
ed03794
fix: checking file has closed properly
pacostas Nov 26, 2025
d9525bd
Updates go mod version to 1.25.4
paketo-bot Dec 1, 2025
bdb501e
Add multi-arch support to build scripts
vishal24367 Dec 1, 2025
dd25e88
Apply bugwatch suggestions: remove .bak files, fix unused variables, …
vishal24367 Dec 1, 2025
9573c2b
Bump the go-modules group across 1 directory with 58 updates
dependabot[bot] Dec 2, 2025
c21b257
Bump go.uber.org/atomic from 1.9.0 to 1.11.0
dependabot[bot] Dec 3, 2025
3fe0c40
Bump go.uber.org/multierr from 1.9.0 to 1.11.0
dependabot[bot] Dec 3, 2025
6bc362e
Bump github.com/docker/docker
dependabot[bot] Dec 3, 2025
9947a1c
Bump github.com/ncruces/go-strftime from 0.1.9 to 1.0.0
dependabot[bot] Dec 3, 2025
81fdde5
Bump the go-modules group with 91 updates
dependabot[bot] Dec 3, 2025
dee3895
Bump github.com/testcontainers/testcontainers-go from 0.39.0 to 0.40.0
dependabot[bot] Dec 4, 2025
e6497fc
Bump the go-modules group with 37 updates
dependabot[bot] Dec 4, 2025
3f82fb2
fix: manually full upgrade of go modules
pacostas Dec 4, 2025
b3ad151
Bump github.com/hashicorp/aws-sdk-go-base/v2
dependabot[bot] Dec 4, 2025
d148118
Bump github.com/testcontainers/testcontainers-go from 0.39.0 to 0.40.0
dependabot[bot] Dec 5, 2025
903c611
Bump github.com/anchore/stereoscope from 0.1.12 to 0.1.13
dependabot[bot] Dec 5, 2025
b8c620f
Bump go.uber.org/atomic from 1.9.0 to 1.11.0
dependabot[bot] Dec 5, 2025
bdbf4ec
Bump the go-modules group across 1 directory with 85 updates
dependabot[bot] Dec 5, 2025
ed783ee
Merge remote-tracking branch 'upstream/main'
vishal24367 Dec 8, 2025
3b2d91d
Bump github.com/hashicorp/aws-sdk-go-base/v2
dependabot[bot] Dec 10, 2025
05f0c5b
Bump github.com/anchore/stereoscope from 0.1.13 to 0.1.14
dependabot[bot] Dec 10, 2025
d3b4c8e
Fixed build script to support yarn berry
vishal24367 Dec 10, 2025
edfb800
Merge remote-tracking branch 'upstream/main' into sync-with-remote-repo
vishal24367 Dec 10, 2025
f023f73
Merge branch 'sync-with-remote-repo' into 6465-add-multi-arch-support
vishal24367 Dec 10, 2025
47d44b1
Add multi-arch support to yarn buildpack: update publish.sh, package.…
vishal24367 Dec 11, 2025
47ec86e
Merge branch 'main' into 6465-add-multi-arch-support
vishal24367 Dec 11, 2025
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
/bin
/linux
/darwin
/windows
/windows
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ file that looks like the following:
launch = true
```

## Usage
## Packaging

To package this buildpack for consumption:

```shell
$ ./scripts/package.sh --version <version-number>
```bash
./scripts/package.sh --version 2.2.6
```

This will build the buildpack for all target architectures specified in `buildpack.toml` (amd64 and arm64 by default) and create a single archive containing binaries for all architectures in the `build/` directory.

This will create a `buildpackage.cnb` file under the `build` directory which you
can use to build your app as follows:
```shell
Expand All @@ -66,6 +68,29 @@ pack build <app-name> \

Though the API of this buildpack does not require `node`, yarn is unusable without node.

## Publishing

To publish this buildpack to ECR:

```bash
# First, authenticate with ECR (if not already authenticated)
aws ecr get-login-password --region us-east-1 | \
docker login --username AWS --password-stdin 348674388966.dkr.ecr.us-east-1.amazonaws.com

# Then publish the buildpack
./scripts/publish.sh \
--image-ref 348674388966.dkr.ecr.us-east-1.amazonaws.com/neeto-deploy/paketo/buildpack/yarn:<version> \
--buildpack-type buildpack
```

The script will automatically:
- Read target architectures from `buildpack.toml`
- Extract the buildpack archive
- Publish each architecture separately with arch-suffixed tags (e.g., `yarn:<version>-amd64`, `yarn:<version>-arm64`)
- Create and push a multi-arch manifest list

## Usage

## Run Tests

To run all unit tests, run:
Expand Down
220 changes: 115 additions & 105 deletions build.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package yarn

import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"time"
"encoding/json"

"github.com/paketo-buildpacks/packit/v2"
"github.com/paketo-buildpacks/packit/v2/chronos"
"github.com/paketo-buildpacks/packit/v2/draft"
"github.com/paketo-buildpacks/packit/v2/postal"
"github.com/paketo-buildpacks/packit/v2/sbom"
"github.com/paketo-buildpacks/packit/v2/scribe"
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"time"
"encoding/json"

"github.com/paketo-buildpacks/packit/v2"
"github.com/paketo-buildpacks/packit/v2/chronos"
"github.com/paketo-buildpacks/packit/v2/draft"
"github.com/paketo-buildpacks/packit/v2/postal"
"github.com/paketo-buildpacks/packit/v2/sbom"
"github.com/paketo-buildpacks/packit/v2/scribe"
)

//go:generate faux --interface DependencyManager --output fakes/dependency_manager.go
Expand Down Expand Up @@ -51,31 +51,31 @@ func Build(
version = "default"
}

// Detect Yarn Berry (modern) by presence of .yarnrc.yml/.yarnrc.yaml
isBerryYarn := false
if _, statErr := os.Stat(filepath.Join(context.WorkingDir, ".yarnrc.yml")); statErr == nil {
isBerryYarn = true
} else if _, statErr := os.Stat(filepath.Join(context.WorkingDir, ".yarnrc.yaml")); statErr == nil {
isBerryYarn = true
}
// Detect Yarn Berry (modern) by presence of .yarnrc.yml/.yarnrc.yaml
isBerryYarn := false
if _, statErr := os.Stat(filepath.Join(context.WorkingDir, ".yarnrc.yml")); statErr == nil {
isBerryYarn = true
} else if _, statErr := os.Stat(filepath.Join(context.WorkingDir, ".yarnrc.yaml")); statErr == nil {
isBerryYarn = true
}

// If package.json declares packageManager: "yarn@<ver>", prefer that ONLY for Berry projects
var pmYarnVersion string
if data, readErr := os.ReadFile(filepath.Join(context.WorkingDir, "package.json")); readErr == nil {
var pkg struct {
PackageManager string `json:"packageManager"`
}
if jsonErr := json.Unmarshal(data, &pkg); jsonErr == nil {
pm := strings.TrimSpace(pkg.PackageManager)
if strings.HasPrefix(pm, "yarn@") {
v := strings.TrimPrefix(pm, "yarn@")
if idx := strings.IndexAny(v, " +#"); idx != -1 {
v = v[:idx]
}
pmYarnVersion = v
}
}
}
// If package.json declares packageManager: "yarn@<ver>", prefer that ONLY for Berry projects
var pmYarnVersion string
if data, readErr := os.ReadFile(filepath.Join(context.WorkingDir, "package.json")); readErr == nil {
var pkg struct {
PackageManager string `json:"packageManager"`
}
if jsonErr := json.Unmarshal(data, &pkg); jsonErr == nil {
pm := strings.TrimSpace(pkg.PackageManager)
if strings.HasPrefix(pm, "yarn@") {
v := strings.TrimPrefix(pm, "yarn@")
if idx := strings.IndexAny(v, " +#"); idx != -1 {
v = v[:idx]
}
pmYarnVersion = v
}
}
}
dependency, err := dependencyManager.Resolve(
filepath.Join(context.CNBPath, "buildpack.toml"),
entry.Name,
Expand All @@ -99,15 +99,21 @@ func Build(
launchMetadata = packit.LaunchMetadata{BOM: bom}
}

// Use resolved dependency version as the install version (override with packageManager only for Berry)
resolvedInstallVersion := dependency.Version
if isBerryYarn && pmYarnVersion != "" {
resolvedInstallVersion = pmYarnVersion
}
// Use resolved dependency version as the install version (override with packageManager only for Berry)

resolvedInstallVersion := dependency.Version
if isBerryYarn && pmYarnVersion != "" {
resolvedInstallVersion = pmYarnVersion
}

cachedSHA, ok := yarnLayer.Metadata[DependencyCacheKey].(string)
if ok && !isBerryYarn && postal.Checksum(dependency.Checksum).MatchString(cachedSHA) {
// Yarn 4+ (Berry) is shipped via Corepack, not a tarball with a bin/.
// Treat any 4.x request as Berry even if no .yarnrc.yml is present (e.g. classic-style projects requesting 4.x).
if strings.HasPrefix(resolvedInstallVersion, "4.") {
isBerryYarn = true
}

cachedSHA, ok := yarnLayer.Metadata[DependencyCacheKey].(string)
if ok && !isBerryYarn && postal.Checksum(dependency.Checksum).MatchString(cachedSHA) {
logger.Process("Reusing cached layer %s", yarnLayer.Path)
logger.Break()

Expand All @@ -120,63 +126,67 @@ func Build(
}, nil
}

logger.Process("Executing build process")
logger.Process("Executing build process")

yarnLayer, err = yarnLayer.Reset()
if err != nil {
return packit.BuildResult{}, err
}

yarnLayer.Launch, yarnLayer.Build, yarnLayer.Cache = launch, build, build

logger.Subprocess("Installing Yarn %s", resolvedInstallVersion)

var duration time.Duration
if isBerryYarn {
// Persist Corepack cache under the yarn layer so the runtime doesn't re-download Yarn
corepackDir := filepath.Join(yarnLayer.Path, "corepack")
if mkErr := os.MkdirAll(corepackDir, 0o755); mkErr != nil {
return packit.BuildResult{}, mkErr
}


duration, err = clock.Measure(func() error {
steps := [][]string{
{"corepack", "enable"},
{"corepack", "prepare", fmt.Sprintf("yarn@%s", resolvedInstallVersion), "--activate"},
}
for _, args := range steps {

cmd := exec.Command(args[0], args[1:]...)
cmd.Env = append(os.Environ(), "COREPACK_HOME="+corepackDir)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
return err
}
}
return nil
})
if err != nil {
return packit.BuildResult{}, err
}
logger.Action("Completed in %s", duration.Round(time.Millisecond))
logger.Break()
// Ensure COREPACK_HOME is present in build and launch images
yarnLayer.Build = true
yarnLayer.Launch = true
yarnLayer.BuildEnv.Default("COREPACK_HOME", filepath.Join(yarnLayer.Path, "corepack"))
yarnLayer.LaunchEnv.Default("COREPACK_HOME", filepath.Join(yarnLayer.Path, "corepack"))
} else {
duration, err = clock.Measure(func() error {
return dependencyManager.Deliver(dependency, context.CNBPath, yarnLayer.Path, context.Platform.Path)
})
if err != nil {
return packit.BuildResult{}, err
}
logger.Action("Completed in %s", duration.Round(time.Millisecond))
logger.Break()
}
yarnLayer.Launch, yarnLayer.Build, yarnLayer.Cache = launch, build, build

logger.Subprocess("Installing Yarn %s", resolvedInstallVersion)

var duration time.Duration
if isBerryYarn {
// Persist Corepack cache under the yarn layer so the runtime doesn't re-download Yarn
corepackDir := filepath.Join(yarnLayer.Path, "corepack")
if mkErr := os.MkdirAll(corepackDir, 0o755); mkErr != nil {
return packit.BuildResult{}, mkErr
}

duration, err = clock.Measure(func() error {
steps := [][]string{
{"corepack", "enable"},
{"corepack", "prepare", fmt.Sprintf("yarn@%s", resolvedInstallVersion), "--activate"},
}
for _, args := range steps {

cmd := exec.Command(args[0], args[1:]...)
cmd.Env = append(os.Environ(), "COREPACK_HOME="+corepackDir)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
return err
}
}
return nil
})
if err != nil {
return packit.BuildResult{}, err
}
logger.Action("Completed in %s", duration.Round(time.Millisecond))
logger.Break()
// Ensure COREPACK_HOME is present in build and launch images
yarnLayer.Build = true
yarnLayer.Launch = true
corepackHome := filepath.Join(yarnLayer.Path, "corepack")
yarnLayer.BuildEnv.Default("COREPACK_HOME", corepackHome)
yarnLayer.LaunchEnv.Default("COREPACK_HOME", corepackHome)
// Corepack writes the yarn shim into COREPACK_HOME/shims; expose that on PATH.
shimsDir := filepath.Join(corepackHome, "shims")
yarnLayer.BuildEnv.Append("PATH", shimsDir, string(os.PathListSeparator))
yarnLayer.LaunchEnv.Append("PATH", shimsDir, string(os.PathListSeparator))
} else {
duration, err = clock.Measure(func() error {
return dependencyManager.Deliver(dependency, context.CNBPath, yarnLayer.Path, context.Platform.Path)
})
if err != nil {
return packit.BuildResult{}, err
}
logger.Action("Completed in %s", duration.Round(time.Millisecond))
logger.Break()
}

sbomDisabled, err := checkSbomDisabled()
if err != nil {
Expand Down Expand Up @@ -207,13 +217,13 @@ func Build(
}
}

cacheValue := dependency.Checksum
if isBerryYarn || cacheValue == "" {
cacheValue = dependency.Version
}
yarnLayer.Metadata = map[string]interface{}{
DependencyCacheKey: cacheValue,
}
cacheValue := dependency.Checksum
if isBerryYarn || cacheValue == "" {
cacheValue = dependency.Version
}
yarnLayer.Metadata = map[string]interface{}{
DependencyCacheKey: cacheValue,
}

return packit.BuildResult{
Layers: []packit.Layer{yarnLayer},
Expand Down
13 changes: 7 additions & 6 deletions buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ api = "0.7"
id = "neeto-deploy/yarn"
name = "Paketo Buildpack for Yarn"
sbom-formats = ["application/vnd.cyclonedx+json", "application/spdx+json", "application/vnd.syft+json"]
version = "2.2.6"

[[buildpack.licenses]]
type = "Apache-2.0"
Expand All @@ -21,7 +22,7 @@ api = "0.7"
"linux/arm64/bin/run",
]

pre-package = "./scripts/build.sh --target linux/amd64 --target linux/arm64"
pre-package = "./scripts/build.sh"

[metadata.default_versions]
yarn = "1.*"
Expand All @@ -40,19 +41,19 @@ api = "0.7"
version = "1.22.19"

[[metadata.dependencies]]
checksum = "sha256:c8d3eae160a892e32837db3dcae515e843e5383fef52b8141940c8bcf8b6d59f"
checksum = "sha256:75fd1c08678a187eb29b589109d90a30cdb98ffbcb80b81cf65faa2b2f71c94e"
cpe = "cpe:2.3:a:yarnpkg:yarn:4.9.2:*:*:*:*:*:*:*"
id = "yarn"
licenses = ["BSD-2-Clause"]
name = "Yarn"
purl = "pkg:generic/yarn@4.9.2"
source = "https://registry.npmjs.org/yarn/-/yarn-4.9.2.tgz"
source-checksum = "sha256:c8d3eae160a892e32837db3dcae515e843e5383fef52b8141940c8bcf8b6d59f"
source = "https://registry.npmjs.org/@yarnpkg/cli/-/cli-4.9.2.tgz"
source-checksum = "sha256:75fd1c08678a187eb29b589109d90a30cdb98ffbcb80b81cf65faa2b2f71c94e"
stacks = ["io.buildpacks.stacks.bionic", "io.buildpacks.stacks.jammy", "io.buildpacks.stacks.noble", "*"]
strip-components = 1
uri = "https://registry.npmjs.org/yarn/-/yarn-4.9.2.tgz"
uri = "https://paketo-artifacts.s3.us-east-1.amazonaws.com/yarn/yarn-4.9.2.tgz"
version = "4.9.2"

[[metadata.dependencies]]
checksum = "sha256:88268464199d1611fcf73ce9c0a6c4d44c7d5363682720d8506f6508addf36a0"
cpe = "cpe:2.3:a:yarnpkg:yarn:1.22.22:*:*:*:*:*:*:*"
Expand Down
Loading
Loading