-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @fileoverview Run by npm to replace esmock with a legacy release on older versions of Node.js. | ||
* @author Francesco Trotta | ||
*/ | ||
|
||
import { promises as fs } from "fs"; | ||
|
||
// esmock < 2.4 supports only Node.js < 19. esmock >= 2.4 supports only Node.js >= 18.6. | ||
// If we are running Node.js < 19, replace the esmock dependency with the legacy release. | ||
if (process.versions.modules < 111) { | ||
(async () => { | ||
await fs.rmdir("node_modules/esmock", { recursive: true }); | ||
await fs.rename("node_modules/esmock_legacy", "node_modules/esmock"); | ||
})(); | ||
} |