fix(publish): remove the "pnpm" settings from package.json

The "pnpm" settings should not be published with the package
to the registry.

PR #3081
This commit is contained in:
Zoltan Kochan
2021-01-18 12:37:03 +02:00
committed by GitHub
parent af897c3246
commit c854f85472
5 changed files with 34 additions and 6 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/exportable-manifest": minor
---
Remove the "pnpm" property that stores pnpm settings from the manifest.

View File

@@ -0,0 +1 @@
module.exports = require('../../jest.config.js')

View File

@@ -12,10 +12,11 @@
"node": ">=10.16"
},
"scripts": {
"lint": "eslint -c ../../eslint.json src/**/*.ts",
"test": "pnpm run compile",
"lint": "eslint -c ../../eslint.json src/**/*.ts test/**/*.ts",
"test": "pnpm run compile && pnpm run _test",
"prepublishOnly": "pnpm run compile",
"compile": "rimraf lib tsconfig.tsbuildinfo && tsc --build"
"compile": "rimraf lib tsconfig.tsbuildinfo && tsc --build",
"_test": "jest"
},
"repository": "https://github.com/pnpm/pnpm/blob/master/packages/exportable-manifest",
"keywords": [

View File

@@ -22,9 +22,7 @@ const PUBLISH_CONFIG_WHITELIST = new Set([
])
export default async function makePublishManifest (dir: string, originalManifest: ProjectManifest) {
const publishManifest = {
...originalManifest,
}
const publishManifest = R.omit(['pnpm'], originalManifest)
for (const depsField of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
const deps = await makePublishDependencies(dir, originalManifest[depsField])
if (deps) {

View File

@@ -0,0 +1,23 @@
/// <reference path="../../../typings/index.d.ts"/>
import exportableManifest from '@pnpm/exportable-manifest'
test('the pnpm options are removed', async () => {
expect(await exportableManifest(process.cwd(), {
name: 'foo',
version: '1.0.0',
dependencies: {
qar: '2',
},
pnpm: {
overrides: {
bar: '1',
},
},
})).toStrictEqual({
name: 'foo',
version: '1.0.0',
dependencies: {
qar: '2',
},
})
})