web: Bump types, fix ESLint errors (#17546)

* Fix config.

* Fix linter.

* Fix ts ignore comments.

* Fix empty functions

* Fix unnamed functions.

* Fix unused parameters.

* Fix define before use.

* Remove unused.

* Replace esbuild-copy-plugin with `fs` module.

---------

Co-authored-by: Teffen Ellis <teffen@goauthentik.io>
This commit is contained in:
dependabot[bot]
2025-12-06 20:21:29 +00:00
committed by GitHub
parent 31b0e73329
commit 8e87585fce
70 changed files with 642 additions and 668 deletions
+52 -17
View File
@@ -24,7 +24,6 @@ import { BuildIdentifier } from "@goauthentik/core/version/node";
import { deepmerge } from "deepmerge-ts";
import esbuild from "esbuild";
import { copy } from "esbuild-plugin-copy";
/// <reference types="../types/esbuild.js" />
@@ -37,6 +36,22 @@ const publicBundledDefinitions = Object.fromEntries(
);
logger.info(publicBundledDefinitions, "Bundle definitions");
/**
* @typedef {[from: string, to: string]} SourceDestinationPair
*/
/**
* @type {SourceDestinationPair[]}
*/
const assets = [
[
path.join(path.dirname(EntryPoint.StandaloneLoading.in), "startup"),
path.dirname(EntryPoint.StandaloneLoading.out),
],
[path.resolve(PackageRoot, "src", "assets", "images"), "./assets/images"],
[path.resolve(PackageRoot, "icons"), "./assets/icons"],
];
/**
* @type {Readonly<BuildOptions>}
*/
@@ -63,22 +78,42 @@ const BASE_ESBUILD_OPTIONS = {
".svg": "file",
},
plugins: [
copy({
assets: [
{
from: path.join(path.dirname(EntryPoint.StandaloneLoading.in), "startup", "**"),
to: path.dirname(EntryPoint.StandaloneLoading.out),
},
{
from: path.resolve(PackageRoot, "src", "assets", "images", "**"),
to: "./assets/images",
},
{
from: path.resolve(PackageRoot, "icons", "*"),
to: "./assets/icons",
},
],
}),
{
name: "copy",
setup(build) {
build.onEnd(async () => {
/**
* @type {import('esbuild').PartialMessage[]}
*/
const errors = [];
/**
* @param {SourceDestinationPair} pair
*/
const copy = ([from, to]) => {
const resolvedDestination = path.resolve(DistDirectory, to);
logger.debug(`📋 Copying assets from ${from} to ${to}`);
return fs
.cp(from, resolvedDestination, { recursive: true })
.catch((error) => {
errors.push({
text: `Failed to copy assets from ${from} to ${to}: ${error}`,
location: {
file: from,
},
});
});
};
await Promise.all(assets.map(copy));
return { errors };
});
},
},
mdxPlugin({
root: MonoRepoRoot,
}),