fix: warn when no lockfile present (package-lock.json | npm-shrinkwrap.json) [#852] #867
+32
−10
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.
Title
fix: only warn when no lockfile present (package-lock.json | npm-shrinkwrap.json) (#852)
Body
Summary: Avoid a misleading "PRO TIP" when an app has npm-shrinkwrap.json vendored. The buildpack should not warn about a missing package-lock.json if an equivalent lockfile exists.
Root cause: NoPackageLockTip() iterated lockfile names and emitted the tip on the first missing file instead of checking whether any supported lockfile exists.
Changes: Update NoPackageLockTip() in supply.go to check for any existing lockfile before warning and adjust the message to reference package-lock.json or npm-shrinkwrap.json (or yarn.lock for Yarn). Added unit tests in supply_test.go covering both the positive and negative cases.
Tests: Added unit tests for the NoPackageLockTip() behavior. CI should run the test suite; if you run locally you may see platform-specific issues building test binaries (I observed a macOS dyld build abort), but the code and tests are committed.
Related: Issue #852.