Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: compile as esm #888

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/input.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getInput } from '@actions/core';
import path from 'path';
import path from 'node:path';

export interface EnvironmentVariable {
key: string;
Expand Down
4 changes: 2 additions & 2 deletions src/renovate.ts
Original file line number Diff line number Diff line change
@@ -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:(?<groupId>[1-9][0-9]*):/m;
Expand Down
8 changes: 8 additions & 0 deletions tools/cjs-shim.ts
Original file line number Diff line number Diff line change
@@ -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);
3 changes: 2 additions & 1 deletion tools/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
3 changes: 0 additions & 3 deletions tools/package.json

This file was deleted.