From 695802fe3b6178aa74f9de2e0d293e9b49b5c3e2 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Sun, 31 May 2026 17:14:02 -0400 Subject: [PATCH] Add packageConfigs to pnpm-workspace schema --- src/schemas/json/pnpm-workspace.json | 49 +++++++++++++++++++ .../pnpm-workspace/package-configs-array.yaml | 9 ++++ src/test/pnpm-workspace/pnpm-workspace.yaml | 6 +++ 3 files changed, 64 insertions(+) create mode 100644 src/test/pnpm-workspace/package-configs-array.yaml diff --git a/src/schemas/json/pnpm-workspace.json b/src/schemas/json/pnpm-workspace.json index aa17bf63c8e..8ab29d83fce 100644 --- a/src/schemas/json/pnpm-workspace.json +++ b/src/schemas/json/pnpm-workspace.json @@ -61,6 +61,38 @@ "description": "Define dependency version ranges as reusable constants,\nfor later reference in package.json files.\nThis (singular) field creates a catalog named default.\n", "type": "object", "minProperties": 1 + }, + "packageConfig": { + "description": "Per-package pnpm configuration applied to workspace projects matched by package name or selector.", + "type": "object", + "additionalProperties": true, + "properties": { + "match": { + "description": "Workspace project names or selectors matched by this package configuration.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + } + }, + "modulesDir": { + "description": "The directory in which dependencies will be installed.", + "type": "string" + }, + "saveExact": { + "description": "Saved dependencies will be configured with an exact version rather than using pnpm's default semver range operator.", + "type": "boolean" + }, + "savePrefix": { + "description": "Configure how versions of packages installed to a package.json file get prefixed.", + "oneOf": [ + { + "type": "string", + "enum": ["^", "~", ""] + } + ] + } + } } }, "properties": { @@ -136,6 +168,23 @@ }, "additionalProperties": false }, + "packageConfigs": { + "description": "Per-workspace-project pnpm settings that replace project-specific .npmrc files.", + "oneOf": [ + { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/packageConfig" + } + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/packageConfig" + } + } + ] + }, "peerDependencyRules": { "type": "object", "properties": { diff --git a/src/test/pnpm-workspace/package-configs-array.yaml b/src/test/pnpm-workspace/package-configs-array.yaml new file mode 100644 index 00000000000..cc1f387cedc --- /dev/null +++ b/src/test/pnpm-workspace/package-configs-array.yaml @@ -0,0 +1,9 @@ +# yaml-language-server: $schema=../../schemas/json/pnpm-workspace.json +# https://pnpm.io/pnpm-workspace_yaml +packages: + - packages/* + +packageConfigs: + - match: ['project-1', 'project-2'] + modulesDir: node_modules + saveExact: true diff --git a/src/test/pnpm-workspace/pnpm-workspace.yaml b/src/test/pnpm-workspace/pnpm-workspace.yaml index 8e119496a15..5a6ed46d0ff 100644 --- a/src/test/pnpm-workspace/pnpm-workspace.yaml +++ b/src/test/pnpm-workspace/pnpm-workspace.yaml @@ -3,6 +3,12 @@ packages: - packages/* +packageConfigs: + project-1: + saveExact: true + project-2: + savePrefix: '~' + catalog: chalk: ^4.1.2