imdone-core 1.54.13 → 1.54.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,11 @@
2
2
  "permissions": {
3
3
  "allow": [
4
4
  "Bash(npm test:*)",
5
- "Bash(node test-debug.js:*)"
5
+ "Bash(node test-debug.js:*)",
6
+ "Bash(cat:*)",
7
+ "Bash(node test-ignore-patterns.js:*)",
8
+ "Bash(node test-ignore-patterns-detailed.js:*)",
9
+ "Bash(node test-ignore-patterns-fixed.js:*)"
6
10
  ]
7
11
  }
8
12
  }
package/README.md CHANGED
@@ -9,7 +9,6 @@ Imdone is text based kanban processor with a simple syntax that uses [comment ta
9
9
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
10
10
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
11
11
 
12
-
13
12
  - [Imdone format](#imdone-format)
14
13
  - [Code Style](#code-style)
15
14
  - [Hash Style](#hash-style)
@@ -85,11 +85,12 @@ function mixin(repo, fs = require('fs')) {
85
85
  })
86
86
  }
87
87
 
88
- repo.addFilePath = async function (path) {
88
+ repo.addFilePath = function (path) {
89
+ console.log('Adding file path to allFiles:', path)
89
90
  var relPath = repo.getRelativePath(path)
90
91
  var fullPath = repo.getFullPath(path)
91
92
 
92
- const stat = await fs.promises.lstat(fullPath)
93
+ const stat = fs.lstatSync(fullPath)
93
94
  if (stat.isDirectory()) relPath += _path.sep
94
95
  if (!repo.allFiles.includes(relPath)) {
95
96
  repo.allFiles.push(relPath)
@@ -112,6 +112,7 @@ function mixin(repo, fs = require('fs')) {
112
112
  repo.pause = async function () {
113
113
  log('Pausing watcher for:', repo.path)
114
114
  paused = true
115
+ repo.emit('paused')
115
116
  return Promise.resolve()
116
117
  }
117
118
 
@@ -124,6 +125,7 @@ function mixin(repo, fs = require('fs')) {
124
125
  console.error('Error refreshing repo on resume', err)
125
126
  return reject(err)
126
127
  }
128
+ repo.emit('resumed')
127
129
  resolve(files)
128
130
  })
129
131
  })
@@ -150,12 +152,17 @@ function mixin(repo, fs = require('fs')) {
150
152
  if (_isImdonePause(file)) {
151
153
  return false
152
154
  }
153
-
154
- const ignore = !repo.shouldInclude(file)
155
- if (!ignore || /^.*\.(jpg|gif|pdf|png)$/i.test(file)) {
155
+ const isImage = /^.*\.(jpg|gif|pdf|png)$/i.test(file)
156
+ if (isImage) {
157
+ console.log('Excluding image file from watcher:', file)
158
+ return true
159
+ }
160
+ const include = repo.shouldInclude(file)
161
+ if (include) {
162
+ console.log('Including file in watcher:', file)
156
163
  repo.addFilePath(file)
157
164
  }
158
- return ignore
165
+ return !include
159
166
  },
160
167
  })
161
168
 
@@ -236,11 +243,11 @@ function mixin(repo, fs = require('fs')) {
236
243
  })
237
244
  })
238
245
  })
239
- .on('delete', function (path) {
246
+ .on('delete', async function (path) {
240
247
  log('Watcher received unlink event for file: ' + path)
241
248
  if (_isImdonePause(path)) {
242
249
  console.log('Pause file deleted. Resuming repository.')
243
- return repo.resume()
250
+ return await repo.resume()
244
251
  }
245
252
  if (paused) return log('Watcher is paused. Ignoring delete event for: ' + path)
246
253
  repo.removeFilePath(path)
package/lib/project.js CHANGED
@@ -32,17 +32,15 @@ function calculateTotals(lists = []) {
32
32
  return totals
33
33
  }
34
34
 
35
- function onChange(project, event, data) {
36
- project.emit(event, data)
37
- }
38
-
39
- const EVENTS = [
35
+ const REPO_EVENTS_EMITTED = [
40
36
  'file.processed',
41
37
  'files.found',
42
38
  'file.update',
43
39
  'file.saved',
44
40
  'list.modified',
45
41
  'config.update',
42
+ 'paused',
43
+ 'resumed',
46
44
  ]
47
45
 
48
46
  module.exports = class WorkerProject extends Project {
@@ -157,8 +155,8 @@ module.exports = class WorkerProject extends Project {
157
155
 
158
156
  console.log('data', this.data)
159
157
  console.log('dataKeys', this.dataKeys)
160
- EVENTS.forEach((event) => {
161
- this.repo.on(event, (data) => onChange(this, event, data))
158
+ REPO_EVENTS_EMITTED.forEach((event) => {
159
+ this.repo.on(event, (data) => this.emit(event, data))
162
160
  })
163
161
 
164
162
  this.repo.on('task.found', (task) => this.pluginManager.onTaskFound(task))
package/lib/repository.js CHANGED
@@ -460,7 +460,7 @@ Repository.prototype.shouldInclude = function (relPath) {
460
460
  )
461
461
  }
462
462
  }
463
-
463
+ if (include) console.log('Including file:', relPath)
464
464
  return include
465
465
  }
466
466
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "1.54.13",
3
+ "version": "1.54.15",
4
4
  "description": "imdone-core",
5
5
  "main": "index.js",
6
6
  "bin": {