Skip to content

Angular: stop ignoring package-lock.json and yarn.lock - #4940

Open
NotAFlightRisk wants to merge 1 commit into
github:mainfrom
NotAFlightRisk:angular-commit-lockfiles
Open

NotAFlightRisk wants to merge 1 commit into
github:mainfrom
NotAFlightRisk:angular-commit-lockfiles

Conversation

@NotAFlightRisk

Copy link
Copy Markdown
Contributor

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.json that ng new writes (or yarn.lock, if you picked Yarn) gets committed along with the rest of the project.

At the moment git add skips it in a repo started from this template, so each clone gets whatever versions npm picks that day. npm ci won'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 about yarn.lock, for apps and libraries alike (https://yarnpkg.com/getting-started/qa#should-lockfiles-be-committed-to-the-repository). The .gitignore Angular 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.template

Merge and Approval Steps

@NotAFlightRisk
NotAFlightRisk requested a review from a team as a code owner November 9, 2026 16:08
Copilot AI auto review requested due to automatic review settings November 9, 2026 16:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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_modules and other generated files.
File Description
Angular.gitignore Stops excluding npm and Yarn lockfiles while retaining the existing ignore rules.

Review effort: Lite (auto)

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.

2 participants