Skip to content

feat(install): add --frozen-lockfile flag for CI environments - #10239

Open
zubeyralmaho wants to merge 3 commits into
teambit:masterfrom
zubeyralmaho:feat/frozen-lockfile
Open

feat(install): add --frozen-lockfile flag for CI environments#10239
zubeyralmaho wants to merge 3 commits into
teambit:masterfrom
zubeyralmaho:feat/frozen-lockfile

Conversation

@zubeyralmaho

@zubeyralmaho zubeyralmaho commented Mar 19, 2026

Copy link
Copy Markdown

Summary

  • Add --frozen-lockfile flag to the bit install command
  • When enabled, installation fails if the lockfile needs to be updated
  • Useful for CI environments to ensure reproducible builds

Changes

The flag flows through multiple layers:

  • CLI option in install.cmd.tsx
  • WorkspaceInstallOptions in install.main.runtime.ts
  • PackageManagerInstallOptions in package-manager.ts
  • pnpm integration in pnpm.package-manager.ts and lynx.ts

Test plan

  • Added E2E tests for both success and failure scenarios
  • Manual testing verified:
    • bit install --frozen-lockfile succeeds when lockfile is up to date
    • bit install --frozen-lockfile fails with clear error when lockfile needs update

Closes #5093

Add support for --frozen-lockfile option to the `bit install` command.
When enabled, installation will fail if the lockfile needs to be updated,
ensuring reproducible builds in CI environments.

The flag flows through:
- CLI (install.cmd.tsx)
- WorkspaceInstallOptions (install.main.runtime.ts)
- PackageManagerInstallOptions (package-manager.ts)
- pnpm integration (pnpm.package-manager.ts, lynx.ts)

Includes E2E tests verifying both success and failure scenarios.

Closes teambit#5093

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 19, 2026 16:21

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.

Pull request overview

Adds support for a --frozen-lockfile option to bit install, intended for CI usage to ensure installs don’t proceed when the lockfile would need changes.

Changes:

  • Introduce frozenLockfile?: boolean through InstallCmdOptionsWorkspaceInstallOptionsPackageManagerInstallOptions.
  • Wire the new option into the pnpm installer integration (lynx / pnpm.package-manager).
  • Add E2E coverage for success/failure behavior when using pnpm.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scopes/workspace/install/install.main.runtime.ts Plumbs frozenLockfile from workspace install options into package-manager install options.
scopes/workspace/install/install.cmd.tsx Adds --frozen-lockfile CLI flag and forwards it into WorkspaceInstallOptions.
scopes/dependencies/dependency-resolver/package-manager.ts Extends PackageManagerInstallOptions with frozenLockfile (with documentation).
scopes/dependencies/pnpm/pnpm.package-manager.ts Passes frozenLockfile into pnpm install execution options.
scopes/dependencies/pnpm/lynx.ts Adds frozenLockfile to pnpm core InstallOptions used by mutateModules.
e2e/harmony/install.e2e.ts Adds E2E tests for --frozen-lockfile success and failure scenarios (pnpm).

You can also share your feedback on Copilot code review. Take the survey.

],
['', 'no-optional [noOptional]', 'do not install optional dependencies (works with pnpm only)'],
['', 'lockfile-only', 'dependencies are not written to node_modules. Only the lockfile is updated'],
['', 'frozen-lockfile', 'fail if the lockfile needs to be updated (useful for CI environments)'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@zubeyralmaho yarn supports this flag as well. So, maybe let's pass it to yarn too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@zkochan Done! Added immutable option to Yarn's project.install() call, which is Yarn Berry's equivalent of --frozen-lockfile. Also skipped persistLockfile() when the flag is active.

Comment thread e2e/harmony/install.e2e.ts Outdated
@zkochan

zkochan commented Mar 19, 2026

Copy link
Copy Markdown
Member

Thanks for your contribution. I'll review the changes.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 19, 2026 18:01

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.

Pull request overview

Adds a --frozen-lockfile option to bit install intended for CI/reproducible installs by failing when the lockfile would need changes, and wires it through the install option layers into pnpm.

Changes:

  • Expose --frozen-lockfile on the bit install CLI and propagate it through WorkspaceInstallOptionsPackageManagerInstallOptions.
  • Pass the new option into the pnpm installer (via PnpmPackageManagerlynx.install).
  • Add E2E coverage for success (up-to-date lockfile) and failure (lockfile drift) scenarios.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scopes/workspace/install/install.main.runtime.ts Extends workspace install options and forwards frozenLockfile into package-manager install options.
scopes/workspace/install/install.cmd.tsx Adds the --frozen-lockfile CLI flag and passes it into InstallMain.install() options.
scopes/dependencies/dependency-resolver/package-manager.ts Extends PackageManagerInstallOptions with documented frozenLockfile.
scopes/dependencies/pnpm/pnpm.package-manager.ts Forwards frozenLockfile into pnpm install call options.
scopes/dependencies/pnpm/lynx.ts Plumbs frozenLockfile into pnpm core InstallOptions.
e2e/harmony/install.e2e.ts Adds E2E tests for --frozen-lockfile behavior (pnpm path).

You can also share your feedback on Copilot code review. Take the survey.

],
['', 'no-optional [noOptional]', 'do not install optional dependencies (works with pnpm only)'],
['', 'lockfile-only', 'dependencies are not written to node_modules. Only the lockfile is updated'],
['', 'frozen-lockfile', 'fail if the lockfile needs to be updated (useful for CI environments)'],
});
});
});

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants