mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 15:49:00 +02:00
29 lines
789 B
TypeScript
29 lines
789 B
TypeScript
import { rmSync } from "fs";
|
|
import { copySync, emptyDirSync, mkdirpSync } from "fs-extra";
|
|
import { join } from "path";
|
|
|
|
export default class BuildHelper {
|
|
|
|
private projectDir: string;
|
|
private outDir: string;
|
|
|
|
constructor(projectPath: string) {
|
|
this.projectDir = join(__dirname, "..", projectPath);
|
|
this.outDir = join(this.projectDir, "dist");
|
|
|
|
emptyDirSync(this.outDir);
|
|
}
|
|
|
|
copy(projectDirPath: string, outDirPath: string) {
|
|
if (outDirPath.endsWith("/")) {
|
|
mkdirpSync(join(outDirPath));
|
|
}
|
|
copySync(join(this.projectDir, projectDirPath), join(this.outDir, outDirPath), { dereference: true });
|
|
}
|
|
|
|
deleteFromOutput(path: string) {
|
|
rmSync(join(this.outDir, path), { recursive: true });
|
|
}
|
|
|
|
}
|