Merge branch 'main' into i18n_extraLanguages_and_perThemeVariantTranslations
This commit is contained in:
@ -1,59 +1,8 @@
|
||||
import * as child_process from "child_process";
|
||||
import { transformCodebase } from "../src/bin/tools/transformCodebase";
|
||||
import { join as pathJoin, sep as pathSep } from "path";
|
||||
import { assert } from "tsafe/assert";
|
||||
|
||||
run("yarn build");
|
||||
run("npx build-storybook");
|
||||
|
||||
const storybookStaticDirPath = "storybook-static";
|
||||
|
||||
{
|
||||
let hasPatched = false;
|
||||
|
||||
transformCodebase({
|
||||
srcDirPath: storybookStaticDirPath,
|
||||
destDirPath: storybookStaticDirPath,
|
||||
transformSourceCode: ({ fileRelativePath, sourceCode }) => {
|
||||
replace_dot_keycloakify: {
|
||||
if (fileRelativePath.includes(pathSep)) {
|
||||
break replace_dot_keycloakify;
|
||||
}
|
||||
|
||||
if (!fileRelativePath.endsWith(".js")) {
|
||||
break replace_dot_keycloakify;
|
||||
}
|
||||
|
||||
const search = `DOT_KEYCLOAKIFY:".keycloakify"`;
|
||||
|
||||
if (!sourceCode.includes(search)) {
|
||||
break replace_dot_keycloakify;
|
||||
}
|
||||
|
||||
hasPatched = true;
|
||||
|
||||
return {
|
||||
modifiedSourceCode: Buffer.from(
|
||||
sourceCode
|
||||
.toString("utf8")
|
||||
.replace(search, `DOT_KEYCLOAKIFY:"dot_keycloakify"`),
|
||||
"utf8"
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
return { modifiedSourceCode: sourceCode };
|
||||
}
|
||||
});
|
||||
|
||||
assert(hasPatched);
|
||||
}
|
||||
|
||||
transformCodebase({
|
||||
srcDirPath: pathJoin(storybookStaticDirPath, ".keycloakify"),
|
||||
destDirPath: pathJoin(storybookStaticDirPath, "dot_keycloakify")
|
||||
});
|
||||
|
||||
function run(command: string, options?: { env?: NodeJS.ProcessEnv }) {
|
||||
console.log(`$ ${command}`);
|
||||
|
||||
|
@ -7,7 +7,7 @@ import { WELL_KNOWN_DIRECTORY_BASE_NAME } from "../../src/bin/shared/constants";
|
||||
import { assert, type Equals } from "tsafe/assert";
|
||||
import * as fsPr from "fs/promises";
|
||||
|
||||
export async function createPublicDotKeycloakifyDir() {
|
||||
export async function createPublicKeycloakifyDevResourcesDir() {
|
||||
await Promise.all(
|
||||
(["login", "account"] as const).map(async themeType => {
|
||||
const { extractedDirPath } = await downloadKeycloakDefaultTheme({
|
||||
@ -27,7 +27,7 @@ export async function createPublicDotKeycloakifyDir() {
|
||||
"dist",
|
||||
"res",
|
||||
"public",
|
||||
WELL_KNOWN_DIRECTORY_BASE_NAME.DOT_KEYCLOAKIFY,
|
||||
WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES,
|
||||
themeType
|
||||
);
|
||||
|
@ -3,7 +3,7 @@ import * as fs from "fs";
|
||||
import { join } from "path";
|
||||
import { assert } from "tsafe/assert";
|
||||
import { transformCodebase } from "../../src/bin/tools/transformCodebase";
|
||||
import { createPublicDotKeycloakifyDir } from "./createPublicDotKeycloakifyDir";
|
||||
import { createPublicKeycloakifyDevResourcesDir } from "./createPublicKeycloakifyDevResourcesDir";
|
||||
import { createAccountV1Dir } from "./createAccountV1Dir";
|
||||
import chalk from "chalk";
|
||||
|
||||
@ -144,7 +144,7 @@ import chalk from "chalk";
|
||||
fs.cpSync(dirBasename, destDirPath, { recursive: true });
|
||||
}
|
||||
|
||||
await createPublicDotKeycloakifyDir();
|
||||
await createPublicKeycloakifyDevResourcesDir();
|
||||
await createAccountV1Dir();
|
||||
|
||||
transformCodebase({
|
||||
|
Reference in New Issue
Block a user