Convert project to ESM and update dependencies (#854)

- Switch to esbuild for bundling
- Update npm dependency version
- Add require header for compat with older JS libs
This commit is contained in:
Daz DeBoer
2026-02-10 15:30:49 -07:00
committed by GitHub
parent d9d9739be8
commit 2b9247147a
8 changed files with 901 additions and 446 deletions

View File

@@ -1,9 +1,11 @@
import path from 'path'
import fs from 'fs'
import {fileURLToPath} from 'url'
export function readResourceFileAsString(...paths: string[]): string {
// Resolving relative to __dirname will allow node to find the resource at runtime
const absolutePath = path.resolve(__dirname, '..', '..', '..', 'sources', 'src', 'resources', ...paths)
const moduleDir = path.dirname(fileURLToPath(import.meta.url))
const absolutePath = path.resolve(moduleDir, '..', '..', '..', 'sources', 'src', 'resources', ...paths)
return fs.readFileSync(absolutePath, 'utf8')
}

View File

@@ -2,11 +2,11 @@ import * as core from '@actions/core'
import * as github from '@actions/github'
import * as cache from '@actions/cache'
import * as deprecator from './deprecation-collector'
import {SUMMARY_ENV_VAR} from '@actions/core/lib/summary'
import path from 'path'
import * as path from 'path'
const ACTION_ID_VAR = 'GRADLE_ACTION_ID'
const SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'
export const ACTION_METADATA_DIR = '.setup-gradle'