dynamicdan / sn-filesync

2-way sync ServiceNow field values to local files
MIT License
66 stars 37 forks source link

config option "ignoreList" is seemingly ignored #42

Open despian opened 7 years ago

despian commented 7 years ago

I have added the following to my config file:

"ignoreList": ["*.todo"]

But I still get this in the console when I start the app:

13:34:07 - warn: File cannot be tracked because it is not valid: /Users/matt/Work/sn-scripts/todo.todo

I have also tried the following to no avail:

"ignoreList": ["./*.todo"] "ignoreList": ["/.*\\.todo/"] "ignoreList": "*.todo"

The readme states the default value for this property is /[\/\\]\./. I assumed that overriding it would stop this default ignore from working, but if I create ".filename" then this does appear to be ignored. This leads me to believe the property from my config file is maybe being ignored.

dynamicdan commented 7 years ago

Hi,

I'm not 100% sure what you need to include BUT I do know that the configuration may require escaping. Below are the important parts of the code that may help you understand how to configure your ignoreList.

Default config in app.js

// ignore hidden files/dirs like .sync_data and full records when watching for changes
constants.chokiWatcherIgnore = [/[\/\\]\./, '**/*' + constants.fullRecordSuffix];

The custom setting overrides the default (completely!!)

    // Apply custom file watcher ignore rules
    if (config.ignoreFiles) {
        constants.chokiWatcherIgnore = config.ignoreFiles;
    }

The anymatch plugin is your best reference for how the "ignored" property works:

var chokiWatcher = chokidar.watch(watchedFolders, {
            persistent: true,
            // ignores use anymatch (https://github.com/es128/anymatch)
            ignored: constants.chokiWatcherIgnore
        })

I hope that helps!

denv3r commented 6 years ago

@dynamicdan, thanks! There is error in docs. In docs you wrote "ignoreList", but there is "ignoreFiles" in your code =)