Almoste there

This commit is contained in:
Joseph Garrone
2021-02-21 20:54:33 +01:00
parent 00f15537a3
commit ee3fd977c1
7 changed files with 154 additions and 17 deletions

View File

@ -1,24 +1,13 @@
import * as st from "scripting-tools";
import { join as pathJoin } from "path";
import { generateKeycloakThemeResources } from "../bin/generateKeycloakThemeResources";
import { setupSampleReactProject } from "./setupSampleReactProject";
const cwd= pathJoin(__dirname, "..", "..", "etc_tmp");
st.execSync(`rm -rf ${cwd}`);
st.execSync(`mkdir ${cwd}`);
process.chdir(cwd);
st.execSync("wget https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/build.zip");
st.execSync("unzip build.zip");
st.execSync("rm build.zip");
const { sampleReactProjectDirPath } = setupSampleReactProject();
generateKeycloakThemeResources({
"themeName": "onyxia-ui",
"reactAppBuildDirPath": pathJoin(process.cwd(), "build"),
"keycloakThemeBuildingDirPath": pathJoin(process.cwd(), "keycloak_build")
"reactAppBuildDirPath": pathJoin(sampleReactProjectDirPath, "build"),
"keycloakThemeBuildingDirPath": pathJoin(sampleReactProjectDirPath, "build_keycloak_theme")
});

11
src/test/main.ts Normal file
View File

@ -0,0 +1,11 @@
import { setupSampleReactProject } from "./setupSampleReactProject";
const { sampleReactProjectDirPath } = setupSampleReactProject();
process.chdir(sampleReactProjectDirPath);
console.log(`Running main in ${sampleReactProjectDirPath}`);
import("../bin/main");

View File

@ -0,0 +1,20 @@
import * as st from "scripting-tools";
import { join as pathJoin } from "path";
export function setupSampleReactProject() {
const sampleReactProjectDirPath = pathJoin(__dirname, "..", "..", "sample_react_project");
st.execSync(`rm -rf ${sampleReactProjectDirPath}`);
st.execSync(`mkdir ${sampleReactProjectDirPath}`);
[
"wget https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/sample_build_dir_and_package_json.zip",
"unzip build.zip",
"rm build.zip"
].forEach(cmd => st.execSync(cmd, { "cwd": sampleReactProjectDirPath }));
return { sampleReactProjectDirPath };
}