mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-11 02:29:48 -04:00
* build: bundle `dist/node_modules` using pnpm deploy * chore: remove copied `pnpm.overrides` for publish-packed * chore: remove `catalog:` protocol ban in `pnpm/package.json` * chore: remove `publish-packed` dependency * build: move `node-gyp` from `optionalDependencies` to `dependencies` The `node-gyp` dependency is bundled into the `pnpm` package before it's published. The dependency declaration itself is then removed from the published package manifest. This means there's not a point to declaring `node-gyp` as an optional dependency. It'll always be bundled and the published manifest doesn't contain the dependency declaration. https://github.com/pnpm/pnpm/pull/10508#discussion_r2782257620 * build: throw if peerDependencies or optionalDependencies are declared * build: use meta-updater instead of Jest test for dep kind check
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
module.exports = {
|
|
hooks: {
|
|
readPackage: (manifest) => {
|
|
if (manifest.name === '@reflink/reflink') {
|
|
for (const depName of Object.keys(manifest.optionalDependencies)) {
|
|
// We don't need refclone on Linux as Node.js supports reflinks out of the box on Linux
|
|
if (depName.includes('linux')) {
|
|
delete manifest.optionalDependencies[depName]
|
|
}
|
|
}
|
|
}
|
|
return manifest
|
|
},
|
|
|
|
beforePacking: (manifest) => {
|
|
// The main pnpm package bundles its dependencies before publishing.
|
|
// Delete dependency fields from the manifest so these dependencies are
|
|
// downloaded twice.
|
|
if (manifest.name === 'pnpm') {
|
|
delete manifest.dependencies
|
|
delete manifest.devDependencies
|
|
|
|
for (const depKind of ['peerDependencies', 'optionalDependencies']) {
|
|
if (Object.keys(manifest[depKind] ?? {}).length > 0) {
|
|
throw new Error(`The main 'pnpm' package should not declare '${depKind}'. Consider moving to 'devDependencies' if the dependency can be included in the esbuild bundle, or to 'dependencies' if the dependency needs to be externalized and resolved at runtime.`)
|
|
}
|
|
}
|
|
}
|
|
|
|
return manifest
|
|
}
|
|
}
|
|
}
|