keycloak_theme/src/bin/download-sample-keycloak-themes.ts

18 lines
687 B
TypeScript
Raw Normal View History

2021-02-21 23:06:42 +01:00
import * as fs from "fs";
import { join as pathJoin, basename as pathBasename } from "path";
import { keycloakThemeBuildingDirPath } from "./build-keycloak-theme";
import child_process from "child_process";
if (!fs.existsSync(keycloakThemeBuildingDirPath)) {
console.log("Error: The keycloak theme need to be build");
process.exit(1);
}
const url = "https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/other_keycloak_thems.zip";
[
`wget ${url}`,
...["unzip", "rm"].map(prg => `${prg} ${pathBasename(url)}`),
].forEach(cmd => child_process.execSync(cmd, { "cwd": pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme") }));