From 934c07f3655a5b08960ab9721ceeedbc9d9e4a09 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 4 Mar 2021 21:43:36 +0100 Subject: [PATCH] Make the dongle to download smaller --- package.json | 4 ++-- .../generateKeycloakThemeResources.ts | 4 ++-- src/bin/generate-i18n-messages.ts | 4 ++-- ...-themes.ts => install-builtin-keycloak-themes.ts} | 6 +++--- src/test/download-sample-keycloak-themes.ts | 12 ------------ src/test/{build-keycloak-theme.ts => index.ts} | 12 +++++++++--- 6 files changed, 18 insertions(+), 24 deletions(-) rename src/bin/{download-sample-keycloak-themes.ts => install-builtin-keycloak-themes.ts} (70%) delete mode 100644 src/test/download-sample-keycloak-themes.ts rename src/test/{build-keycloak-theme.ts => index.ts} (56%) diff --git a/package.json b/package.json index cbbc833b..a2c9965e 100755 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "clean": "rimraf dist/", "build": "yarn clean && tsc && yarn grant-exec-perms && yarn copy-files", "grant-exec-perms": "node dist/bin/tools/grant-exec-perms.js", - "test": "node dist/test/build-keycloak-theme.js && node dist/test/download-sample-keycloak-themes.js", + "test": "node dist/test", "enable_short_import_path": "yarn build && denoify_enable_short_npm_import_path", "copy-files": "copyfiles -u 1 src/**/*.ftl src/**/*.xml dist/", "generate-messages": "node dist/bin/generate-i18n-messages.js", @@ -20,7 +20,7 @@ }, "bin": { "build-keycloak-theme": "dist/bin/build-keycloak-theme/index.js", - "download-sample-keycloak-themes": "dist/bin/download-sample-keycloak-themes.js" + "install-builtin-keycloak-themes": "dist/bin/install-builtin-keycloak-themes.js" }, "author": "u/garronej", "license": "MIT", diff --git a/src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts b/src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts index 02649779..88e3deb9 100644 --- a/src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts +++ b/src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts @@ -7,7 +7,7 @@ import { replaceImportFromStaticInJsCode } from "./replaceImportFromStatic"; import { generateFtlFilesCodeFactory } from "./generateFtl"; -import { keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl } from "../download-sample-keycloak-themes"; +import { builtinThemesUrl } from "../install-builtin-keycloak-themes"; import { downloadAndUnzip } from "../tools/downloadAndUnzip"; import * as child_process from "child_process"; import { ftlValuesGlobalName } from "./ftlValuesGlobalName"; @@ -86,7 +86,7 @@ export function generateKeycloakThemeResources( const tmpDirPath = pathJoin(themeDirPath, "..", "tmp_xxKdLpdIdLd"); downloadAndUnzip({ - "url": keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl, + "url": builtinThemesUrl, "destDirPath": tmpDirPath }); diff --git a/src/bin/generate-i18n-messages.ts b/src/bin/generate-i18n-messages.ts index d11ba2d3..17f982c9 100644 --- a/src/bin/generate-i18n-messages.ts +++ b/src/bin/generate-i18n-messages.ts @@ -2,7 +2,7 @@ import * as fs from "fs"; import { join as pathJoin, relative as pathRelative } from "path"; import { crawl } from "./tools/crawl"; import { downloadAndUnzip } from "./tools/downloadAndUnzip"; -import { keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl } from "./download-sample-keycloak-themes"; +import { builtinThemesUrl } from "./install-builtin-keycloak-themes"; import { getProjectRoot } from "./tools/getProjectRoot"; import * as child_process from "child_process"; @@ -15,7 +15,7 @@ child_process.execSync(`rm -rf ${tmpDirPath}`); downloadAndUnzip({ "destDirPath": tmpDirPath, - "url": keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl + "url": builtinThemesUrl }); type Dictionary = { [idiomId: string]: string }; diff --git a/src/bin/download-sample-keycloak-themes.ts b/src/bin/install-builtin-keycloak-themes.ts similarity index 70% rename from src/bin/download-sample-keycloak-themes.ts rename to src/bin/install-builtin-keycloak-themes.ts index 7f2043dd..cdb63748 100644 --- a/src/bin/download-sample-keycloak-themes.ts +++ b/src/bin/install-builtin-keycloak-themes.ts @@ -4,13 +4,13 @@ import { keycloakThemeBuildingDirPath } from "./build-keycloak-theme"; import { downloadAndUnzip } from "./tools/downloadAndUnzip"; import { join as pathJoin } from "path"; -export const keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl = - "https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/other_keycloak_thems.zip"; +export const builtinThemesUrl = + "https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/keycloak_11.0.3_builtin_themes.zip"; if (require.main === module) { downloadAndUnzip({ - "url": keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl, + "url": builtinThemesUrl, "destDirPath": pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme") }); diff --git a/src/test/download-sample-keycloak-themes.ts b/src/test/download-sample-keycloak-themes.ts deleted file mode 100644 index c4d23342..00000000 --- a/src/test/download-sample-keycloak-themes.ts +++ /dev/null @@ -1,12 +0,0 @@ - -import { sampleReactProjectDirPath } from "./setupSampleReactProject"; -import * as st from "scripting-tools"; -import { join as pathJoin } from "path"; -import { getProjectRoot } from "../bin/tools/getProjectRoot"; - -st.execSyncTrace( - `node ${pathJoin(getProjectRoot(), "dist", "bin", "download-sample-keycloak-themes")}`, - { "cwd": sampleReactProjectDirPath } -) - - diff --git a/src/test/build-keycloak-theme.ts b/src/test/index.ts similarity index 56% rename from src/test/build-keycloak-theme.ts rename to src/test/index.ts index 108d0a0c..0ca998b5 100644 --- a/src/test/build-keycloak-theme.ts +++ b/src/test/index.ts @@ -1,4 +1,5 @@ + import { setupSampleReactProject, sampleReactProjectDirPath @@ -9,10 +10,15 @@ import { getProjectRoot } from "../bin/tools/getProjectRoot"; setupSampleReactProject(); +const binDirPath= pathJoin(getProjectRoot(), "dist", "bin"); + st.execSyncTrace( - `node ${pathJoin(getProjectRoot(), "dist", "bin", "build-keycloak-theme")}`, + `node ${pathJoin(binDirPath, "build-keycloak-theme")}`, { "cwd": sampleReactProjectDirPath } -) - +); +st.execSyncTrace( + `node ${pathJoin(binDirPath, "install-builtin-keycloak-themes")}`, + { "cwd": sampleReactProjectDirPath } +);