From 5445aab3a8842bc9db26f101e417e50ffb66f757 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sun, 1 Jun 2025 06:57:08 +0200 Subject: [PATCH] Update .gitignore and refactor auto-commit logic in main.js --- .gitignore | 1 + main.js | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index cf457ae..26ea7dd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ package-lock.json dist.DS_Store .git .gitignore +.DS_Store diff --git a/main.js b/main.js index d1a3fd8..036a8ba 100644 --- a/main.js +++ b/main.js @@ -657,6 +657,19 @@ function startMonitoringWatcher(folderPath, win) { // Bei jedem Event → status neu holen, Message wie beim initialen Check bauen watcher.on('all', async () => { + // === .gitignore updaten, falls nötig === + for (const name of IGNORED_NAMES) { + if (name.includes('*')) { + addMatchingFilesToGitignore(folderPath, name); + } else { + const absPath = path.join(folderPath, name.replace(/\/$/, '')); + if (fs.existsSync(absPath)) { + ensureInGitignore(folderPath, name); + } + } + } + + // Jetzt wie gehabt: const git = simpleGit(folderPath); const status = await git.status(); if ( @@ -1035,17 +1048,6 @@ function addMatchingFilesToGitignore(folderPath, pattern) { async function autoCommit(folderPath, message, win) { - // ---- AUTOGENERATE .gitignore ---- - for (const name of IGNORED_NAMES) { - if (name.includes('*')) { - addMatchingFilesToGitignore(folderPath, name); - } else { - const absPath = path.join(folderPath, name.replace(/\/$/, '')); - if (fs.existsSync(absPath)) { - ensureInGitignore(folderPath, name); - } - } - } const git = simpleGit(folderPath); const status = await git.status();