diff --git a/build.mjs b/build.mjs index c3dd263aa..92f00c79c 100644 --- a/build.mjs +++ b/build.mjs @@ -1,20 +1,55 @@ -import { rm } from "node:fs/promises"; +import { copyFile, rm } from "node:fs/promises"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import * as esbuild from "esbuild"; import { globSync } from "glob"; -import { copy } from "esbuild-plugin-copy"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); -const OUT_DIR = "lib"; +const SRC_DIR = join(__dirname, "src"); +const OUT_DIR = join(__dirname, "lib"); -await rm(join(__dirname, OUT_DIR), { recursive: true, force: true }); +/** + * Clean the output directory before building. + * + * @type {esbuild.Plugin} + */ +const cleanPlugin = { + name: "clean", + setup(build) { + build.onStart(async () => { + await rm(OUT_DIR, { recursive: true, force: true }); + }); + }, +}; -// This will just log when a build ends -/** @type {esbuild.Plugin} */ +/** + * Copy defaults.json to the output directory since other projects depend on it. + * + * @type {esbuild.Plugin} + */ +const copyDefaultsPlugin = { + name: "copy-defaults", + setup(build) { + build.onEnd(async () => { + await rm(join(OUT_DIR, "defaults.json"), { + force: true, + }); + await copyFile( + join(SRC_DIR, "defaults.json"), + join(OUT_DIR, "defaults.json"), + ); + }); + }, +} + +/** + * Log when the build ends. + * + * @type {esbuild.Plugin} + */ const onEndPlugin = { name: "on-end", setup(build) { @@ -25,20 +60,13 @@ const onEndPlugin = { }, }; -const copyDefaults = copy({ - assets: { - from: ["src/defaults.json"], - to: ["defaults.json"], - }, -}); - const context = await esbuild.context({ - entryPoints: globSync(["src/*-action.ts", "src/*-action-post.ts"]), + entryPoints: globSync([`${SRC_DIR}/*-action.ts`, `${SRC_DIR}/*-action-post.ts`]), bundle: true, format: "cjs", outdir: OUT_DIR, platform: "node", - plugins: [copyDefaults, onEndPlugin], + plugins: [cleanPlugin, copyDefaultsPlugin, onEndPlugin], }); await context.rebuild(); diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index be8b01046..c47f436fa 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -36446,7 +36446,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 5431a0a85..98b3386ab 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -36446,7 +36446,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 6f5ab69fc..78142078c 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -36446,7 +36446,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 3a1859f73..b2dc5fe7d 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -36446,7 +36446,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/lib/init-action.js b/lib/init-action.js index 49e2b4ae6..ec5032e4e 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -36446,7 +36446,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 1c841f724..76d8f0ab9 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -36446,7 +36446,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index e2fad828c..ba060abf5 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -36446,7 +36446,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 7f9aafcbd..725c55ba1 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -54974,7 +54974,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index cab4ab1a1..66a0d772b 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -36446,7 +36446,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 362a9f1b8..70d52083a 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -36446,7 +36446,6 @@ var require_package = __commonJS({ "@typescript-eslint/parser": "^8.40.0", ava: "^6.4.1", esbuild: "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", eslint: "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", diff --git a/package-lock.json b/package-lock.json index 6419f7335..6cfefa653 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,7 +61,6 @@ "@typescript-eslint/parser": "^8.40.0", "ava": "^6.4.1", "esbuild": "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", "eslint": "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2", @@ -3492,20 +3491,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/archiver": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/archiver/-/archiver-7.0.1.tgz", @@ -4088,19 +4073,6 @@ "node": "*" } }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/bindings": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", @@ -4314,31 +4286,6 @@ "node": ">=16" } }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, "node_modules/chownr": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", @@ -5082,55 +5029,6 @@ "@esbuild/win32-x64": "0.25.9" } }, - "node_modules/esbuild-plugin-copy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/esbuild-plugin-copy/-/esbuild-plugin-copy-2.1.1.tgz", - "integrity": "sha512-Bk66jpevTcV8KMFzZI1P7MZKZ+uDcrZm2G2egZ2jNIvVnivDpodZI+/KnpL3Jnap0PBdIHU7HwFGB8r+vV5CVw==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.1.2", - "chokidar": "^3.5.3", - "fs-extra": "^10.0.1", - "globby": "^11.0.3" - }, - "peerDependencies": { - "esbuild": ">= 0.14.0" - } - }, - "node_modules/esbuild-plugin-copy/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/esbuild-plugin-copy/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -6111,40 +6009,10 @@ "version": "0.0.1-security", "license": "ISC" }, - "node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "license": "ISC" }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "license": "MIT", @@ -6664,19 +6532,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/is-boolean-object": { "version": "1.1.2", "dev": true, @@ -7047,19 +6902,6 @@ "json5": "lib/cli.js" } }, - "node_modules/jsonfile": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", - "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", - "dev": true, - "license": "MIT", - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/jsonschema": { "version": "1.4.1", "license": "MIT", @@ -8076,19 +7918,6 @@ "node": ">=10" } }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, "node_modules/regexp.prototype.flags": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", @@ -9299,16 +9128,6 @@ "version": "6.0.0", "license": "ISC" }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/unzip-stream": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/unzip-stream/-/unzip-stream-0.3.4.tgz", diff --git a/package.json b/package.json index f51f319cd..816ca14f0 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "@typescript-eslint/parser": "^8.40.0", "ava": "^6.4.1", "esbuild": "^0.25.9", - "esbuild-plugin-copy": "^2.1.1", "eslint": "^8.57.1", "eslint-import-resolver-typescript": "^3.8.7", "eslint-plugin-filenames": "^1.3.2",