diff --git a/src/bin/keycloakify/keycloakify.ts b/src/bin/keycloakify/keycloakify.ts index 3a076c19..f068d9e0 100644 --- a/src/bin/keycloakify/keycloakify.ts +++ b/src/bin/keycloakify/keycloakify.ts @@ -22,27 +22,31 @@ export async function main() { const { themeSrcDirPath } = getThemeSrcDirPath({ "reactAppRootDirPath": buildOptions.reactAppRootDirPath }); - fs.writeFileSync(pathJoin(buildOptions.keycloakifyBuildDirPath, ".gitignore"), Buffer.from("*", "utf8")); - { - const [themeName, ...themeVariantNames] = buildOptions.themeNames; + if (!fs.existsSync(buildOptions.keycloakifyBuildDirPath)) { + fs.mkdirSync(buildOptions.keycloakifyBuildDirPath, { "recursive": true }); + } - const { implementedThemeTypes } = await generateTheme({ + fs.writeFileSync(pathJoin(buildOptions.keycloakifyBuildDirPath, ".gitignore"), Buffer.from("*", "utf8")); + } + + const [themeName, ...themeVariantNames] = buildOptions.themeNames; + + const { implementedThemeTypes } = await generateTheme({ + themeName, + themeSrcDirPath, + "keycloakifySrcDirPath": pathJoin(getThisCodebaseRootDirPath(), "src"), + "keycloakifyVersion": readThisNpmProjectVersion(), + buildOptions + }); + + for (const themeVariantName of themeVariantNames) { + generateThemeVariations({ themeName, - themeSrcDirPath, - "keycloakifySrcDirPath": pathJoin(getThisCodebaseRootDirPath(), "src"), - "keycloakifyVersion": readThisNpmProjectVersion(), + themeVariantName, + implementedThemeTypes, buildOptions }); - - for (const themeVariantName of themeVariantNames) { - generateThemeVariations({ - themeName, - themeVariantName, - implementedThemeTypes, - buildOptions - }); - } } run_post_build_script: {