Skip to content

Commit 2af3e24

Browse files
gilgardoshdotansimhadimaMachina
authored
Remove engines.pnpm/yarn/npm in the the output package.json (#261)
* Ignore engines.pnpm/yarn/npm Co-authored-by: Dimitri POSTOLOV <[email protected]> --------- Co-authored-by: Dotan Simha <[email protected]> Co-authored-by: Dimitri POSTOLOV <[email protected]>
1 parent 6c23d24 commit 2af3e24

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

.changeset/shaggy-lamps-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'bob-the-bundler': patch
3+
---
4+
5+
Remove engines.pnpm/yarn/npm in the the output package.json

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,16 @@
316316
| false
317317
| {
318318
/** Files to copy from the package root to dist */
319-
copy?: Array<string>;
320-
};
319+
copy?: Array<string>
320+
}
321321
/** Whether the package should be checked. */
322322
check?:
323323
| false
324324
| {
325325
/** Exports within the package that should not be checked. */
326-
skip?: Array<string>;
327-
};
328-
};
326+
skip?: Array<string>
327+
}
328+
}
329329
```
330330
331331
## 2.0.0

src/commands/build.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,15 @@ function rewritePackageJson(pkg: Record<string, any>) {
373373
fields.forEach(field => {
374374
if (pkg[field] !== undefined) {
375375
newPkg[field] = pkg[field];
376+
if (field === 'engines') {
377+
// remove all package managers from engines field
378+
const ignoredPackageManagers = ['npm', 'yarn', 'pnpm'];
379+
for (const packageManager of ignoredPackageManagers) {
380+
if (newPkg[field][packageManager]) {
381+
delete newPkg[field][packageManager];
382+
}
383+
}
384+
}
376385
}
377386
});
378387

test/__fixtures__/simple/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "simple",
33
"type": "module",
44
"engines": {
5-
"node": ">= 12.0.0"
5+
"node": ">= 12.0.0",
6+
"pnpm": ">= 8.0.0"
67
},
78
"main": "dist/cjs/index.js",
89
"module": "dist/esm/index.js",

0 commit comments

Comments
 (0)