You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(packaging): exclude dev dependencies when the service dir is a symlink - #14005
excludeNodeDevDependencies strips the service directory from each npm ls --parseable path with item.replace(path.join(serviceDir, path.sep), ''). npm ls runs with the service directory as its working directory and prints real (symlink-resolved) paths. When serviceDir goes through a symlink, as with AWS CodeBuild sources, the prefix never matches. Every dev dependency then stays an absolute path, fails the package.json lookup, and is bundled into the artifact.
This change strips either the configured or the real service directory prefix, so the generated exclude globs are service-relative in both cases.
A new unit test packages a real project through a symlinked service directory and asserts that node_modules/dev-pkg/** is excluded and the production dependency is kept. The test fails on main (the exclude list contains only the user-defined pattern) and passes with this change.
Summary by CodeRabbit
Bug Fixes
Improved dependency packaging for services accessed through symlinked directories.
Development dependencies are now excluded correctly while production dependencies remain included, regardless of the service directory path used.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Dependency path normalization now recognizes both the configured service directory and its resolved real path. A unit test covers development dependency exclusion when the service directory is a symlink.
Path stripping now recognizes the configured service directory and its resolved real path. The test verifies that a development package is excluded and a production package remains included when the service directory is a symlink.
Symlinked service directories are handled by the dependency exclusion path, with no identified issue blocking merge.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: excluding development dependencies when the service directory is a symlink.
Linked Issues check
Issue [#13447] requires excludeNodeDevDependencies to exclude development dependencies when serviceDir contains symlinks. The change resolves serviceDir with fsp.realpath(), checks both config…
Out of Scope Changes check
The pull request changes only dependency-path normalization in zip-service.js and adds the focused unit test for symlinked service directories. The changes support issue [#13447] and do not demonstr…
Full details: Linked Issues check
Explanation
Issue [#13447] requires excludeNodeDevDependencies to exclude development dependencies when serviceDir contains symlinks. The change resolves serviceDir with fsp.realpath(), checks both configured and real prefixes, and converts matching npm ls --parseable paths to service-relative paths. The added unit test uses a symlinked service directory and verifies that node_modules/dev-pkg/** is excluded while prod-pkg is not excluded.
Full details: Out of Scope Changes check
Explanation
The pull request changes only dependency-path normalization in zip-service.js and adds the focused unit test for symlinked service directories. The changes support issue [#13447] and do not demonstrate unrelated behavior changes.
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
I have read the CLA Document and I hereby sign the CLA
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
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.
Closes: #13447
excludeNodeDevDependenciesstrips the service directory from eachnpm ls --parseablepath withitem.replace(path.join(serviceDir, path.sep), '').npm lsruns with the service directory as its working directory and prints real (symlink-resolved) paths. WhenserviceDirgoes through a symlink, as with AWS CodeBuild sources, the prefix never matches. Every dev dependency then stays an absolute path, fails thepackage.jsonlookup, and is bundled into the artifact.This change strips either the configured or the real service directory prefix, so the generated exclude globs are service-relative in both cases.
A new unit test packages a real project through a symlinked service directory and asserts that
node_modules/dev-pkg/**is excluded and the production dependency is kept. The test fails onmain(the exclude list contains only the user-defined pattern) and passes with this change.Summary by CodeRabbit