Fix generated .gitignore

This commit is contained in:
Joseph Garrone 2021-03-10 22:45:09 +01:00
parent 0168d32f96
commit fa529c911a

View File

@ -1,7 +1,7 @@
import { transformCodebase } from "../tools/transformCodebase"; import { transformCodebase } from "../tools/transformCodebase";
import * as fs from "fs"; import * as fs from "fs";
import { join as pathJoin, basename as pathBasename } from "path"; import { join as pathJoin } from "path";
import { import {
replaceImportFromStaticInCssCode, replaceImportFromStaticInCssCode,
replaceImportFromStaticInJsCode replaceImportFromStaticInJsCode
@ -98,12 +98,8 @@ export function generateKeycloakThemeResources(
"destDirPath": themeResourcesDirPath "destDirPath": themeResourcesDirPath
}); });
//const keycloakResourcesWithinPublicDirPath = pathJoin(reactAppBuildDirPath, "..", "public", "keycloak_static");
const reactAppPublicDirPath = pathJoin(reactAppBuildDirPath, "..", "public"); const reactAppPublicDirPath = pathJoin(reactAppBuildDirPath, "..", "public");
transformCodebase({ transformCodebase({
"srcDirPath": themeResourcesDirPath, "srcDirPath": themeResourcesDirPath,
"destDirPath": pathJoin( "destDirPath": pathJoin(
@ -123,13 +119,6 @@ export function generateKeycloakThemeResources(
const keycloakResourcesWithinPublicDirPath = const keycloakResourcesWithinPublicDirPath =
pathJoin(reactAppPublicDirPath, subDirOfPublicDirBasename); pathJoin(reactAppPublicDirPath, subDirOfPublicDirBasename);
fs.writeFileSync(
pathJoin(keycloakResourcesWithinPublicDirPath, ".gitignore"),
Buffer.from([
resourcesPath,
resourcesCommonPath
].map(s=>pathBasename(s)).join("\n"))
);
fs.writeFileSync( fs.writeFileSync(
pathJoin(keycloakResourcesWithinPublicDirPath, "README.txt"), pathJoin(keycloakResourcesWithinPublicDirPath, "README.txt"),
@ -139,6 +128,14 @@ export function generateKeycloakThemeResources(
].join(" ")) ].join(" "))
); );
fs.writeFileSync(
pathJoin(keycloakResourcesWithinPublicDirPath, ".gitignore"),
Buffer.from([
"*",
"!.gitignore"
].join("\n"))
);
child_process.execSync(`rm -r ${tmpDirPath}`); child_process.execSync(`rm -r ${tmpDirPath}`);
} }