File tree Expand file tree Collapse file tree
apps/svelte.dev/content/docs/cli/50-api Expand file tree Collapse file tree Original file line number Diff line number Diff 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
242247import { pnpm } from ' @sveltejs/sv-utils' ;
243248
244249if (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` ` `
You can’t perform that action at this time.
0 commit comments