From 595402adeaac9879cb6e70c9d85d3a1e31ccf524 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 14 Jul 2024 13:03:06 +0300 Subject: [PATCH] dev: Fix npm start-electron script --- bin/copy-dist.ts | 14 ++++++++++---- tsconfig.json | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/copy-dist.ts b/bin/copy-dist.ts index 075fe19fa..3c80598c3 100644 --- a/bin/copy-dist.ts +++ b/bin/copy-dist.ts @@ -1,5 +1,5 @@ -const fs = require("fs-extra"); -const path = require("path"); +import fs from "fs-extra"; +import path from "path"; const DEST_DIR = "./dist"; const DEST_DIR_SRC = path.join(DEST_DIR, "src"); @@ -15,6 +15,12 @@ async function copyNodeModuleFileOrFolder(source: string) { } const copy = async () => { + for (const srcFile of fs.readdirSync("build")) { + const destFile = path.join(DEST_DIR, path.basename(srcFile)); + console.log(`Copying source ${srcFile} -> ${destFile}.`); + fs.copySync(path.join("build", srcFile), destFile, { recursive: true }); + } + const filesToCopy = ["config-sample.ini"]; for (const file of filesToCopy) { console.log(`Copying ${file}`); @@ -27,11 +33,11 @@ const copy = async () => { await fs.copy(dir, path.join(DEST_DIR, dir)); } - const srcDirsToCopy = ["./src/public", "./src/views"]; + const srcDirsToCopy = ["./src/public", "./src/views", "./build"]; for (const dir of srcDirsToCopy) { console.log(`Copying ${dir}`); await fs.copy(dir, path.join(DEST_DIR_SRC, path.basename(dir))); - } + } const nodeModulesFile = [ "node_modules/react/umd/react.production.min.js", diff --git a/tsconfig.json b/tsconfig.json index f0f1a3fc2..5be52f40c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,8 @@ "resolveJsonModule": true, "lib": ["ES2022"], "downlevelIteration": true, - "skipLibCheck": true + "skipLibCheck": true, + "esModuleInterop": true }, "include": [ "./src/**/*.js",