From 1a7d9d775181d7b080e5b4526e8a386e90a2db07 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Fri, 23 Feb 2024 20:10:39 +0100 Subject: [PATCH] Update Keycloakify --- package.json | 8 +------- vite.config.ts | 32 +++++++++++++++++++++++++++++++- yarn.lock | 8 ++++---- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 9b23973..0e97569 100755 --- a/package.json +++ b/package.json @@ -15,18 +15,12 @@ "storybook": "storybook dev -p 6006", "build-storybook": "storybook build" }, - "keycloakify": { - "themeName": "keycloakify-starter", - "extraThemeProperties": [ - "foo=bar" - ] - }, "author": "u/garronej", "license": "MIT", "keywords": [], "dependencies": { "evt": "^2.5.7", - "keycloakify": "^9.4.2", + "keycloakify": "^9.5.0", "oidc-spa": "^4.2.1", "powerhooks": "^1.0.8", "react": "^18.2.0", diff --git a/vite.config.ts b/vite.config.ts index c0c54e3..dbce5b8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,12 +5,42 @@ import react from '@vitejs/plugin-react' import commonjs from "vite-plugin-commonjs"; import { keycloakify } from "keycloakify/vite-plugin"; + // https://vitejs.dev/config/ export default defineConfig({ plugins: [ react(), commonjs(), - keycloakify() + keycloakify({ + themeName: "keycloakify-starter", + extraThemeProperties: [ + "foo=bar" + ], + // This is a hook that will be called after the build is done + // but before the jar is created. + // You can use it to add/remove/edit your theme files. + postBuild: async keycloakifyBuildOptions => { + + const fs = await import("fs/promises"); + const path = await import("path"); + + await fs.writeFile( + path.join(keycloakifyBuildOptions.keycloakifyBuildDirPath, "foo.txt"), + Buffer.from( + [ + "This file was created by the postBuild hook of the keycloakify vite plugin", + "", + "Resolved keycloakifyBuildOptions:", + "", + JSON.stringify(keycloakifyBuildOptions, null, 2), + "" + ].join("\n"), + "utf8" + ) + ); + + } + }) ], /* * Uncomment this if you want to use the default domain provided by GitHub Pages diff --git a/yarn.lock b/yarn.lock index d902adb..4993454 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5886,10 +5886,10 @@ jwt-decode@^3.1.2: resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59" integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A== -keycloakify@^9.4.2: - version "9.4.2" - resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-9.4.2.tgz#281678fdd2a0a28e2a6de79532884b1393609d68" - integrity sha512-fu+wrA6OU2NA0ISQ5mBy7/mjKf01OcihNY3VrY/7jwNvhqubd9tFKRumDvl+6ss7rNLeP+mSuqWkgk+uPLVevA== +keycloakify@^9.5.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-9.5.0.tgz#64ae308483cf2c0f071bd6177ea520cd5ee23c11" + integrity sha512-7F/JdKghJpL0g0of6qzEJGt5KC+zPnyeNjwWjlrj1W/y1cyHeIKrViSoNN+r6JtwsDWV+/f8ZDEtnpTTQA0tPA== dependencies: "@babel/generator" "^7.22.9" "@babel/parser" "^7.22.7"