2024-05-19 05:29:20 +02:00
|
|
|
import * as fs from "fs";
|
|
|
|
import { join } from "path";
|
2024-09-08 12:00:07 +02:00
|
|
|
import { startRebuildOnSrcChange } from "./shared/startRebuildOnSrcChange";
|
2024-08-14 07:10:48 +02:00
|
|
|
import { crawl } from "../src/bin/tools/crawl";
|
2024-09-22 20:12:11 +02:00
|
|
|
import { run } from "./shared/run";
|
2024-08-14 07:10:48 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
const dirPath = "node_modules";
|
|
|
|
|
|
|
|
try {
|
|
|
|
fs.rmSync(dirPath, { recursive: true, force: true });
|
|
|
|
} catch {
|
|
|
|
// NOTE: This is a workaround for windows
|
|
|
|
// we can't remove locked executables.
|
|
|
|
|
|
|
|
crawl({
|
|
|
|
dirPath,
|
|
|
|
returnedPathsType: "absolute"
|
|
|
|
}).forEach(filePath => {
|
|
|
|
try {
|
|
|
|
fs.rmSync(filePath, { force: true });
|
|
|
|
} catch (error) {
|
|
|
|
if (filePath.endsWith(".exe")) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2024-05-19 05:29:20 +02:00
|
|
|
|
2024-05-20 15:48:51 +02:00
|
|
|
fs.rmSync("dist", { recursive: true, force: true });
|
|
|
|
fs.rmSync(".yarn_home", { recursive: true, force: true });
|
2024-05-19 05:29:20 +02:00
|
|
|
|
|
|
|
run("yarn install");
|
|
|
|
run("yarn build");
|
|
|
|
|
2024-06-25 22:50:51 +02:00
|
|
|
const starterName = "keycloakify-starter";
|
2024-06-23 20:54:08 +02:00
|
|
|
|
|
|
|
fs.rmSync(join("..", starterName, "node_modules"), {
|
2024-05-20 15:48:51 +02:00
|
|
|
recursive: true,
|
|
|
|
force: true
|
|
|
|
});
|
2024-05-19 05:29:20 +02:00
|
|
|
|
2024-06-23 20:54:08 +02:00
|
|
|
run("yarn install", { cwd: join("..", starterName) });
|
2024-05-19 05:29:20 +02:00
|
|
|
|
2024-06-23 20:54:08 +02:00
|
|
|
run(`npx tsx ${join("scripts", "link-in-app.ts")} ${starterName}`);
|
2024-05-19 05:29:20 +02:00
|
|
|
|
2024-06-03 23:26:04 +02:00
|
|
|
startRebuildOnSrcChange();
|