Skip to content

Commit 8b3e1c1

Browse files
Sync cli docs (#1956)
sync cli docs Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com>
1 parent 8143aa5 commit 8b3e1c1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

apps/svelte.dev/content/docs/cli/50-api/20-sv-utils.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,20 @@ Namespaced helpers for AST manipulation:
233233
234234
## Package manager helpers
235235
236-
### `pnpm.onlyBuiltDependencies`
236+
### `pnpm.allowBuilds`
237237
238-
Returns a transform for `pnpm-workspace.yaml` that adds packages to the `onlyBuiltDependencies` list. Use with `sv.file` when the project uses pnpm.
238+
Returns a transform for `pnpm-workspace.yaml` that adds packages to the pnpm "allow builds" config. Use with `sv.file` when the project uses pnpm.
239+
240+
The helper detects the installed pnpm version via `pnpm --version`:
241+
242+
- pnpm `>= 11`: writes to the unified `allowBuilds` map (`{ pkg: true }`), migrating any legacy `onlyBuiltDependencies` list into the map.
243+
- pnpm `< 11`: writes to the legacy `onlyBuiltDependencies` list.
239244
240245
```js
241246
// @noErrors
242247
import { pnpm } from '@sveltejs/sv-utils';
243248

244249
if (packageManager === 'pnpm') {
245-
sv.file(file.findUp('pnpm-workspace.yaml'), pnpm.onlyBuiltDependencies('my-native-dep'));
250+
sv.file(file.findUp('pnpm-workspace.yaml'), pnpm.allowBuilds('my-native-dep'));
246251
}
247252
```

0 commit comments

Comments
 (0)