Rename scripts

This commit is contained in:
Joseph Garrone 2024-05-19 10:46:26 +02:00
parent d52252cd55
commit 189bd4697a
9 changed files with 24 additions and 17 deletions

View File

@ -3,6 +3,11 @@ import * as fs from "fs";
import { join } from "path";
import { assert } from "tsafe/assert";
import { transformCodebase } from "../src/bin/tools/transformCodebase";
import chalk from "chalk";
console.log(chalk.cyan("Building Keycloakify..."));
const startTime = Date.now();
if (fs.existsSync(join("dist", "bin", "main.original.js"))) {
fs.renameSync(join("dist", "bin", "main.original.js"), join("dist", "bin", "main.js"));
@ -71,8 +76,10 @@ fs.rmSync(join("dist", "ncc_out"), { "recursive": true });
patchDeprecatedBufferApiUsage(join("dist", "vite-plugin", "index.js"));
console.log(chalk.green(`✓ built in ${((Date.now() - startTime) / 1000).toFixed(2)}s`));
function run(command: string) {
console.log(`$ ${command}`);
console.log(chalk.grey(`$ ${command}`));
child_process.execSync(command, { "stdio": "inherit" });
}

View File

@ -2,7 +2,7 @@ import "minimal-polyfills/Object.fromEntries";
import * as fs from "fs";
import { join as pathJoin, relative as pathRelative, dirname as pathDirname, sep as pathSep } from "path";
import { crawl } from "../src/bin/tools/crawl";
import { downloadBuiltinKeycloakTheme } from "../src/bin/shared/downloadBuiltinKeycloakTheme";
import { downloadKeycloakDefaultTheme } from "../src/bin/shared/downloadKeycloakDefaultTheme";
import { getThisCodebaseRootDirPath } from "../src/bin/tools/getThisCodebaseRootDirPath";
import { rmSync } from "../src/bin/tools/fs.rmSync";
@ -25,7 +25,7 @@ async function main() {
fs.writeFileSync(pathJoin(tmpDirPath, ".gitignore"), Buffer.from("/*\n!.gitignore\n", "utf8"));
await downloadBuiltinKeycloakTheme({
await downloadKeycloakDefaultTheme({
keycloakVersion,
"destDirPath": tmpDirPath,
"buildOptions": {

View File

@ -1,7 +1,7 @@
import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
import { readBuildOptions } from "./shared/buildOptions";
import { downloadBuiltinKeycloakTheme } from "./shared/downloadBuiltinKeycloakTheme";
import { downloadKeycloakDefaultTheme } from "./shared/downloadKeycloakDefaultTheme";
import type { CliCommandOptions } from "./main";
import chalk from "chalk";
@ -27,7 +27,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
`Downloading builtins theme of Keycloak ${keycloakVersion} here ${chalk.bold(`.${pathSep}${pathRelative(process.cwd(), destDirPath)}`)}`
);
await downloadBuiltinKeycloakTheme({
await downloadKeycloakDefaultTheme({
keycloakVersion,
destDirPath,
buildOptions

View File

@ -1,4 +1,4 @@
import { downloadBuiltinKeycloakTheme } from "./shared/downloadBuiltinKeycloakTheme";
import { downloadKeycloakDefaultTheme } from "./shared/downloadKeycloakDefaultTheme";
import { join as pathJoin, relative as pathRelative } from "path";
import { transformCodebase } from "./tools/transformCodebase";
import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
@ -37,7 +37,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
rmSync(builtinKeycloakThemeTmpDirPath, { "recursive": true, "force": true });
await downloadBuiltinKeycloakTheme({
await downloadKeycloakDefaultTheme({
keycloakVersion,
"destDirPath": builtinKeycloakThemeTmpDirPath,
buildOptions

View File

@ -3,7 +3,7 @@ import { join as pathJoin } from "path";
import { assert } from "tsafe/assert";
import type { BuildOptions } from "../../shared/buildOptions";
import { resources_common, lastKeycloakVersionWithAccountV1, accountV1ThemeName } from "../../shared/constants";
import { downloadBuiltinKeycloakTheme } from "../../shared/downloadBuiltinKeycloakTheme";
import { downloadKeycloakDefaultTheme } from "../../shared/downloadKeycloakDefaultTheme";
import { transformCodebase } from "../../tools/transformCodebase";
import { rmSync } from "../../tools/fs.rmSync";
@ -20,7 +20,7 @@ export async function bringInAccountV1(params: { buildOptions: BuildOptionsLike
const builtinKeycloakThemeTmpDirPath = pathJoin(buildOptions.cacheDirPath, "bringInAccountV1_tmp");
await downloadBuiltinKeycloakTheme({
await downloadKeycloakDefaultTheme({
"destDirPath": builtinKeycloakThemeTmpDirPath,
"keycloakVersion": lastKeycloakVersionWithAccountV1,
buildOptions

View File

@ -107,13 +107,13 @@ program
program
.command({
"name": "download-builtin-keycloak-theme",
"name": "download-keycloak-default-theme",
"description": "Download the built-in Keycloak theme."
})
.task({
skip,
"handler": async cliCommandOptions => {
const { command } = await import("./download-builtin-keycloak-theme");
const { command } = await import("./download-keycloak-default-theme");
await command({ cliCommandOptions });
}
@ -121,13 +121,13 @@ program
program
.command({
"name": "eject-keycloak-page",
"name": "eject-page",
"description": "Eject a Keycloak page."
})
.task({
skip,
"handler": async cliCommandOptions => {
const { command } = await import("./eject-keycloak-page");
const { command } = await import("./eject-page");
await command({ cliCommandOptions });
}

View File

@ -5,7 +5,7 @@ import { assert } from "tsafe/assert";
import * as child_process from "child_process";
import * as fs from "fs";
import { rmSync } from "../tools/fs.rmSync";
import { lastKeycloakVersionWithAccountV1 } from "../shared/constants";
import { lastKeycloakVersionWithAccountV1 } from "./constants";
import { transformCodebase } from "../tools/transformCodebase";
export type BuildOptionsLike = {
@ -15,7 +15,7 @@ export type BuildOptionsLike = {
assert<BuildOptions extends BuildOptionsLike ? true : false>();
export async function downloadBuiltinKeycloakTheme(params: { keycloakVersion: string; destDirPath: string; buildOptions: BuildOptionsLike }) {
export async function downloadKeycloakDefaultTheme(params: { keycloakVersion: string; destDirPath: string; buildOptions: BuildOptionsLike }) {
const { keycloakVersion, destDirPath, buildOptions } = params;
await downloadAndUnzip({

View File

@ -1,6 +1,6 @@
import { transformCodebase } from "../tools/transformCodebase";
import { join as pathJoin } from "path";
import { downloadBuiltinKeycloakTheme } from "./downloadBuiltinKeycloakTheme";
import { downloadKeycloakDefaultTheme } from "./downloadKeycloakDefaultTheme";
import { resources_common, type ThemeType } from "./constants";
import type { BuildOptions } from "./buildOptions";
import { assert } from "tsafe/assert";
@ -27,7 +27,7 @@ export async function downloadKeycloakStaticResources(params: {
`downloadKeycloakStaticResources_tmp_${crypto.createHash("sha256").update(`${themeType}-${keycloakVersion}`).digest("hex").slice(0, 8)}`
);
await downloadBuiltinKeycloakTheme({
await downloadKeycloakDefaultTheme({
keycloakVersion,
"destDirPath": tmpDirPath,
buildOptions