Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows compatibility #226

Merged
merged 7 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/bin/download-builtin-keycloak-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { promptKeycloakVersion } from "./promptKeycloakVersion";
import { getCliOptions } from "./tools/cliOptions";
import { getLogger } from "./tools/logger";

export function downloadBuiltinKeycloakTheme(params: { keycloakVersion: string; destDirPath: string; isSilent: boolean }) {
export async function downloadBuiltinKeycloakTheme(params: { keycloakVersion: string; destDirPath: string; isSilent: boolean }) {
const { keycloakVersion, destDirPath, isSilent } = params;

for (const ext of ["", "-community"]) {
downloadAndUnzip({
await downloadAndUnzip({
"destDirPath": destDirPath,
"url": `https://github.com/keycloak/keycloak/archive/refs/tags/${keycloakVersion}.zip`,
"pathOfDirToExtractInArchive": `keycloak-${keycloakVersion}/themes/src/main/resources${ext}/theme`,
Expand All @@ -31,7 +31,7 @@ if (require.main === module) {

logger.log(`Downloading builtins theme of Keycloak ${keycloakVersion} here ${destDirPath}`);

downloadBuiltinKeycloakTheme({
await downloadBuiltinKeycloakTheme({
keycloakVersion,
destDirPath,
isSilent
Expand Down
10 changes: 4 additions & 6 deletions src/bin/keycloakify/generateKeycloakThemeResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { replaceImportsFromStaticInJsCode } from "./replacers/replaceImportsFrom
import { replaceImportsInCssCode } from "./replacers/replaceImportsInCssCode";
import { generateFtlFilesCodeFactory, pageIds } from "./generateFtl";
import { downloadBuiltinKeycloakTheme } from "../download-builtin-keycloak-theme";
import * as child_process from "child_process";
import { mockTestingResourcesCommonPath, mockTestingResourcesPath, mockTestingSubDirOfPublicDirBasename } from "../mockTestingResourcesPath";
import { isInside } from "../tools/isInside";
import type { BuildOptions } from "./BuildOptions";
Expand Down Expand Up @@ -53,13 +52,13 @@ export namespace BuildOptionsLike {
assert<typeof buildOptions extends BuildOptionsLike ? true : false>();
}

export function generateKeycloakThemeResources(params: {
export async function generateKeycloakThemeResources(params: {
reactAppBuildDirPath: string;
keycloakThemeBuildingDirPath: string;
keycloakThemeEmailDirPath: string;
keycloakVersion: string;
buildOptions: BuildOptionsLike;
}): { doBundlesEmailTemplate: boolean } {
}): Promise<{ doBundlesEmailTemplate: boolean }> {
const { reactAppBuildDirPath, keycloakThemeBuildingDirPath, keycloakThemeEmailDirPath, keycloakVersion, buildOptions } = params;

const logger = getLogger({ isSilent: buildOptions.isSilent });
Expand Down Expand Up @@ -155,7 +154,7 @@ export function generateKeycloakThemeResources(params: {
{
const tmpDirPath = pathJoin(themeDirPath, "..", "tmp_xxKdLpdIdLd");

downloadBuiltinKeycloakTheme({
await downloadBuiltinKeycloakTheme({
keycloakVersion,
"destDirPath": tmpDirPath,
isSilent: buildOptions.isSilent
Expand Down Expand Up @@ -190,8 +189,7 @@ export function generateKeycloakThemeResources(params: {
);

fs.writeFileSync(pathJoin(keycloakResourcesWithinPublicDirPath, ".gitignore"), Buffer.from("*", "utf8"));

child_process.execSync(`rm -r ${tmpDirPath}`);
fs.rmSync(tmpDirPath, { recursive: true, force: true });
}

fs.writeFileSync(
Expand Down
4 changes: 2 additions & 2 deletions src/bin/keycloakify/keycloakify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const reactProjectDirPath = process.cwd();
export const keycloakThemeBuildingDirPath = pathJoin(reactProjectDirPath, "build_keycloak");
export const keycloakThemeEmailDirPath = pathJoin(keycloakThemeBuildingDirPath, "..", "keycloak_email");

export function main() {
export async function main() {
const { isSilent, hasExternalAssets } = getCliOptions(process.argv.slice(2));
const logger = getLogger({ isSilent });
logger.log("🔏 Building the keycloak theme...⌚");
Expand All @@ -33,7 +33,7 @@ export function main() {
"isSilent": isSilent
});

const { doBundlesEmailTemplate } = generateKeycloakThemeResources({
const { doBundlesEmailTemplate } = await generateKeycloakThemeResources({
keycloakThemeBuildingDirPath,
keycloakThemeEmailDirPath,
"reactAppBuildDirPath": pathJoin(reactProjectDirPath, "build"),
Expand Down
3 changes: 2 additions & 1 deletion src/bin/link_in_test_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ fs.writeFileSync(
return {
...packageJsonParsed,
"main": packageJsonParsed["main"].replace(/^dist\//, ""),
"types": packageJsonParsed["types"].replace(/^dist\//, "")
"types": packageJsonParsed["types"].replace(/^dist\//, ""),
"bin": Object.fromEntries(Object.entries<string>(packageJsonParsed["bin"]).map(([k, v]) => [k, v.replace(/^dist\//, "")]))
lordvlad marked this conversation as resolved.
Show resolved Hide resolved
};
})(),
null,
Expand Down
Loading