Skip to content

Commit

Permalink
run patch in prepare script
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime committed Oct 24, 2023
1 parent 52ca6a0 commit c891d68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"scripts": {
"lint": "eslint . --report-unused-disable-directives",
"postinstall": "node tests/patch-esmock.js",
"prepare": "node tests/patch-esmock.js",
"release:generate:latest": "eslint-generate-release",
"release:generate:alpha": "eslint-generate-prerelease alpha",
"release:generate:beta": "eslint-generate-prerelease beta",
Expand Down
5 changes: 5 additions & 0 deletions tests/patch-esmock.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import { promises as fs } from "fs";
// 111 is the ABI version number of Node.js 19: https://nodejs.org/en/download/releases
if (process.versions.modules < 111) {
(async () => {
try {
await fs.access("node_modules/esmock_legacy");
} catch {
return;
}
await fs.rmdir("node_modules/esmock", { recursive: true });
await fs.rename("node_modules/esmock_legacy", "node_modules/esmock");
})();
Expand Down

0 comments on commit c891d68

Please sign in to comment.