Skip to content

fix(cli): stage dynamic plugins via npm pack#112

Merged
gashcrumb merged 1 commit into
redhat-developer:mainfrom
gashcrumb:RHDHBUGS-1968
May 20, 2026
Merged

fix(cli): stage dynamic plugins via npm pack#112
gashcrumb merged 1 commit into
redhat-developer:mainfrom
gashcrumb:RHDHBUGS-1968

Conversation

@gashcrumb
Copy link
Copy Markdown
Member

@gashcrumb gashcrumb commented May 8, 2026

Replace recursive copy of each dist-dynamic directory when running plugin package with the same contents npm would publish: npm pack into a scratch directory, extract the tarball with tar --strip-components=1, and keep the flattened layout expected by the OCI / --export-to flow.

This matches publish semantics from dist-dynamic package.json (files, bundleDependencies, etc.), omits node_modules/.bin entries that referenced absolute paths on the builder machine and triggered "link outside of the archive" warnings during dynamic plugin install from OCI images (RHDHBUGS-1968).

Run npm/tar through spawn bash with shell: false and stdio redirected to an anonymous log fd so chatter does not clutter the CLI; Task.forCommand is not used (no env for pack placeholders) nor run() (shell: true can still surface npm output). On staging failure the log contents are printed, then discarded.

This change also adjusts the e2e test assertions which where asserting
on the old recursive copy behavior to now compare using an independent
npm pack step

Fixes RHDHBUGS-1968

Assisted-By: Cursor Desktop

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

@gashcrumb gashcrumb force-pushed the RHDHBUGS-1968 branch 5 times, most recently from 1aa5a7e to aad9b98 Compare May 8, 2026 15:43
@gashcrumb gashcrumb requested review from davidfestal and kadel May 8, 2026 15:56
Copy link
Copy Markdown
Member

@PatAKnight PatAKnight left a comment

Choose a reason for hiding this comment

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

Couple of comments

Comment thread src/commands/package-dynamic-plugins/command.ts
Comment thread CHANGELOG.md
Replace recursive copy of each dist-dynamic directory when running
plugin package with the same contents npm would publish: npm pack into a
scratch directory, extract the tarball with tar --strip-components=1, and
keep the flattened layout expected by the OCI / --export-to flow.

This matches publish semantics from dist-dynamic package.json (files,
bundleDependencies, etc.), omits node_modules/.bin entries that referenced
absolute paths on the builder machine and triggered "link outside of the
archive" warnings during dynamic plugin install from OCI images
(RHDHBUGS-1968).

Run npm/tar through spawn bash with shell: false and stdio redirected to an
anonymous log fd so chatter does not clutter the CLI; Task.forCommand is not
used (no env for pack placeholders) nor run() (shell: true can still surface
npm output). On staging failure the log contents are printed, then discarded.

This change also adjusts the e2e test assertions which where asserting
on the old recursive copy behavior to now compare using an independent
`npm pack` step

Assisted-By: Cursor Desktop

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@PatAKnight PatAKnight left a comment

Choose a reason for hiding this comment

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

LGTM

@gashcrumb gashcrumb merged commit b56f504 into redhat-developer:main May 20, 2026
6 checks passed
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.

2 participants