Repository navigation
Angular: stop ignoring package-lock.json and yarn.lock - #4940
Open
NotAFlightRisk wants to merge 1 commit into
Open
NotAFlightRisk wants to merge 1 commit into
NotAFlightRisk wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change removes only the npm and Yarn lockfile exclusions while preserving other generated-file rules, with no active review issues identified.
No open issues 🎉
What changed in this PR
Updates the Angular .gitignore template so generated projects can commit npm and Yarn lockfiles for reproducible dependency installs.
Changes:
- Removes the rule ignoring
package-lock.json. - Removes the rule ignoring
yarn.lock. - Preserves existing exclusions for
node_modulesand other generated files.
| File | Description |
|---|---|
Angular.gitignore |
Stops excluding npm and Yarn lockfiles while retaining the existing ignore rules. |
Review effort: Lite (auto)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Link to the application or project's homepage
https://angular.dev
Reasons for making this change
This just takes out the two lockfile lines, so the
package-lock.jsonthatng newwrites (oryarn.lock, if you picked Yarn) gets committed along with the rest of the project.At the moment
git addskips it in a repo started from this template, so each clone gets whatever versions npm picks that day.npm ciwon't run at all on a fresh checkout - it stops with "can only install with an existing package-lock.json", and that's the install step in GitHub's own Node.js starter workflow.Links to documentation supporting these rule changes
npm says
package-lock.json"is intended to be committed into source repositories" (https://docs.npmjs.com/cli/v11/configuring-npm/package-lock-json) and Yarn says the same aboutyarn.lock, for apps and libraries alike (https://yarnpkg.com/getting-started/qa#should-lockfiles-be-committed-to-the-repository). The.gitignoreAngular CLI generates for new projects doesn't ignore either of them: https://github.com/angular/angular-cli/blob/main/packages/schematics/angular/workspace/files/__dot__gitignore.templateMerge and Approval Steps