Skip to content

Tier B: Onboard esbuild-0.28.0 - #2

Open
dperaza4dustbit wants to merge 1 commit into
calungaproject:mainfrom
dperaza4dustbit:first_package_test
Open

Tier B: Onboard esbuild-0.28.0#2
dperaza4dustbit wants to merge 1 commit into
calungaproject:mainfrom
dperaza4dustbit:first_package_test

Conversation

@dperaza4dustbit

@dperaza4dustbit dperaza4dustbit commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

First package onboard test

Summary by Sourcery

Onboard esbuild 0.28.0 as a Tier B package with a Trusted Libraries linux-x64 binary and JS wrapper, including build and smoke verification scripts.

New Features:

  • Add build entrypoint script to clone esbuild v0.28.0, build the linux-x64 binary, and produce main and platform-specific npm tarballs.
  • Introduce a Trusted Libraries linux-x64 platform npm package wrapping the esbuild binary with appropriate metadata and packaging layout.

Build:

  • Add manifest for esbuild 0.28.0 defining source metadata, builder image, entrypoints, and output npm artifacts including the @Calunga linux-x64 platform package.

Tests:

  • Add smoke verification script to validate presence and basic functionality of the main npm package and linux-x64 platform tarball outputs.

@sourcery-ai

sourcery-ai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Reviewer's Guide

Onboards esbuild 0.28.0 as a Tier B package by adding a factory build script, smoke verification script, and manifest wiring to produce a main npm package and a Trusted Libraries linux-x64 platform package.

Flow diagram for esbuild 0.28.0 Tier B build and smoke verification

flowchart TD
    Manifest["manifest.json (esbuild 0.28.0)"]
    BuildScript["build.entrypoint.sh"]
    GitClone["git clone esbuild@v0.28.0"]
    BuildBin["make platform-linux-x64"]
    PatchMain["Patch npm/esbuild for @calunga/esbuild-linux-x64"]
    PackMain["npm pack esbuild-${VERSION}.tgz"]
    PackPlatform["npm pack @calunga/esbuild-linux-x64-${VERSION}.tgz"]
    OutMain["out/esbuild-0.28.0.tgz"]
    OutPlatform["out/@calunga/esbuild-linux-x64-0.28.0.tgz"]
    Smoke["verify.smoke.sh"]
    CheckTar["Check tarball contents"]
    RunBin["esbuild --version"]

    Manifest --> BuildScript
    BuildScript --> GitClone --> BuildBin --> PatchMain --> PackMain --> OutMain
    BuildBin --> PackPlatform --> OutPlatform

    Manifest --> Smoke
    Smoke --> CheckTar --> RunBin
    OutMain --> CheckTar
    OutPlatform --> CheckTar
Loading

File-Level Changes

Change Details Files
Add Tier B build entrypoint to clone esbuild 0.28.0, build linux-x64 binary, patch npm metadata, and produce main and platform tarballs.
  • Read build configuration (version, source URL/ref) from manifest JSON and set up working directories for source and platform staging.
  • Clone the esbuild Git repo at the specified tag and run the upstream make target to build the linux-x64 binary, failing if the binary is missing.
  • Run upstream scripts to generate npm/esbuild install shims, then patch the main package.json to add the TL platform as an optional dependency and rewrite install.js to reference the TL platform package.
  • Pack the main esbuild npm package into OUT_DIR and validate the expected esbuild-VERSION.tgz tarball exists.
  • Assemble an @calunga/esbuild-linux-x64 platform package with the built binary, README, and a minimal package.json (linux/x64, Node >=18), then npm pack it and rename the tarball to a versioned filename in OUT_DIR/@Calunga.
packages/esbuild/0.28.0/build.entrypoint.sh
Add smoke verification script to validate produced tarballs, contents, and that the platform binary reports the expected version.
  • Derive main and platform tarball paths from manifest outputs and ensure both files exist under PACKAGE_DIR.
  • Inspect the main tarball for package.json and install.js and the platform tarball for bin/esbuild.
  • Extract the platform tarball to a temp directory, ensure bin/esbuild is present and executable, and run esbuild --version, checking it matches the manifest version.
packages/esbuild/0.28.0/verify.smoke.sh
Add manifest wiring for esbuild 0.28.0 Tier B package, including builder image, entrypoint/smoke scripts, outputs, and optional dependency publication.
  • Define package metadata (name, version, description, native_tier, source repo/ref, upstream npm version).
  • Configure the builder image and digest pin, plus entrypoint and smoke script names for the pipeline.
  • Declare two outputs: main npm package tarball and linux-x64 TL platform tarball with platform/libc metadata and pulp names.
  • List the optional TL platform dependency that should be published for this version.
packages/esbuild/0.28.0/manifest.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 3 issues, and left some high level feedback:

  • When patching package.json in build.entrypoint.sh, the jq expression replaces optionalDependencies entirely instead of merging with any existing entries; consider updating it to merge in the TL platform dep so upstream optionalDependencies are preserved.
  • In verify.smoke.sh, the jq selection for MAIN_TGZ and PLATFORM_TGZ is based only on .type, which could become ambiguous if additional outputs of the same type are added; selecting by .id (e.g., main, linux-x64-binary) would make the script more robust.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- When patching `package.json` in `build.entrypoint.sh`, the `jq` expression replaces `optionalDependencies` entirely instead of merging with any existing entries; consider updating it to merge in the TL platform dep so upstream optionalDependencies are preserved.
- In `verify.smoke.sh`, the jq selection for `MAIN_TGZ` and `PLATFORM_TGZ` is based only on `.type`, which could become ambiguous if additional outputs of the same type are added; selecting by `.id` (e.g., `main`, `linux-x64-binary`) would make the script more robust.

## Individual Comments

### Comment 1
<location path="packages/esbuild/0.28.0/build.entrypoint.sh" line_range="42-44" />
<code_context>
+node scripts/esbuild.js "${LINUX_BIN}" --neutral
+
+echo "[build.entrypoint] Patching main package for TL platform optional dep"
+jq --arg name "${TL_PLATFORM}" --arg version "${VERSION}" \
+    '.optionalDependencies = { ($name): $version }' \
+    "${MAIN_PKG}/package.json" > "${MAIN_PKG}/package.json.tmp"
+mv "${MAIN_PKG}/package.json.tmp" "${MAIN_PKG}/package.json"
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Current jq expression overwrites any existing optionalDependencies block.

This assignment replaces any existing `optionalDependencies`, so any upstream entries would be lost if they’re added in future. To keep upstream optional deps and add the TL one, merge instead, e.g.:

`'.optionalDependencies = (.optionalDependencies // {}) + { ($name): $version }'`

```suggestion
jq --arg name "${TL_PLATFORM}" --arg version "${VERSION}" \
    '.optionalDependencies = (.optionalDependencies // {}) + { ($name): $version }' \
    "${MAIN_PKG}/package.json" > "${MAIN_PKG}/package.json.tmp"
```
</issue_to_address>

### Comment 2
<location path="packages/esbuild/0.28.0/build.entrypoint.sh" line_range="63-72" />
<code_context>
+mkdir -p "${PLATFORM_STAGE}/bin"
+cp "${UPSTREAM_PLATFORM}/README.md" "${PLATFORM_STAGE}/"
+cp "${LINUX_BIN}" "${PLATFORM_STAGE}/bin/esbuild"
+jq -n --arg name "${TL_PLATFORM}" --arg version "${VERSION}" \
+    '{
+        name: $name,
+        version: $version,
+        description: "The Linux 64-bit binary for esbuild (Trusted Libraries build).",
+        license: "MIT",
+        preferUnplugged: true,
+        engines: { node: ">=18" },
+        os: ["linux"],
+        cpu: ["x64"]
+    }' > "${PLATFORM_STAGE}/package.json"
+
</code_context>
<issue_to_address>
**question (bug_risk):** Platform package.json lacks a bin field even though bin/esbuild is present.

Because this package ships `bin/esbuild` but doesn’t declare a `bin` mapping, direct consumers of `@calunga/esbuild-linux-x64` won’t get a `node_modules/.bin` shim and tools that read `bin` entries won’t detect it. If this binary is meant to be invoked directly (not only via the main wrapper’s install logic), please add a `bin` field like `"bin": { "esbuild": "bin/esbuild" }` to the generated package.json.
</issue_to_address>

### Comment 3
<location path="packages/esbuild/0.28.0/verify.smoke.sh" line_range="9-10" />
<code_context>
+: "${PACKAGE_DIR:?PACKAGE_DIR required}"
+
+VERSION="$(jq -r .version "${MANIFEST_PATH}")"
+MAIN_TGZ="$(jq -r '.outputs[] | select(.type == "npm-package") | .path' "${MANIFEST_PATH}")"
+PLATFORM_TGZ="$(jq -r '.outputs[] | select(.type == "tl-platform-package") | .path' "${MANIFEST_PATH}")"
+
+MAIN_PATH="${PACKAGE_DIR}/${MAIN_TGZ}"
</code_context>
<issue_to_address>
**issue:** jq selection will silently pick the last matching output if multiple entries share the same type.

Because the jq expression returns all matching `.path` values, command substitution will only keep the last one. If the manifest ever has multiple `npm-package` or `tl-platform-package` outputs, this will silently validate an arbitrary one. Consider also matching on a stable identifier (e.g. `select(.id == "main")`) or asserting there is exactly one match (e.g. using `halt_error` if `length != 1`).
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +42 to +44
jq --arg name "${TL_PLATFORM}" --arg version "${VERSION}" \
'.optionalDependencies = { ($name): $version }' \
"${MAIN_PKG}/package.json" > "${MAIN_PKG}/package.json.tmp"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Current jq expression overwrites any existing optionalDependencies block.

This assignment replaces any existing optionalDependencies, so any upstream entries would be lost if they’re added in future. To keep upstream optional deps and add the TL one, merge instead, e.g.:

'.optionalDependencies = (.optionalDependencies // {}) + { ($name): $version }'

Suggested change
jq --arg name "${TL_PLATFORM}" --arg version "${VERSION}" \
'.optionalDependencies = { ($name): $version }' \
"${MAIN_PKG}/package.json" > "${MAIN_PKG}/package.json.tmp"
jq --arg name "${TL_PLATFORM}" --arg version "${VERSION}" \
'.optionalDependencies = (.optionalDependencies // {}) + { ($name): $version }' \
"${MAIN_PKG}/package.json" > "${MAIN_PKG}/package.json.tmp"

Comment on lines +63 to +72
jq -n --arg name "${TL_PLATFORM}" --arg version "${VERSION}" \
'{
name: $name,
version: $version,
description: "The Linux 64-bit binary for esbuild (Trusted Libraries build).",
license: "MIT",
preferUnplugged: true,
engines: { node: ">=18" },
os: ["linux"],
cpu: ["x64"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): Platform package.json lacks a bin field even though bin/esbuild is present.

Because this package ships bin/esbuild but doesn’t declare a bin mapping, direct consumers of @calunga/esbuild-linux-x64 won’t get a node_modules/.bin shim and tools that read bin entries won’t detect it. If this binary is meant to be invoked directly (not only via the main wrapper’s install logic), please add a bin field like "bin": { "esbuild": "bin/esbuild" } to the generated package.json.

Comment on lines +9 to +10
MAIN_TGZ="$(jq -r '.outputs[] | select(.type == "npm-package") | .path' "${MANIFEST_PATH}")"
PLATFORM_TGZ="$(jq -r '.outputs[] | select(.type == "tl-platform-package") | .path' "${MANIFEST_PATH}")"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: jq selection will silently pick the last matching output if multiple entries share the same type.

Because the jq expression returns all matching .path values, command substitution will only keep the last one. If the manifest ever has multiple npm-package or tl-platform-package outputs, this will silently validate an arbitrary one. Consider also matching on a stable identifier (e.g. select(.id == "main")) or asserting there is exactly one match (e.g. using halt_error if length != 1).

@dperaza4dustbit
dperaza4dustbit force-pushed the first_package_test branch 12 times, most recently from e04c12f to 43de349 Compare July 13, 2026 20:57
@dperaza4dustbit dperaza4dustbit changed the title Onboard esbuild-0.28.0 Tier A: Onboard esbuild-0.28.0 Jul 14, 2026
@dperaza4dustbit dperaza4dustbit changed the title Tier A: Onboard esbuild-0.28.0 Tier B: Onboard esbuild-0.28.0 Jul 14, 2026
Signed-off-by: David Peraza <dperaza@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant