ensure no diff if config hasn't changed

This commit is contained in:
Joseph Garrone
2024-12-19 17:42:26 +01:00
parent 474a863708
commit f43544e134
17 changed files with 607 additions and 193 deletions

View File

@ -3,10 +3,9 @@ import child_process from "child_process";
import { SemVer } from "../src/bin/tools/SemVer";
import { dumpContainerConfig } from "../src/bin/start-keycloak/realmConfig/dumpContainerConfig";
import { cacheDirPath } from "./shared/cacheDirPath";
import { runPrettier } from "../src/bin/tools/runPrettier";
import { getThisCodebaseRootDirPath } from "../src/bin/tools/getThisCodebaseRootDirPath";
import { writeRealmJsonFile } from "../src/bin/start-keycloak/realmConfig/ParsedRealmJson";
import { join as pathJoin } from "path";
import * as fs from "fs";
import chalk from "chalk";
(async () => {
@ -26,9 +25,7 @@ import chalk from "chalk";
realmName: "myrealm"
});
let sourceCode = JSON.stringify(parsedRealmJson, null, 2);
const filePath = pathJoin(
const realmJsonFilePath = pathJoin(
getThisCodebaseRootDirPath(),
"src",
"bin",
@ -38,12 +35,11 @@ import chalk from "chalk";
`realm-kc-${keycloakMajorVersionNumber}.json`
);
sourceCode = await runPrettier({
sourceCode,
filePath
await writeRealmJsonFile({
parsedRealmJson,
realmJsonFilePath,
keycloakMajorVersionNumber
});
fs.writeFileSync(filePath, Buffer.from(sourceCode, "utf8"));
console.log(chalk.green(`Realm config dumped to ${filePath}`));
console.log(chalk.green(`Realm config dumped to ${realmJsonFilePath}`));
})();