1
0

Compare commits

...

10 Commits

Author SHA1 Message Date
f125f1618d Refactor file watcher to support .gitignore and ignore node_modules 2025-06-05 17:40:12 +02:00
8c744bda82 auto-git:
[change] main.js
2025-06-04 15:22:00 +02:00
4ff83d63e7 Refactor autoCommit function to improve branch handling and commit logic 2025-06-04 15:21:44 +02:00
5647c1ea66 Refactor autoCommit function to handle multiple file chunks and improve commit logic 2025-06-04 15:21:21 +02:00
6706ad75f8 Add constant for max files per commit in main.js 2025-06-04 15:08:08 +02:00
db115e6fb3 Remove uncaughtException handling and defaultMaxListeners in main.js and renderer.js 2025-06-04 14:49:41 +02:00
3a2cdeccde auto-git:
[change] renderer.js
2025-06-04 14:48:14 +02:00
cbd8cc228e auto-git:
[change] main.js
2025-06-04 14:47:24 +02:00
8f6d8f2e51 auto-git:
[change] index.html
2025-06-02 23:25:10 +02:00
c8b3c10f8f auto-git:
[change] index.html
2025-06-02 23:24:45 +02:00
2 changed files with 27 additions and 3 deletions

29
main.js
View File

@@ -56,7 +56,7 @@ console.log("Startup-Folders:", store.get('folders'));
let tray = null;
const MAX_FILES_PER_COMMIT = 20;
function createTray(win) {
const iconPath = path.join(__dirname, 'assets/icon/trayicon.png');
@@ -678,9 +678,32 @@ function ensureInGitignore(folderPath, name) {
function startMonitoringWatcher(folderPath, win) {
if (monitoringWatchers.has(folderPath)) return;
// 1. Load .gitignore (and add default rules for .git, node_modules, etc.)
const ig = ignore();
const gitignorePath = path.join(folderPath, '.gitignore');
if (fs.existsSync(gitignorePath)) {
ig.add(fs.readFileSync(gitignorePath, 'utf-8'));
}
// Always ignore .git and node_modules just in case (safety net)
ig.add(['.git', 'node_modules']);
// 2. Function for chokidar
function ignoredFunc(absPath) {
// Chokidar gives us absolute path; convert to relative to repo root
const rel = path.relative(folderPath, absPath);
// Always ignore the root .git folder
if (rel === '.git' || rel.startsWith('.git' + path.sep)) return true;
// Same for node_modules
if (rel === 'node_modules' || rel.startsWith('node_modules' + path.sep)) return true;
// .gitignore logic (note: '' means root, which is never ignored)
return rel && ig.ignores(rel);
}
// 3. Create the watcher, now with deep ignore support!
const watcher = chokidar.watch(folderPath, {
ignored: /(^|[\/\\])\..|\.git/,
ignoreInitial: false, // wichtig: ruft add-Events für vorhandene Dateien auf!
ignored: ignoredFunc,
ignoreInitial: false,
persistent: true,
depth: 99,
awaitWriteFinish: { stabilityThreshold: 300, pollInterval: 100 }

View File

@@ -15,6 +15,7 @@ window.addEventListener('DOMContentLoaded', async () => {
paginationEl.className = 'pagination flex justify-center items-center my-2 space-x-2';
contentList.parentElement.insertBefore(paginationEl, contentList);
let lastFolderPath = null;
let lastPage = null;