feat: setting only-built-dependencies through .npmrc

This commit is contained in:
Zoltan Kochan
2022-07-29 03:43:35 +03:00
parent cac34ad690
commit 99019e0716
4 changed files with 13 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": minor
"@pnpm/plugin-commands-installation": minor
---
Allow to set `only-built-dependencies[]` through `.npmrc`.

View File

@@ -148,6 +148,7 @@ export interface Config {
embedReadme?: boolean
gitShallowHosts?: string[]
legacyDirFiltering?: boolean
onlyBuiltDependencies?: string[]
registries: Registries
ignoreWorkspaceRootCheck: boolean

View File

@@ -80,6 +80,7 @@ export const types = Object.assign({
noproxy: String,
'npm-path': String,
offline: Boolean,
'only-built-dependencies': [String],
'package-import-method': ['auto', 'hardlink', 'clone', 'copy'],
pnpmfile: String,
'prefer-frozen-lockfile': Boolean,

View File

@@ -24,13 +24,16 @@ export default function getOptionsFromRootManifest (manifest: ProjectManifest):
const peerDependencyRules = manifest.pnpm?.peerDependencyRules
const allowedDeprecatedVersions = manifest.pnpm?.allowedDeprecatedVersions
const patchedDependencies = manifest.pnpm?.patchedDependencies
return {
const settings = {
allowedDeprecatedVersions,
overrides,
neverBuiltDependencies,
onlyBuiltDependencies,
packageExtensions,
peerDependencyRules,
patchedDependencies,
}
if (onlyBuiltDependencies) {
settings['onlyBuiltDependencies'] = onlyBuiltDependencies
}
return settings
}