-
Notifications
You must be signed in to change notification settings - Fork 83
refactor: Convert shrinkwrap extractor tool to package-lock #1551
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
Open
d3xter666
wants to merge
11
commits into
main
Choose a base branch
from
refactor/shrinkwrap-to-lockfile-convertion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
02e1ee8
refactor(lockfile-extractor): Rename from shrinkwrap-extractor
d3xter666 a4e6589
feat(cli): Replace npm-shrinkwrap.json with bundleDependencies
d3xter666 e594e65
test: Emulate release in regular CI checks
d3xter666 9035aa3
docs: Update .github/workflows/github-ci.yml
d3xter666 eae3e27
fix: Update .github/workflows/bundle-and-publish-cli.yml
d3xter666 9244654
fix: Correct zizmor findings for GH Actions
d3xter666 35d975c
fix: Limit permissions for only needed flows
d3xter666 a0689b8
refactor: Remove obsolete license
d3xter666 9d2c3ad
revert: Remove obsolete license from lockfile-extractor
d3xter666 aaff26a
fix: Update lockfile
d3xter666 a48a15e
fix: Respect the new root package when resolving nodes
d3xter666 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| name: Bundle and Publish @ui5/cli | ||
|
|
||
| # Reusable workflow: called by release-please.yml (real publish) and github-ci.yml (dry-run). | ||
| # The caller controls whether the publish is real or dry-run via the dry_run input. | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| dry_run: | ||
| description: "Skip actual publish — runs npm publish --dry-run for CI verification" | ||
| type: boolean | ||
| default: false | ||
| npm_tag: | ||
| description: "npm dist-tag (e.g. next, latest)" | ||
| type: string | ||
| default: next | ||
| npm_env: | ||
| # Setting this shapes the OIDC token subject claim to | ||
| # 'repo:UI5/cli:environment:<name>', which must match the trusted | ||
| # publisher configuration on npmjs.com. | ||
| # Pass 'npmjs:ui5-cli-mono' for a real publish; leave empty for | ||
| # dry-run calls (npm publish --dry-run never contacts the registry, | ||
| # so no OIDC token is needed — and omitting the environment avoids | ||
| # deployment-protection rules that would otherwise block PR builds). | ||
| description: > | ||
| GitHub Actions environment name for OIDC trusted publishing (e.g. npmjs:ui5-cli-mono). Leave empty for dry-run calls. | ||
| type: string | ||
| default: "" | ||
|
|
||
| jobs: | ||
| bundle-and-publish: | ||
| runs-on: ubuntu-24.04 | ||
| # Controls the OIDC subject claim: 'repo:UI5/cli:environment:<npm_env>'. | ||
| # npm's trusted publisher verifies this claim — empty string means no environment | ||
| # (subject becomes 'repo:UI5/cli:ref:refs/heads/...'), used for dry-run only. | ||
| # Permissions are not set here: they are inherited from the calling job. | ||
| # The real-publish caller (release-please.yml) passes id-token:write; | ||
| # the dry-run caller (github-ci.yml) does not, so no OIDC token is minted for dry-runs. | ||
| environment: ${{ inputs.npm_env }} | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
d3xter666 marked this conversation as resolved.
|
||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Node.js LTS | ||
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | ||
| with: | ||
| node-version: 24.x | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Generate package-lock.json for bundling | ||
| working-directory: packages/cli | ||
| run: | | ||
| set -e | ||
| node ../../internal/lockfile-extractor/cli.js ../../ | ||
|
|
||
| - name: Bundle and publish @ui5/cli | ||
| env: | ||
| NPM_TAG: ${{ inputs.npm_tag }} | ||
| DRY_RUN: ${{ inputs.dry_run }} | ||
| run: | | ||
| set -e | ||
| TEMP_CLI_DIR=$(mktemp -d) | ||
|
|
||
| # Copy package (including generated package-lock.json) outside the workspace | ||
| cp -r packages/cli/. "$TEMP_CLI_DIR/" | ||
| echo "📦 Copied @ui5/cli to temporary directory: $TEMP_CLI_DIR" | ||
|
|
||
| cd "$TEMP_CLI_DIR" | ||
|
|
||
| # Strip devDependencies so npm ci only installs production deps matching the lock file | ||
| node -e " | ||
| const fs = require('fs'); | ||
| const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); | ||
| delete pkg.devDependencies; | ||
| fs.writeFileSync('package.json', JSON.stringify(pkg, null, '\t')); | ||
| " | ||
|
|
||
| # Install exact versions from generated lock file (no workspace symlinks) | ||
| echo "📦 Installing production dependencies from package-lock.json" | ||
| npm ci | ||
|
|
||
| if [ "$DRY_RUN" = "true" ]; then | ||
| echo "🔍 Dry-run: reporting what would be published (no actual publish)" | ||
| npm publish --access public --tag "$NPM_TAG" --dry-run | ||
| else | ||
| echo "🚀 Publishing @ui5/cli from temporary directory: $TEMP_CLI_DIR" | ||
| npm publish --access public --tag "$NPM_TAG" | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
internal/shrinkwrap-extractor/REUSE.toml → internal/lockfile-extractor/REUSE.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an actual copy of
shrinkwrap/lockfile-extractorrun + package deployment to NPM fromrelease-please.yamlNow it has a dry run flag, so we can integrate this flow into our current CI environment. This way, we can ensure that every merge in the
mainbranch won't break the release process.