Skip to content

refactor: Convert shrinkwrap extractor tool to package-lock - #1551

Open
d3xter666 wants to merge 2 commits into
mainfrom
refactor/shrinkwrap-to-lockfile-convertion
Open

refactor: Convert shrinkwrap extractor tool to package-lock#1551
d3xter666 wants to merge 2 commits into
mainfrom
refactor/shrinkwrap-to-lockfile-convertion

Conversation

@d3xter666

@d3xter666 d3xter666 commented Aug 27, 2026

Copy link
Copy Markdown
Member

JIRA: CPOUI5FOUNDATION-1283

Shrinkwrap is being deprecated (npm/cli#9262) in node, but we want to keep and guard the dependencies that we ship with the UI5 CLI.

We have decided to go with NPM's packge.json bundeDependencies property

bundleDependencies has its own issues when working with monorepos. The core issue is that it simply bundles anything that's within that package's node_modules/ folder and does not consider any hoisted packages that monorepos naturally have.

With this context in mind, we have decided to leverage our internal tool shrinkwrap-extractor and adjust it to fit for the bundleDependencies case.

Here's the expected workflow:

  • Rename shrinkwrap-extractor to something more meaningful in the new context. Proposal: lockfile-extractor
  • Keep the existing CI publish flow (https://github.com/UI5/cli/blob/main/.github/workflows/release-please.yml#L134-L144) and run lockfile-extractor for packages/cli. This will result in package-lock.json file extraction suitable just for the @ui5/cli package.
  • Move packages/cli out of the scope of the monorepo by copying its files in a $TEMP dir.
  • Within the $TEMP dir, remove any non relevant dependencies (devDependencies) from package.json
  • Run npm ci, so that dependencies are installed with the exact same versions that are defined within the generated earlier package-lock.json
  • Run npm pack and npm publish, so that the generated tarball taht includes also the bundledependencies gets published on NPM

Note: This PR simply renames the shrinkwrap-extractor to lockfile-extractor. The only real change is the handling of publish GH Action: https://github.com/UI5/cli/pull/1551/changes#diff-2c84033033d49186c63e6adcd705f63b11ae6814cd76c152c9c486d389fbccf3

@d3xter666
d3xter666 marked this pull request as draft August 27, 2026 14:59
@d3xter666
d3xter666 force-pushed the refactor/shrinkwrap-to-lockfile-convertion branch 2 times, most recently from bb2e873 to ab9b808 Compare August 27, 2026 15:21
@d3xter666
d3xter666 force-pushed the refactor/shrinkwrap-to-lockfile-convertion branch from ab9b808 to 96c7db8 Compare August 27, 2026 15:30
@@ -0,0 +1,340 @@
import {readFile, mkdtemp, writeFile, rm} from "node:fs/promises";

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This file is actually renamed internal/shrinkwrap-extractor/lib/convertPackageLockToShrinkwrap.js. I don't know why GitHub splits them this way

Migrates from the deprecated npm-shrinkwrap.json (npm/cli#9262) to
bundleDependencies: true. The lockfile-extractor now generates a
standalone package-lock.json; the package is then copied outside the
workspace, installed via npm ci, and packed via npm pack to bundle all
production node_modules.
@d3xter666
d3xter666 force-pushed the refactor/shrinkwrap-to-lockfile-convertion branch from 96c7db8 to 3ca822d Compare August 28, 2026 09:09
@d3xter666
d3xter666 marked this pull request as ready for review August 28, 2026 11:01
@d3xter666
d3xter666 requested a review from a team August 28, 2026 11:01
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