Improved defaults for pnpm
- Sets enablePrePostScripts to
false
. - Sets optimisticRepeatInstall to
true
. - Sets resolutionMode to
lowest-direct
. - Sets verifyDepsBeforeRun to
install
.
You can extend or override these settings in your own .pnpmfile.cjs
.
pnpm add --config @pnpm/better-defaults
This will add @pnpm/better-defaults
to the configDependencies field in your pnpm-workspace.yaml
.
If you don't have a pnpmfile in your project, then add this to pnpm-workspace.yaml
:
pnpmfile: node_modules/.pnpm-config/@pnpm/better-defaults/pnpmfile.cjs
If you have a .pnpmfile.cjs
already in your project, then you can reexport the updateConfig
hooks from @pnpm/better-defaults
. This should be your .pnpmfile.cjs
:
module.exports = {
hooks: {
...require('.pnpm-config/@pnpm/better-defaults/pnpmfile.cjs').hooks,
// Other hooks in your project
}
}
Alternatively, you may have other changes in your updateConfig
hook:
const { updateConfig: makeBetterDefaults } = require('.pnpm-config/@pnpm/better-defaults/pnpmfile.cjs').hooks
module.exports = {
hooks: {
updateConfig (config) {
return {
...makeBetterDefaults(config),
hoistPattern: ['*'],
}
}
}
}
MIT