diff --git a/packages/bruno-app/src/components/CollectionSettings/Info/index.js b/packages/bruno-app/src/components/CollectionSettings/Info/index.js index 15ebc80d7..ce608920b 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Info/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Info/index.js @@ -33,6 +33,10 @@ const Info = ({ collection }) => { Location : {collection.pathname} + + Ignored files : + {collection.brunoConfig.ignore.map((x) => `'${x}'`).join(', ')} + Environments : {collection.environments?.length || 0} diff --git a/packages/bruno-electron/src/app/collections.js b/packages/bruno-electron/src/app/collections.js index 77cf86c22..ec2cdacc2 100644 --- a/packages/bruno-electron/src/app/collections.js +++ b/packages/bruno-electron/src/app/collections.js @@ -62,8 +62,13 @@ const openCollection = async (win, watcher, collectionPath, options = {}) => { const brunoConfig = await getCollectionConfigFile(collectionPath); const uid = generateUidBasedOnHash(collectionPath); + if (!brunoConfig.ignore || brunoConfig.ignore.length === 0) { + // Forces default behavior for legacy collections + brunoConfig.ignore = ['node_modules', '.git']; + } + win.webContents.send('main:collection-opened', collectionPath, uid, brunoConfig); - ipcMain.emit('main:collection-opened', win, collectionPath, uid); + ipcMain.emit('main:collection-opened', win, collectionPath, uid, brunoConfig); } catch (err) { if (!options.dontSendDisplayErrors) { win.webContents.send('main:display-error', { diff --git a/packages/bruno-electron/src/app/watcher.js b/packages/bruno-electron/src/app/watcher.js index fa548c6e8..23a2c565c 100644 --- a/packages/bruno-electron/src/app/watcher.js +++ b/packages/bruno-electron/src/app/watcher.js @@ -403,17 +403,18 @@ class Watcher { this.watchers = {}; } - addWatcher(win, watchPath, collectionUid) { + addWatcher(win, watchPath, collectionUid, brunoConfig) { if (this.watchers[watchPath]) { this.watchers[watchPath].close(); } + const ignores = brunoConfig?.ignore || []; const self = this; setTimeout(() => { const watcher = chokidar.watch(watchPath, { ignoreInitial: false, - usePolling: watchPath.startsWith("\\\\") ? true : false, - ignored: (path) => ['node_modules', '.git'].some((s) => path.includes(s)), + usePolling: watchPath.startsWith('\\\\') ? true : false, + ignored: (path) => ignores.some((s) => path.includes(s)), persistent: true, ignorePermissionErrors: true, awaitWriteFinish: { diff --git a/packages/bruno-electron/src/ipc/collection.js b/packages/bruno-electron/src/ipc/collection.js index 3b53b9839..9428eb4ec 100644 --- a/packages/bruno-electron/src/ipc/collection.js +++ b/packages/bruno-electron/src/ipc/collection.js @@ -70,13 +70,14 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection const brunoConfig = { version: '1', name: collectionName, - type: 'collection' + type: 'collection', + ignore: ['node_modules', '.git'] }; const content = await stringifyJson(brunoConfig); await writeFile(path.join(dirPath, 'bruno.json'), content); mainWindow.webContents.send('main:collection-opened', dirPath, uid, brunoConfig); - ipcMain.emit('main:collection-opened', mainWindow, dirPath, uid); + ipcMain.emit('main:collection-opened', mainWindow, dirPath, uid, brunoConfig); } catch (error) { return Promise.reject(error); } @@ -449,13 +450,14 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection const brunoConfig = { version: '1', name: collectionName, - type: 'collection' + type: 'collection', + ignore: ['node_modules', '.git'] }; const content = await stringifyJson(brunoConfig); await writeFile(path.join(collectionPath, 'bruno.json'), content); mainWindow.webContents.send('main:collection-opened', collectionPath, uid, brunoConfig); - ipcMain.emit('main:collection-opened', mainWindow, collectionPath, uid); + ipcMain.emit('main:collection-opened', mainWindow, collectionPath, uid, brunoConfig); lastOpenedCollections.add(collectionPath); @@ -612,8 +614,8 @@ const registerMainEventHandlers = (mainWindow, watcher, lastOpenedCollections) = shell.openExternal(docsURL); }); - ipcMain.on('main:collection-opened', (win, pathname, uid) => { - watcher.addWatcher(win, pathname, uid); + ipcMain.on('main:collection-opened', (win, pathname, uid, brunoConfig) => { + watcher.addWatcher(win, pathname, uid, brunoConfig); lastOpenedCollections.add(pathname); });