Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spicy-monkeys-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@totalsoft/key-per-file-configuration': minor
---

fix keyPerFileConfiguration watcher
16 changes: 10 additions & 6 deletions packages/key-per-file-configuration/src/keyPerFileConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export function load(options?: Options): ConfigWatcher {

// Watch for file changes
const watcher = chokidar
.watch(configFolderPath, { awaitWriteFinish: true /*, usePolling: true*/ })
.watch(configFolderPath, {
awaitWriteFinish: true,
ignorePermissionErrors: true
/*, usePolling: true*/
})
.on('unlink', _removeValue)
.on('add', loadValue)
.on('change', loadValue)
Expand All @@ -43,13 +47,13 @@ function _getAbsolutePath(configPath = KEY_PER_FILE_CONFIG_PATH || defaultConfig

function _getFilePaths(configPath: string) {

if (!fs.existsSync(configPath) || fs.lstatSync(configPath).isDirectory()) {
configPath = path.join(configPath, '**')
}
if (!fs.existsSync(configPath) || fs.lstatSync(configPath).isDirectory()) {
configPath = path.join(configPath, '**')
}

configPath = configPath.replace(/\\/g, '/')
configPath = configPath.replace(/\\/g, '/')

return glob.sync(configPath, { nodir: true })
return glob.sync(configPath, { nodir: true })
}

function _loadValue(logger: Logger) {
Expand Down