Git 브랜치 lockfile
Git 브랜치 lockfile을 사용하면 lockfile 병합 충돌을 완전히 피하고 나중에 해결할 수 있습니다.
Git 브랜치 lockfile 사용#
이 기능은 pnpm-workspace.yaml 파일을 설정하여 활성화할 수 있습니다.
gitBranchLockfile: true
이렇게 하면 현재 브랜치 이름을 기반으로 lockfile 이름이 생성됩니다.
예를 들어, 현재 브랜치 이름이 feature-1이라고 가정합니다. 그러면 생성되는 lockfile 이름은 pnpm-lock.feature-1.yaml이 됩니다. 이를 Git에 커밋하고, 나중에 모든 Git 브랜치 lockfile을 병합할 수 있습니다.
- <project_folder>
|- pnpm-lock.yaml
|- pnpm-lock.feature-1.yaml
|- pnpm-lock.<branch_name>.yaml
참고
Every character in the branch name other than ASCII letters, digits, _, ., and - is converted to !,
and the name is lowercased. So the lockfile of the Feature/1 branch is pnpm-lock.feature!1.yaml.
A character outside the Basic Multilingual Plane, such as an emoji, becomes !!.
Git 브랜치 lockfile 병합#
pnpm install --merge-git-branch-lockfiles#
모든 git 브랜치 lockfile을 병합하려면 pnpm install 명령에 --merge-git-branch-lockfiles를 지정하기만 하면 됩니다.
After that, all git branch lockfiles will be merged into one pnpm-lock.yaml, and the branch lockfiles are deleted.
Branch matching#
pnpm은 현재 브랜치 이름을 매칭하여 --merge-git-branch-lockfiles를 지정할 수 있도록 합니다.
For instance, by the following setting in pnpm-workspace.yaml file, pnpm install will merge all git branch lockfiles when
running in the main branch or in a branch whose name starts with release.
mergeGitBranchLockfilesBranchPattern:
- main
- release*
See gitBranchLockfile and mergeGitBranchLockfilesBranchPattern for the setting reference.