mirror of
https://github.com/usebruno/bruno.git
synced 2025-03-14 23:08:20 +01:00
feat(#1496): handling edge cases for ignore config
This commit is contained in:
parent
cb95b5f36a
commit
123bf198a3
@ -63,7 +63,10 @@ const openCollection = async (win, watcher, collectionPath, options = {}) => {
|
||||
const uid = generateUidBasedOnHash(collectionPath);
|
||||
|
||||
if (!brunoConfig.ignore || brunoConfig.ignore.length === 0) {
|
||||
// Forces default behavior for legacy collections
|
||||
// 5 Feb 2024:
|
||||
// bruno.json now supports an "ignore" field to specify which folders to ignore
|
||||
// if the ignore field is not present, we default to ignoring node_modules and .git
|
||||
// this is to maintain backwards compatibility with older collections
|
||||
brunoConfig.ignore = ['node_modules', '.git'];
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,15 @@ class Watcher {
|
||||
const watcher = chokidar.watch(watchPath, {
|
||||
ignoreInitial: false,
|
||||
usePolling: watchPath.startsWith('\\\\') ? true : false,
|
||||
ignored: (path) => ignores.some((s) => path.includes(s)),
|
||||
ignored: (filepath) => {
|
||||
const normalizedPath = filepath.replace(/\\/g, '/');
|
||||
const relativePath = path.relative(watchPath, normalizedPath);
|
||||
|
||||
return ignores.some((ignorePattern) => {
|
||||
const normalizedIgnorePattern = ignorePattern.replace(/\\/g, '/');
|
||||
return relativePath === normalizedIgnorePattern || relativePath.startsWith(normalizedIgnorePattern);
|
||||
});
|
||||
},
|
||||
persistent: true,
|
||||
ignorePermissionErrors: true,
|
||||
awaitWriteFinish: {
|
||||
|
Loading…
Reference in New Issue
Block a user