Introduce start-keycloak-container command
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import { generateTheme } from "./generateTheme";
|
||||
import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
|
||||
import * as child_process from "child_process";
|
||||
import { generateStartKeycloakTestingContainer } from "./generateStartKeycloakTestingContainer";
|
||||
import * as fs from "fs";
|
||||
import { readBuildOptions } from "../shared/buildOptions";
|
||||
import { getLogger } from "../tools/logger";
|
||||
@ -18,6 +17,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
||||
const buildOptions = readBuildOptions({ cliCommandOptions });
|
||||
|
||||
const logger = getLogger({ "isSilent": buildOptions.isSilent });
|
||||
|
||||
logger.log("🔏 Building the keycloak theme...⌚");
|
||||
|
||||
const { themeSrcDirPath } = getThemeSrcDirPath({ "reactAppRootDirPath": buildOptions.reactAppRootDirPath });
|
||||
@ -30,7 +30,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
||||
fs.writeFileSync(pathJoin(buildOptions.keycloakifyBuildDirPath, ".gitignore"), Buffer.from("*", "utf8"));
|
||||
}
|
||||
|
||||
const { doesImplementAccountTheme } = await generateTheme({
|
||||
await generateTheme({
|
||||
themeSrcDirPath,
|
||||
"keycloakifySrcDirPath": pathJoin(getThisCodebaseRootDirPath(), "src"),
|
||||
"keycloakifyVersion": readThisNpmProjectVersion(),
|
||||
@ -51,51 +51,15 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
||||
});
|
||||
}
|
||||
|
||||
const { lastJarFileBasename } = await buildJars({
|
||||
doesImplementAccountTheme,
|
||||
buildOptions
|
||||
});
|
||||
|
||||
generateStartKeycloakTestingContainer({
|
||||
"jarFilePath": pathJoin(buildOptions.keycloakifyBuildDirPath, lastJarFileBasename),
|
||||
await buildJars({
|
||||
doesImplementAccountTheme,
|
||||
buildOptions
|
||||
});
|
||||
|
||||
logger.log(
|
||||
[
|
||||
`✅ Your keycloak theme has been generated and bundled into .${pathSep}${pathJoin(
|
||||
pathRelative(buildOptions.reactAppRootDirPath, buildOptions.keycloakifyBuildDirPath),
|
||||
"keycloak-theme-for-kc-*.jar"
|
||||
)}`,
|
||||
"",
|
||||
`To test your theme locally you can spin up a Keycloak container image with the theme pre loaded by running:`,
|
||||
"",
|
||||
`👉 $ .${pathSep}${pathRelative(
|
||||
buildOptions.reactAppRootDirPath,
|
||||
pathJoin(buildOptions.keycloakifyBuildDirPath, generateStartKeycloakTestingContainer.basename)
|
||||
)} 👈`,
|
||||
``,
|
||||
`Once your container is up and running: `,
|
||||
"- Log into the admin console 👉 http://localhost:8080/admin username: admin, password: admin 👈",
|
||||
`- Create a realm: Master -> AddRealm -> Name: myrealm`,
|
||||
`- Enable registration: Realm settings -> Login tab -> User registration: on`,
|
||||
`- Enable the Account theme (optional): Realm settings -> Themes tab -> Account theme: ${buildOptions.themeNames[0]}`,
|
||||
` Clients -> account -> Login theme: ${buildOptions.themeNames[0]}`,
|
||||
`- Enable the email theme (optional): Realm settings -> Themes tab -> Email theme: ${buildOptions.themeNames[0]} (option will appear only if you have ran npx initialize-email-theme)`,
|
||||
`- Create a client Clients -> Create -> Client ID: myclient`,
|
||||
` Root URL: https://www.keycloak.org/app/`,
|
||||
` Valid redirect URIs: https://www.keycloak.org/app* http://localhost* (localhost is optional)`,
|
||||
` Valid post logout redirect URIs: https://www.keycloak.org/app* http://localhost*`,
|
||||
` Web origins: *`,
|
||||
` Login Theme: ${buildOptions.themeNames[0]}`,
|
||||
` Save (button at the bottom of the page)`,
|
||||
``,
|
||||
`- Go to 👉 https://www.keycloak.org/app/ 👈 Click "Save" then "Sign in". You should see your login page`,
|
||||
`- Got to 👉 http://localhost:8080/realms/myrealm/account 👈 to see your account theme`,
|
||||
``,
|
||||
`Video tutorial: https://youtu.be/WMyGZNHQkjU`,
|
||||
``
|
||||
].join("\n")
|
||||
`✅ Your keycloak theme has been generated and bundled into .${pathSep}${pathJoin(
|
||||
pathRelative(process.cwd(), buildOptions.keycloakifyBuildDirPath),
|
||||
"keycloak-theme-for-kc-*.jar"
|
||||
)}`
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user