Remove eslint and run prettier (changelog ignore)

This commit is contained in:
garronej
2021-10-11 21:35:40 +02:00
parent 9f8218efb7
commit 305ce9e44d
76 changed files with 27255 additions and 22419 deletions

View File

@ -1,39 +1,33 @@
import * as url from "url";
import * as fs from "fs";
import { join as pathJoin, dirname as pathDirname } from "path";
export function generateJavaStackFiles(
params: {
version: string;
themeName: string;
homepage?: string;
keycloakThemeBuildingDirPath: string;
}
): { jarFilePath: string; } {
const {
themeName,
version,
homepage,
keycloakThemeBuildingDirPath
} = params;
export function generateJavaStackFiles(params: {
version: string;
themeName: string;
homepage?: string;
keycloakThemeBuildingDirPath: string;
}): { jarFilePath: string } {
const { themeName, version, homepage, keycloakThemeBuildingDirPath } =
params;
{
const { pomFileCode } = (function generatePomFileCode(): { pomFileCode: string; } {
const { pomFileCode } = (function generatePomFileCode(): {
pomFileCode: string;
} {
const groupId = (() => {
const fallbackGroupId = `there.was.no.homepage.field.in.the.package.json.${themeName}`;
return (!homepage ?
fallbackGroupId :
url.parse(homepage).host?.replace(/:[0-9]+$/,"")?.split(".").reverse().join(".") ?? fallbackGroupId
) + ".keycloak";
return (
(!homepage
? fallbackGroupId
: url
.parse(homepage)
.host?.replace(/:[0-9]+$/, "")
?.split(".")
.reverse()
.join(".") ?? fallbackGroupId) + ".keycloak"
);
})();
const artefactId = `${themeName}-keycloak-theme`;
@ -49,51 +43,57 @@ export function generateJavaStackFiles(
` <version>${version}</version>`,
` <name>${artefactId}</name>`,
` <description />`,
`</project>`
`</project>`,
].join("\n");
return { pomFileCode };
})();
fs.writeFileSync(
pathJoin(keycloakThemeBuildingDirPath, "pom.xml"),
Buffer.from(pomFileCode, "utf8")
Buffer.from(pomFileCode, "utf8"),
);
}
{
const themeManifestFilePath = pathJoin(
keycloakThemeBuildingDirPath, "src", "main",
"resources", "META-INF", "keycloak-themes.json"
keycloakThemeBuildingDirPath,
"src",
"main",
"resources",
"META-INF",
"keycloak-themes.json",
);
try {
fs.mkdirSync(pathDirname(themeManifestFilePath));
} catch { }
} catch {}
fs.writeFileSync(
themeManifestFilePath,
Buffer.from(
JSON.stringify({
"themes": [
{
"name": themeName,
"types": ["login"]
}
]
}, null, 2),
"utf8"
)
JSON.stringify(
{
"themes": [
{
"name": themeName,
"types": ["login"],
},
],
},
null,
2,
),
"utf8",
),
);
}
return { "jarFilePath": pathJoin(keycloakThemeBuildingDirPath, "target", `${themeName}-${version}.jar`) };
return {
"jarFilePath": pathJoin(
keycloakThemeBuildingDirPath,
"target",
`${themeName}-${version}.jar`,
),
};
}