mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
refactor(dx/server): extract basic build commands to separate file
This commit is contained in:
28
scripts/build-utils.ts
Normal file
28
scripts/build-utils.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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 });
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user