Skip to content

Commit

Permalink
Add ignoredFolders set to exclude certain folders from file walk
Browse files Browse the repository at this point in the history
  • Loading branch information
PRO-2684 committed Mar 30, 2024
1 parent b2f0dbb commit 8b949e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { BrowserWindow, ipcMain, webContents, shell } = require("electron");

const isDebug = process.argv.includes("--scriptio-debug");
const updateInterval = 1000;
const ignoredFolders = new Set(["node_modules", ".git", ".vscode", ".idea", ".github"]);
const log = isDebug ? console.log.bind(console, "\x1b[32m%s\x1b[0m", "[Scriptio]") : () => { };
let devMode = false;
let watcher = null;
Expand Down Expand Up @@ -113,7 +114,9 @@ function listJS(dir) {
for (const f of dirFiles) {
const stat = fs.lstatSync(dir + "/" + f);
if (stat.isDirectory()) {
walk(dir + "/" + f, files);
if (!ignoredFolders.has(f)) {
walk(dir + "/" + f, files);
}
} else if (f.endsWith(".js")) {
files.push(normalize(dir + "/" + f));
} else if (f.endsWith(".lnk") && shell.readShortcutLink) { // lnk file & on Windows
Expand Down

0 comments on commit 8b949e7

Please sign in to comment.