Add script for downloading base themes
This commit is contained in:
@ -8,20 +8,6 @@ import {
|
||||
} from "./replaceImportFromStatic";
|
||||
import { generateFtlFilesCodeFactory } from "./generateFtl";
|
||||
|
||||
|
||||
/*
|
||||
const reactAppBuildDirPath = pathJoin(process.cwd(), "build");
|
||||
|
||||
assert(
|
||||
fs.existsSync(reactAppBuildDirPath),
|
||||
"Run 'react-script build' first (the build dir should be present)"
|
||||
);
|
||||
|
||||
const keycloakDir = pathJoin(reactAppBuildDirPath, "..", "keycloak_build");
|
||||
|
||||
|
||||
*/
|
||||
|
||||
const ftlValuesGlobalName = "keycloakFtlValues";
|
||||
|
||||
export function generateKeycloakThemeResources(
|
||||
|
@ -3,31 +3,35 @@ import { generateJavaStackFiles } from "./generateJavaStackFiles";
|
||||
import type { ParsedPackageJson } from "./generateJavaStackFiles";
|
||||
import { join as pathJoin } from "path";
|
||||
import * as child_process from "child_process";
|
||||
import { generateDebugFiles } from "./generateDebugFiles";
|
||||
import { generateDebugFiles } from "./generateDebugFiles";
|
||||
|
||||
const reactProjectDirPath = process.cwd();
|
||||
|
||||
const parsedPackageJson: ParsedPackageJson = require(pathJoin(reactProjectDirPath, "package.json"));
|
||||
|
||||
const keycloakThemeBuildingDirPath = pathJoin(reactProjectDirPath, "build_keycloak");
|
||||
export const keycloakThemeBuildingDirPath = pathJoin(reactProjectDirPath, "build_keycloak");
|
||||
|
||||
generateKeycloakThemeResources({
|
||||
keycloakThemeBuildingDirPath,
|
||||
"reactAppBuildDirPath": pathJoin(reactProjectDirPath, "build"),
|
||||
"themeName": parsedPackageJson.name
|
||||
});
|
||||
if (require.main === module) {
|
||||
|
||||
generateJavaStackFiles({
|
||||
parsedPackageJson,
|
||||
keycloakThemeBuildingDirPath
|
||||
});
|
||||
generateKeycloakThemeResources({
|
||||
keycloakThemeBuildingDirPath,
|
||||
"reactAppBuildDirPath": pathJoin(reactProjectDirPath, "build"),
|
||||
"themeName": parsedPackageJson.name
|
||||
});
|
||||
|
||||
child_process.execSync(
|
||||
"mvn package",
|
||||
{ "cwd": keycloakThemeBuildingDirPath }
|
||||
);
|
||||
generateJavaStackFiles({
|
||||
parsedPackageJson,
|
||||
keycloakThemeBuildingDirPath
|
||||
});
|
||||
|
||||
generateDebugFiles({
|
||||
keycloakThemeBuildingDirPath,
|
||||
"packageJsonName": parsedPackageJson.name
|
||||
});
|
||||
child_process.execSync(
|
||||
"mvn package",
|
||||
{ "cwd": keycloakThemeBuildingDirPath }
|
||||
);
|
||||
|
||||
generateDebugFiles({
|
||||
keycloakThemeBuildingDirPath,
|
||||
"packageJsonName": parsedPackageJson.name
|
||||
});
|
||||
|
||||
}
|
||||
|
17
src/bin/download-sample-keycloak-themes.ts
Normal file
17
src/bin/download-sample-keycloak-themes.ts
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
import * as fs from "fs";
|
||||
import { join as pathJoin, basename as pathBasename } from "path";
|
||||
import { keycloakThemeBuildingDirPath } from "./build-keycloak-theme";
|
||||
import child_process from "child_process";
|
||||
|
||||
if (!fs.existsSync(keycloakThemeBuildingDirPath)) {
|
||||
console.log("Error: The keycloak theme need to be build");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const url = "https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/other_keycloak_thems.zip";
|
||||
|
||||
[
|
||||
`wget ${url}`,
|
||||
...["unzip", "rm"].map(prg => `${prg} ${pathBasename(url)}`),
|
||||
].forEach(cmd => child_process.execSync(cmd, { "cwd": pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme") }));
|
@ -1,11 +1,15 @@
|
||||
|
||||
import { setupSampleReactProject } from "./setupSampleReactProject";
|
||||
import * as st from "scripting-tools";
|
||||
import { join as pathJoin } from "path";
|
||||
|
||||
const { sampleReactProjectDirPath } = setupSampleReactProject();
|
||||
|
||||
process.chdir(sampleReactProjectDirPath);
|
||||
|
||||
console.log(`Running main in ${sampleReactProjectDirPath}`);
|
||||
|
||||
import("../bin/build-keycloak-theme");
|
||||
st.execSync(
|
||||
`node ${pathJoin(__dirname, "../bin/build-keycloak-theme")}`,
|
||||
{ "cwd": sampleReactProjectDirPath }
|
||||
);
|
||||
|
||||
|
||||
|
13
src/test/download-sample-keycloak-themes.ts
Normal file
13
src/test/download-sample-keycloak-themes.ts
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
import { sampleReactProjectDirPath } from "./setupSampleReactProject";
|
||||
import * as st from "scripting-tools";
|
||||
import { join as pathJoin } from "path";
|
||||
|
||||
console.log(`Running main in ${sampleReactProjectDirPath}`);
|
||||
|
||||
st.execSync(
|
||||
`node ${pathJoin(__dirname, "../bin/download-sample-keycloak-themes")}`,
|
||||
{ "cwd": sampleReactProjectDirPath }
|
||||
);
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
import * as st from "scripting-tools";
|
||||
import { join as pathJoin, basename as pathBasename } from "path";
|
||||
|
||||
export function setupSampleReactProject() {
|
||||
export const sampleReactProjectDirPath = pathJoin(__dirname, "..", "..", "sample_react_project");
|
||||
|
||||
const sampleReactProjectDirPath = pathJoin(__dirname, "..", "..", "sample_react_project");
|
||||
export function setupSampleReactProject() {
|
||||
|
||||
st.execSync(`rm -rf ${sampleReactProjectDirPath}`);
|
||||
st.execSync(`mkdir ${sampleReactProjectDirPath}`);
|
||||
|
Reference in New Issue
Block a user