Improved defaults for pnpm
npm install @pnpm/better-defaults> Improved defaults for pnpm
- Sets enableGlobalVirtualStore to true.
- Sets enablePrePostScripts to false.
- Sets hoistPattern to an empty array, disabling hoisting.
- Sets ignorePatchFailures 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:
`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:
`js`
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:
`js
const { updateConfig: makeBetterDefaults } = require('.pnpm-config/@pnpm/better-defaults/pnpmfile.cjs').hooks
module.exports = {
hooks: {
updateConfig (config) {
return {
...makeBetterDefaults(config),
hoistPattern: ['*'],
}
}
}
}
``
MIT