diff --git a/commitlint.config.mjs b/commitlint.config.js similarity index 100% rename from commitlint.config.mjs rename to commitlint.config.js diff --git a/eslint.config.mjs b/eslint.config.js similarity index 100% rename from eslint.config.mjs rename to eslint.config.js diff --git a/package.json b/package.json index 6df2c637b19..d140369babe 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "license": "GPL-3.0-or-later", "author": "Jeroen de Bruijn", + "type": "module", "main": "src/index.ts", "scripts": { "build": "run-s clean compile", diff --git a/src/input.ts b/src/input.ts index 41c1d00d0f4..5d23443f2a9 100644 --- a/src/input.ts +++ b/src/input.ts @@ -1,5 +1,5 @@ import { getInput } from '@actions/core'; -import path from 'path'; +import path from 'node:path'; export interface EnvironmentVariable { key: string; diff --git a/src/renovate.ts b/src/renovate.ts index 345504d1cd7..39ba75c59ef 100644 --- a/src/renovate.ts +++ b/src/renovate.ts @@ -1,8 +1,8 @@ import { Docker } from './docker'; import { Input } from './input'; import { exec } from '@actions/exec'; -import fs from 'fs/promises'; -import path from 'path'; +import fs from 'node:fs/promises'; +import path from 'node:path'; export class Renovate { static dockerGroupRegex = /^docker:x:(?[1-9][0-9]*):/m; diff --git a/tools/cjs-shim.ts b/tools/cjs-shim.ts new file mode 100644 index 00000000000..48bcca48061 --- /dev/null +++ b/tools/cjs-shim.ts @@ -0,0 +1,8 @@ +// https://github.com/evanw/esbuild/issues/1921#issuecomment-1898197331 +import { createRequire } from 'node:module'; +import path from 'node:path'; +import url from 'node:url'; + +globalThis.require = createRequire(import.meta.url); +globalThis.__filename = url.fileURLToPath(import.meta.url); +globalThis.__dirname = path.dirname(__filename); diff --git a/tools/compile.js b/tools/compile.js index 8668d15a461..a7e32f84e42 100644 --- a/tools/compile.js +++ b/tools/compile.js @@ -9,6 +9,7 @@ await build({ minify: !!env['CI'], tsconfig: 'tsconfig.dist.json', sourcemap: true, - // format: 'esm', // TODO: later PR + format: 'esm', outdir: './dist/', + inject: ['tools/cjs-shim.ts'], // https://github.com/evanw/esbuild/issues/1921#issuecomment-1898197331 }); diff --git a/tools/package.json b/tools/package.json deleted file mode 100644 index 3dbc1ca591c..00000000000 --- a/tools/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -}