Skip to content

Commit

Permalink
start updating build.js with new structure
Browse files Browse the repository at this point in the history
  • Loading branch information
syrk4web committed Jul 22, 2024
1 parent 865ab48 commit d5e1659
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/ui/client/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import fs from "fs";

const __dirname = import.meta.dirname;

const clientBuildDir = "dashboard";
const appStaticDir = "../ui/static";
const appTempDir = "../ui/templates";
const clientBuildDir = "opt-dashboard";
const appStaticDir = "../static";
const appTempDir = "../templates";

async function moveFile(src, dest) {
fs.renameSync(src, dest, (err) => {
Expand Down Expand Up @@ -61,20 +61,20 @@ async function runCommand(dir, command) {
// Install deps and build vite (work for client and setup)
async function buildVite() {
// Install packages
await runCommand("", "npm run build-setup");
await runCommand("", "npm install");
await runCommand("", "npm run build-dashboard");
}

// Change dir structure for flask app
async function updateClientDir() {
const srcDir = resolve(`./${clientBuildDir}/src/pages`);
const dirToRem = resolve(`./${clientBuildDir}/src`);
const srcDir = resolve(`./${clientBuildDir}/dashboard/pages`);
const dirToRem = resolve(`./${clientBuildDir}/dashboard`);
const staticTemp = resolve(`./${clientBuildDir}/templates`);

try {
await createDirIfNotExists(`./templates`);
await copyDir(srcDir, staticTemp);
await delElRecursive(dirToRem);
await createDirIfNotExists("./templates");
await changeOutputTemplates();
} catch (err) {
console.log(err);
Expand Down Expand Up @@ -156,7 +156,7 @@ async function setBuildTempToUI() {
);
});
// Delete templates to avoid to add it to static
delElRecursive("./dashbord/templates");
delElRecursive("./dashboard/templates");
});
}

Expand Down Expand Up @@ -195,8 +195,8 @@ async function build() {
await buildVite();
await updateClientDir();
await setBuildTempToUI();
await moveBuildStaticToUI();
await buildSetup();
// await moveBuildStaticToUI();
// await buildSetup();
}

build();

0 comments on commit d5e1659

Please sign in to comment.