1
0

Update .gitignore and refactor auto-commit logic in main.js

This commit is contained in:
2025-06-01 06:57:08 +02:00
parent 35c270490f
commit 5445aab3a8
2 changed files with 14 additions and 11 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ package-lock.json
dist.DS_Store
.git
.gitignore
.DS_Store

24
main.js
View File

@@ -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();