Skip to content

Commit

Permalink
Remove engines.pnpm/yarn/npm in the the output package.json (#261)
Browse files Browse the repository at this point in the history
* Ignore engines.pnpm/yarn/npm

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>

---------

Co-authored-by: Dotan Simha <dotansimha@gmail.com>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
  • Loading branch information
3 people authored Jun 1, 2023
1 parent 6c23d24 commit 2af3e24
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-lamps-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'bob-the-bundler': patch
---

Remove engines.pnpm/yarn/npm in the the output package.json
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,16 @@
| false
| {
/** Files to copy from the package root to dist */
copy?: Array<string>;
};
copy?: Array<string>
}
/** Whether the package should be checked. */
check?:
| false
| {
/** Exports within the package that should not be checked. */
skip?: Array<string>;
};
};
skip?: Array<string>
}
}
```
## 2.0.0
Expand Down
9 changes: 9 additions & 0 deletions src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,15 @@ function rewritePackageJson(pkg: Record<string, any>) {
fields.forEach(field => {
if (pkg[field] !== undefined) {
newPkg[field] = pkg[field];
if (field === 'engines') {
// remove all package managers from engines field
const ignoredPackageManagers = ['npm', 'yarn', 'pnpm'];
for (const packageManager of ignoredPackageManagers) {
if (newPkg[field][packageManager]) {
delete newPkg[field][packageManager];
}
}
}
}
});

Expand Down
3 changes: 2 additions & 1 deletion test/__fixtures__/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "simple",
"type": "module",
"engines": {
"node": ">= 12.0.0"
"node": ">= 12.0.0",
"pnpm": ">= 8.0.0"
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down

0 comments on commit 2af3e24

Please sign in to comment.