Description
Developing a plugin on Windows is a major pain due to the fswatcher we set up on a plugins directory, for example here is an example of where over a 13 second timespan my plugin would have been reloaded if not for a hack I added to prevent it, in my opinion we should only be reloading a plugin if the conf or dist folders have changed, but I can understand reasons for reloading otherwise.
2018-01-17T14:35:19.986Z appcd:core:status CPU: ↓2.5% Heap: ↓36.35 MB / 42.75 MB RSS: ↓63.69 MB Uptime: 0.99m
2018-01-17T14:35:21.631Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:21.634Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
filename: '.git',
file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:21.679Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:21.682Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
filename: '.git',
file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:21.827Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:21.888Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:21.991Z appcd:core:status CPU: ↓2.4% Heap: ↑36.62 MB / 42.75 MB RSS: ↑63.93 MB Uptime: 1.02m
2018-01-17T14:35:23.993Z appcd:core:status CPU: ↓2.3% Heap: ↑36.78 MB / 42.75 MB RSS: ↑64.09 MB Uptime: 1.06m
2018-01-17T14:35:25.998Z appcd:core:status CPU: 2.3% Heap: ↑36.95 MB / 42.75 MB RSS: ↑64.25 MB Uptime: 1.09m
2018-01-17T14:35:26.926Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:26.928Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
filename: '.git',
file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:26.973Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:26.975Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
filename: '.git',
file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:27.162Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:27.225Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:28.001Z appcd:core:status CPU: ↓2.2% Heap: ↓36.30 MB / 42.75 MB RSS: ↓63.60 MB Uptime: 1.12m
2018-01-17T14:35:30.003Z appcd:core:status CPU: ↓2.1% Heap: ↑36.47 MB / 42.75 MB RSS: ↑63.77 MB Uptime: 1.16m
2018-01-17T14:35:32.007Z appcd:core:status CPU: 2.1% Heap: ↑36.65 MB / 42.75 MB RSS: ↑63.95 MB Uptime: 1.19m
2018-01-17T14:35:32.227Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:32.229Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
filename: '.git',
file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:32.274Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:32.275Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
filename: '.git',
file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:32.491Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:32.542Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
A plugin developer should be able to maintain a list of files/folders to be ignored (and we should have a default set of files/folder to ignore), before reloading the plugin we should inspect this and determine whether we should reload or not.
I guess this would be achieved by an ignore field we maybe add to the appcd section of the package.json, or it could be the inverse and a user would only declare exactly what they want to trigger a reload
{
appcd: {
ignore: [ '.git/', 'cache/', 'src/' ]
}
}
[~cbarber] Unit tests for this one are a bit of a PITA on Windows due to how the filesystem events work, for example writing a file in a directory causes two events, the add event comes first but the actual event that makes it to the debounced [onFileSystemChange](https://github.com/appcelerator/appc-daemon/blob/2372162d170abdc5bb1bc95d19150557bfd1c65f/packages/appcd-plugin/src/external-plugin.js#L371-L382) function is actually the change event of the directory, should we be normalizing events in appcd-fswatcher to try and handle these platform differences? Update: I guess this is partly down to me mis-understanding debounce, from what I understand now it makes sense for the function to be called with the change event, which seems to make me think we do need to normalize these events in fswatcher