Fix script for account and email
This commit is contained in:
parent
d4e1dabe12
commit
fa6a37880b
@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"keycloakify": "dist/bin/keycloakify/index.js",
|
"keycloakify": "dist/bin/keycloakify/index.js",
|
||||||
"create-keycloak-email-directory": "dist/bin/create-keycloak-email-directory.js",
|
"initialize-email-theme": "dist/bin/initialize-email-theme.js",
|
||||||
"download-builtin-keycloak-theme": "dist/bin/download-builtin-keycloak-theme.js",
|
"download-builtin-keycloak-theme": "dist/bin/download-builtin-keycloak-theme.js",
|
||||||
"eject-keycloak-page": "dist/bin/eject-keycloak-page.js"
|
"eject-keycloak-page": "dist/bin/eject-keycloak-page.js"
|
||||||
},
|
},
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
import { downloadBuiltinKeycloakTheme } from "./download-builtin-keycloak-theme";
|
|
||||||
import { keycloakThemeEmailDirPath } from "./keycloakify";
|
|
||||||
import { join as pathJoin, basename as pathBasename, relative as pathRelative } from "path";
|
|
||||||
import { transformCodebase } from "./tools/transformCodebase";
|
|
||||||
import { promptKeycloakVersion } from "./promptKeycloakVersion";
|
|
||||||
import * as fs from "fs";
|
|
||||||
import { getCliOptions } from "./tools/cliOptions";
|
|
||||||
import { getLogger } from "./tools/logger";
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
const { isSilent } = getCliOptions(process.argv.slice(2));
|
|
||||||
const logger = getLogger({ isSilent });
|
|
||||||
if (fs.existsSync(keycloakThemeEmailDirPath)) {
|
|
||||||
logger.warn(`There is already a ${pathRelative(process.cwd(), keycloakThemeEmailDirPath)} directory in your project. Aborting.`);
|
|
||||||
|
|
||||||
process.exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const { keycloakVersion } = await promptKeycloakVersion();
|
|
||||||
|
|
||||||
const builtinKeycloakThemeTmpDirPath = pathJoin(keycloakThemeEmailDirPath, "..", "tmp_xIdP3_builtin_keycloak_theme");
|
|
||||||
|
|
||||||
await downloadBuiltinKeycloakTheme({
|
|
||||||
keycloakVersion,
|
|
||||||
"destDirPath": builtinKeycloakThemeTmpDirPath,
|
|
||||||
isSilent
|
|
||||||
});
|
|
||||||
|
|
||||||
transformCodebase({
|
|
||||||
"srcDirPath": pathJoin(builtinKeycloakThemeTmpDirPath, "base", "email"),
|
|
||||||
"destDirPath": keycloakThemeEmailDirPath
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.log(`./${pathBasename(keycloakThemeEmailDirPath)} ready to be customized`);
|
|
||||||
|
|
||||||
fs.rmSync(builtinKeycloakThemeTmpDirPath, { "recursive": true, "force": true });
|
|
||||||
})();
|
|
@ -72,10 +72,6 @@ export async function generateKeycloakThemeResources(params: {
|
|||||||
let generateFtlFilesCode_glob: ReturnType<typeof generateFtlFilesCodeFactory>["generateFtlFilesCode"] | undefined = undefined;
|
let generateFtlFilesCode_glob: ReturnType<typeof generateFtlFilesCodeFactory>["generateFtlFilesCode"] | undefined = undefined;
|
||||||
|
|
||||||
for (const themeType of themeTypes) {
|
for (const themeType of themeTypes) {
|
||||||
if (themeType === "account") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const themeDirPath = getThemeDirPath(themeType);
|
const themeDirPath = getThemeDirPath(themeType);
|
||||||
|
|
||||||
copy_app_resources_to_theme_path: {
|
copy_app_resources_to_theme_path: {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import "./replaceImportFromStatic";
|
import "./replaceImportFromStatic";
|
||||||
import { setupSampleReactProject, sampleReactProjectDirPath } from "./setupSampleReactProject";
|
import { setupSampleReactProject, sampleReactProjectDirPath } from "./setupSampleReactProject";
|
||||||
import * as st from "scripting-tools";
|
import * as st from "scripting-tools";
|
||||||
|
import * as fs from "fs";
|
||||||
import { join as pathJoin } from "path";
|
import { join as pathJoin } from "path";
|
||||||
import { getProjectRoot } from "keycloakify/bin/tools/getProjectRoot.js";
|
import { getProjectRoot } from "keycloakify/bin/tools/getProjectRoot.js";
|
||||||
|
|
||||||
@ -9,11 +10,13 @@ import { getProjectRoot } from "keycloakify/bin/tools/getProjectRoot.js";
|
|||||||
|
|
||||||
const binDirPath = pathJoin(getProjectRoot(), "dist_test", "src", "bin");
|
const binDirPath = pathJoin(getProjectRoot(), "dist_test", "src", "bin");
|
||||||
|
|
||||||
|
fs.mkdirSync(pathJoin(sampleReactProjectDirPath, "src", "keycloak-theme"), { "recursive": true });
|
||||||
|
|
||||||
|
st.execSyncTrace(`node ${pathJoin(binDirPath, "initialize-email-theme")}`, { "cwd": sampleReactProjectDirPath });
|
||||||
|
|
||||||
st.execSyncTrace(
|
st.execSyncTrace(
|
||||||
//`node ${pathJoin(binDirPath, "keycloakify")} --external-assets`,
|
//`node ${pathJoin(binDirPath, "keycloakify")} --external-assets`,
|
||||||
`node ${pathJoin(binDirPath, "keycloakify")}`,
|
`node ${pathJoin(binDirPath, "keycloakify")}`,
|
||||||
{ "cwd": sampleReactProjectDirPath }
|
{ "cwd": sampleReactProjectDirPath }
|
||||||
);
|
);
|
||||||
|
|
||||||
st.execSyncTrace(`node ${pathJoin(binDirPath, "download-builtin-keycloak-theme")}`, { "cwd": sampleReactProjectDirPath });
|
|
||||||
})();
|
})();
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { getKcContext } from "../../src/kcContext/getKcContext";
|
import { getKcContext } from "../../src/login/kcContext/getKcContext";
|
||||||
import type { ExtendKcContext } from "../../src/kcContext/getKcContextFromWindow";
|
import type { ExtendKcContext } from "../../src/login/kcContext/getKcContextFromWindow";
|
||||||
import type { KcContext } from "../../src/kcContext";
|
import type { KcContext } from "../../src/login/kcContext";
|
||||||
import { same } from "evt/tools/inDepth";
|
import { same } from "evt/tools/inDepth";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import type { Equals } from "tsafe";
|
import type { Equals } from "tsafe";
|
||||||
import { kcContextMocks, kcContextCommonMock } from "../../src/kcContext/kcContextMocks";
|
import { kcContextMocks, kcContextCommonMock } from "../../src/login/kcContext/kcContextMocks";
|
||||||
import { deepClone } from "../../src/tools/deepClone";
|
import { deepClone } from "../../src/tools/deepClone";
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user