Git Branch Lockfiles
Git branch lockfiles allows you to totally avoid lockfile merge conflicts and solve it later.
Use git branch lockfiles
You can turn on this feature by configuring the.npmrc
file.
git-branch-lockfile=true
By doing this, lockfile name will be generated based on the current branch name.
For instance, the current branch name isfeature-1
. Then, the generated lockfile name willbepnpm-lock.feature-1.yaml
. You can commit it to the Git, and merge all git branch lockfiles later.
- <project_folder>
|- pnpm-lock.yaml
|- pnpm-lock.feature-1.yaml
|- pnpm-lock.<branch_name>.yaml
feature/1
is special in that the/
is automatically converted to!
, so the correspondinglockfile name would bepnpm-lock.feature!1.yaml
.
Merge git branch lockfiles
pnpm install --merge-git-branch-lockfiles
To merge all git branch lockfiles, just specify--merge-git-branch-lockfiles
topnpm install
command.
After that, all git branch lockfiles will be merged into onepnpm-lock.yaml
Branch Matching
pnpm allows you to specify--merge-git-branch-lockfiles
by matching the current branch name.
For instance, by the following setting in.npmrc
file,pnpm install
will merge all git branch lockfiles whenrunning in themain
branch and the branch name starts withrelease
.
merge-git-branch-lockfiles-branch-pattern[]=main
merge-git-branch-lockfiles-branch-pattern[]=release*