chore!: move away from ESM

It turns out that Jest's ESM support still relies on experimental node
modules (as of node 18). Switch back to commonjs instead.
This commit is contained in:
Tom Keller
2022-10-15 18:09:41 -07:00
parent 239add3ff1
commit 921a07e77f
10 changed files with 174 additions and 82 deletions
+7 -6
View File
@@ -1,6 +1,5 @@
import * as url from 'node:url';
import * as core from '@actions/core';
import { errorMessage } from '../helpers.js';
import { errorMessage } from '../helpers';
/**
* When the GitHub Actions job is done, clean up any environment variables that
@@ -28,8 +27,10 @@ export async function cleanup() {
core.setFailed(errorMessage(error));
}
}
const modulePath = url.fileURLToPath(import.meta.url);
if (process.argv[1] === modulePath) {
await cleanup();
if (require.main === module) {
(async () => {
await cleanup();
})().catch((error) => {
core.setFailed(errorMessage(error));
});
}