Skip to content

Commit

Permalink
Make production build work
Browse files Browse the repository at this point in the history
  • Loading branch information
m5x5 committed Oct 11, 2021
1 parent e8f75a9 commit ec77fbc
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 195 deletions.
12 changes: 0 additions & 12 deletions electron-builder.yml

This file was deleted.

1 change: 1 addition & 0 deletions main/helpers/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default class Loader {
}
async getLocalActions() {
log(`Action Path: ${path.join(__dirname, "../resources/actions/*.js")}`);
log("Loader __dirname:", __dirname);
const directory = path
.join(__dirname, "../resources/actions/*.js")
.replace(/\\/g, "/");
Expand Down
25 changes: 15 additions & 10 deletions main/helpers/copy-file.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { log } from "electron-log";
import { error, log } from "electron-log";
import fg from "fast-glob";
import fs from "fs";
import path from "path";

export const copyFiles = (externalFolder, _files) => {
const localFiles = fg.sync("./resources/bot/**/*.*");
export const copyFiles = async (externalFolder, _files) => {
try {
log("copy-file __dirname", __dirname);
const directory = path
.join(__dirname, "../resources/bot/**/*.*")
.replace(/\\/g, "/");
const localFiles = await fg(directory);
log(`${localFiles.length} files found`);
log(`file example ${localFiles[0]}`);
const externalFiles = localFiles.map((file) => {
return path.join(externalFolder, file.split("/resources/bot")[1]);
});

const externalFiles = localFiles.map((file) => {
return path.join(externalFolder, file.split("./resources/bot")[1]);
});
log(`${localFiles.length} files found`);
log(`Files converted to something like ${externalFiles[0]}`);
log(`Files converted to something like ${externalFiles[0]}`);

try {
for (let i in localFiles) {
const localFile = localFiles[i];
const externalFile = externalFiles[i];
Expand Down Expand Up @@ -55,6 +60,6 @@ export const copyFiles = (externalFolder, _files) => {

return true;
} catch (e) {
console.error(e);
error(e);
}
};
2 changes: 1 addition & 1 deletion main/helpers/ipc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ipcMain.on("chooseDirectory", async (event, folder) => {
// Populate with files
const invalidFiles = BOT_FILES.filter((file) => !validateFile(folder, file));
log(invalidFiles);
copyFiles(folder, invalidFiles);
await copyFiles(folder, invalidFiles);

loader = new Loader({ filePath: folder });
runner = new Runner({ filePath: folder });
Expand Down
Loading

0 comments on commit ec77fbc

Please sign in to comment.