Migrating from v10

pnpm v11 introduced several breaking changes to how configuration is read and which settings are available, and pnpm v12 retains those changes. 대부분의 설정 변경은 기계적이어서 codemod로 적용할 수 있으며, 나머지는 사람이 직접 확인해야 합니다. Apply them when moving from pnpm v10 to either newer major. When moving to pnpm 12, also follow Migrating from pnpm 11.

Codemod 실행하기#

cd /path/to/your/project
pnx codemod run pnpm-v10-to-v11   # pnpx on pnpm v10
# or
pnpm add --global codemod
codemod run pnpm-v10-to-v11

해당 codemod는 다음 사항을 자동으로 적용합니다:

  • 설정을 package.json#pnpm에서 pnpm-workspace.yaml로 옮깁니다. 버전 v11에서 pnpm은 더 이상 package.json의 pnpm 필드에서 설정을 읽지 않습니다.
  • .npmrc를 인증/레지스트리 설정과 그 외 설정으로 분리합니다. v11은 .npmrc에서 인증 및 레지스트리 설정만 읽습니다. Every other setting (hoist-pattern, node-linker, save-exact, and so on) is moved into pnpm-workspace.yaml with a camelCase key. 하위 프로젝트별 .npmrc 파일은 packageConfigs["<project-name>"] 아래에 배치됩니다.
  • 빌드 종속성 설정을 allowBuilds로 통합합니다. onlyBuiltDependencies, neverBuiltDependencies, ignoredBuiltDependencies, onlyBuiltDependenciesFile은 단일 allowBuilds 맵({ name: true | false })으로 병합됩니다.
  • 패키지 관리자 엄격성 설정을 pmOnFail로 대체합니다. managePackageManagerVersions, packageManagerStrict, packageManagerStrictVersion은 하나의 pmOnFail: download | ignore | warn | error 설정으로 통합됩니다.
  • Renames allowNonAppliedPatches → allowUnusedPatches, and auditConfig.ignoreCves → auditConfig.ignoreGhsas (the key is renamed; CVE IDs still need to be converted to GHSA IDs manually; see below).
  • useNodeVersion을 루트 package.json의 devEngines.runtime 항목으로 변환합니다.
  • Bumps packageManager in package.json to the target pnpm version.

수동 후속 작업#

다음 변경 사항은 자동화할 수 없으므로 사람이 직접 확인해야 합니다:

  • CVE → GHSA. auditConfig.ignoreCves의 이름이 auditConfig.ignoreGhsas로 변경되었습니다. 각 CVE-YYYY-NNNNN 항목을 일치하는 GHSA-xxxx-xxxx-xxxx ID(pnpm audit 출력의 "More info" 열에 표시됨)로 바꾸세요.
  • **ignorePatchFailures**가 제거되었습니다. 이제 실패한 패치는 항상 오류를 발생시킵니다. 패치를 수정하거나 종속성을 제거하세요.
  • 워크스페이스 하위 패키지의 package.json#pnpm에 있는 **executionEnv.nodeVersion**이 제거되었습니다. 대신 해당 하위 패키지의 devEngines.runtime에 런타임을 선언하세요.
  • npm_config_* 환경 변수는 더 이상 읽지 않습니다. 이 변수가 설정된 모든 곳(CI 설정, 셸 프로필, Docker 이미지)에서 pnpm_config_*로 이름을 변경하세요.
  • Docker images need to copy pnpm-workspace.yaml if the project has one. Copy it before pnpm install so project settings and workspace package patterns are available (see Working with Docker).
  • **pnpm link <pkg-name>**은 더 이상 글로벌 스토어에서 패키지를 해석하지 않습니다. 상대 경로 또는 절대 경로(pnpm link ./foo)를 사용하세요.
  • pnpm install -g(인수 없이 실행)는 더 이상 지원되지 않습니다. 대신 pnpm add -g <pkg>을 사용하세요.
  • **pnpm server**는 대체 기능 없이 제거되었습니다.
  • 스크립트 이름이 내장 명령보다 우선합니다. If your package.json defines a script with the name of certain built-in commands, such as clean or deploy, pnpm <name> now runs the script instead of the built-in command. See Built-in command and script name conflicts for the full list.

For the full list of breaking changes, see the v11 changelog.