Spaces in file path #22
This commit is contained in:
parent
a1bec78ea2
commit
b1e24212ea
@ -5,14 +5,14 @@ import { crawl } from "./tools/crawl";
|
||||
import { downloadAndUnzip } from "./tools/downloadAndUnzip";
|
||||
import { builtinThemesUrl } from "./install-builtin-keycloak-themes";
|
||||
import { getProjectRoot } from "./tools/getProjectRoot";
|
||||
import * as child_process from "child_process";
|
||||
import { rm_rf, rm_r } from "./tools/rm";
|
||||
|
||||
//@ts-ignore
|
||||
const propertiesParser = require("properties-parser");
|
||||
|
||||
const tmpDirPath = pathJoin(getProjectRoot(), "tmp_xImOef9dOd44");
|
||||
|
||||
child_process.execSync(`rm -rf ${tmpDirPath}`);
|
||||
rm_rf(tmpDirPath);
|
||||
|
||||
downloadAndUnzip({
|
||||
"destDirPath": tmpDirPath,
|
||||
@ -47,7 +47,7 @@ crawl(".").forEach(filePath => {
|
||||
|
||||
});
|
||||
|
||||
child_process.execSync(`rm -r ${tmpDirPath}`);
|
||||
rm_r(tmpDirPath);
|
||||
|
||||
const targetDirPath = pathJoin(getProjectRoot(), "src", "lib", "i18n", "generated_kcMessages");
|
||||
|
||||
|
@ -3,6 +3,7 @@ import { basename as pathBasename, join as pathJoin } from "path";
|
||||
import { execSync } from "child_process";
|
||||
import fs from "fs";
|
||||
import { transformCodebase } from "../tools/transformCodebase";
|
||||
import { rm_rf, rm, rm_r } from "./rm";
|
||||
|
||||
/** assert url ends with .zip */
|
||||
export function downloadAndUnzip(
|
||||
@ -16,19 +17,19 @@ export function downloadAndUnzip(
|
||||
|
||||
const tmpDirPath = pathJoin(destDirPath, "..", "tmp_xxKdOxnEdx");
|
||||
|
||||
execSync(`rm -rf ${tmpDirPath}`);
|
||||
rm_rf(tmpDirPath);
|
||||
|
||||
fs.mkdirSync(tmpDirPath, { "recursive": true });
|
||||
|
||||
execSync(`wget ${url}`, { "cwd": tmpDirPath })
|
||||
execSync(`unzip ${pathBasename(url)}`, { "cwd": tmpDirPath });
|
||||
execSync(`rm ${pathBasename(url)}`, { "cwd": tmpDirPath });
|
||||
rm(pathBasename(url), { "cwd": tmpDirPath });
|
||||
|
||||
transformCodebase({
|
||||
"srcDirPath": tmpDirPath,
|
||||
"destDirPath": destDirPath,
|
||||
});
|
||||
|
||||
execSync(`rm -r ${tmpDirPath}`);
|
||||
rm_r(tmpDirPath);
|
||||
|
||||
}
|
42
src/bin/tools/rm.ts
Normal file
42
src/bin/tools/rm.ts
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
import { execSync } from "child_process";
|
||||
|
||||
function rmInternal(
|
||||
params: {
|
||||
pathToRemove: string;
|
||||
args: string | undefined;
|
||||
cwd: string | undefined;
|
||||
}
|
||||
) {
|
||||
|
||||
const { pathToRemove, args, cwd } = params;
|
||||
|
||||
execSync(
|
||||
`rm ${args ? `-${args} ` : ""}${pathToRemove.replace(/\ /g, "\\ ")}`,
|
||||
cwd !== undefined ? { cwd } : undefined
|
||||
);
|
||||
}
|
||||
|
||||
export function rm(pathToRemove: string, options?: { cwd: string; }) {
|
||||
rmInternal({
|
||||
pathToRemove,
|
||||
"args": undefined,
|
||||
"cwd": options?.cwd,
|
||||
});
|
||||
}
|
||||
|
||||
export function rm_r(pathToRemove: string, options?: { cwd: string; }) {
|
||||
rmInternal({
|
||||
pathToRemove,
|
||||
"args": "r",
|
||||
"cwd": options?.cwd,
|
||||
});
|
||||
}
|
||||
|
||||
export function rm_rf(pathToRemove: string, options?: { cwd: string; }) {
|
||||
rmInternal({
|
||||
pathToRemove,
|
||||
"args": "rf",
|
||||
"cwd": options?.cwd,
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user