imdone-core 1.54.10 → 2.0.1

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.
Files changed (163) hide show
  1. package/.dependency-cruiser.cjs +412 -0
  2. package/.github/workflows/ci.yml +2 -2
  3. package/.imdoneignore +2 -1
  4. package/README.md +2 -2
  5. package/_index.md +7 -0
  6. package/build.js +57 -0
  7. package/esm-migration.md +446 -0
  8. package/lib/FileProjectContext.js +13 -0
  9. package/lib/ProjectContext.js +19 -18
  10. package/lib/adapters/date-time.js +3 -8
  11. package/lib/adapters/environment.js +3 -0
  12. package/lib/adapters/file-gateway.js +133 -106
  13. package/lib/adapters/git-download.js +36 -16
  14. package/lib/adapters/index.js +9 -0
  15. package/lib/adapters/logger.js +136 -0
  16. package/lib/adapters/markdown.js +31 -19
  17. package/lib/adapters/parsers/DateLanguageParser.js +11 -9
  18. package/lib/adapters/parsers/content-transformer.js +35 -30
  19. package/lib/adapters/parsers/file/LocalFileParserFactory.js +8 -9
  20. package/lib/adapters/parsers/file/ReadStreamCodeParser.js +8 -8
  21. package/lib/adapters/parsers/file/ReadStreamMarkdownParser.js +4 -4
  22. package/lib/adapters/parsers/file/ReadStreamTaskParser.js +5 -3
  23. package/lib/adapters/parsers/file/index.js +4 -0
  24. package/lib/adapters/parsers/function-parser.js +1 -5
  25. package/lib/adapters/parsers/index.js +5 -0
  26. package/lib/adapters/parsers/task/CardContentParser.js +23 -32
  27. package/lib/adapters/parsers/task/CheckStyleTaskParser.js +2 -2
  28. package/lib/adapters/parsers/task/CodeStyleTaskParser.js +2 -2
  29. package/lib/adapters/parsers/task/HashStyleTaskParser.js +3 -3
  30. package/lib/adapters/parsers/task/MarkdownStyleTaskParser.js +2 -2
  31. package/lib/adapters/parsers/task/TaskParser.js +1 -1
  32. package/lib/adapters/parsers/task/index.js +6 -0
  33. package/lib/adapters/storage/config.js +15 -20
  34. package/lib/adapters/storage/index.js +2 -0
  35. package/lib/adapters/storage/tags.js +11 -12
  36. package/lib/adapters/yaml.js +8 -5
  37. package/lib/card.js +25 -26
  38. package/lib/checksum.js +22 -0
  39. package/lib/cli.js +114 -0
  40. package/lib/config.js +106 -71
  41. package/lib/constants.js +21 -50
  42. package/lib/context/ApplicationContext.js +7 -4
  43. package/lib/context/index.js +1 -0
  44. package/lib/default-settings.js +3 -3
  45. package/lib/domain/entities/View.js +4 -11
  46. package/lib/domain/entities/index.js +1 -0
  47. package/lib/domain/index.js +2 -0
  48. package/lib/domain/usecases/GetViewsUsecase.js +6 -12
  49. package/lib/domain/usecases/SaveViewUsecase.js +8 -14
  50. package/lib/domain/usecases/index.js +2 -0
  51. package/lib/file.js +1158 -1162
  52. package/lib/get-tasks-to-modify.js +117 -0
  53. package/lib/index.js +23 -0
  54. package/lib/languages.js +4 -5
  55. package/lib/list.js +46 -95
  56. package/lib/migrate-config.js +5 -5
  57. package/lib/mixins/index.js +2 -0
  58. package/lib/mixins/repo-fs-store.js +224 -289
  59. package/lib/mixins/repo-watched-fs-store.js +158 -147
  60. package/lib/plugins/archive-plugin.js +10 -8
  61. package/lib/plugins/default-board-actions-plugin.js +2 -2
  62. package/lib/plugins/default-board-properties-plugin.js +7 -7
  63. package/lib/plugins/default-plugins.js +7 -0
  64. package/lib/plugins/epic-plugin.js +6 -5
  65. package/lib/plugins/extension-plugin.js +24 -17
  66. package/lib/plugins/index.js +9 -0
  67. package/lib/plugins/persist-tags-plugin.js +4 -3
  68. package/lib/plugins/plugin-manager.js +89 -52
  69. package/lib/plugins/plugin-registry.js +12 -16
  70. package/lib/project-factory.js +21 -24
  71. package/lib/project.js +97 -144
  72. package/lib/repository.js +1323 -1555
  73. package/lib/task.js +562 -580
  74. package/lib/tools.js +39 -113
  75. package/lib/usecases/actions.js +32 -0
  76. package/lib/usecases/get-project-tags.js +3 -12
  77. package/lib/usecases/get-tasks-in-file.js +4 -7
  78. package/lib/usecases/index.js +4 -0
  79. package/package.json +44 -66
  80. package/scripts/delete-markdown-indexes.js +87 -0
  81. package/scripts/generate-index.js +35 -0
  82. package/{index-markdown.js → scripts/index-markdown.js} +7 -7
  83. package/tsconfig.json +15 -0
  84. package/types/FileProjectContext.d.ts +4 -0
  85. package/types/ProjectContext.d.ts +9 -0
  86. package/types/adapters/date-time.d.ts +2 -0
  87. package/types/adapters/environment.d.ts +1 -0
  88. package/types/adapters/file-gateway.d.ts +51 -0
  89. package/types/adapters/git-download.d.ts +1 -0
  90. package/types/adapters/index.d.ts +9 -0
  91. package/types/adapters/logger.d.ts +24 -0
  92. package/types/adapters/markdown.d.ts +13 -0
  93. package/types/adapters/parsers/DateLanguageParser.d.ts +1 -0
  94. package/types/adapters/parsers/content-transformer.d.ts +10 -0
  95. package/types/adapters/parsers/file/LocalFileParserFactory.d.ts +5 -0
  96. package/types/adapters/parsers/file/ReadStreamCodeParser.d.ts +13 -0
  97. package/types/adapters/parsers/file/ReadStreamMarkdownParser.d.ts +7 -0
  98. package/types/adapters/parsers/file/ReadStreamTaskParser.d.ts +19 -0
  99. package/types/adapters/parsers/file/index.d.ts +4 -0
  100. package/types/adapters/parsers/function-parser.d.ts +1 -0
  101. package/types/adapters/parsers/index.d.ts +5 -0
  102. package/types/adapters/parsers/task/CardContentParser.d.ts +45 -0
  103. package/types/adapters/parsers/task/CheckStyleTaskParser.d.ts +12 -0
  104. package/types/adapters/parsers/task/CodeStyleTaskParser.d.ts +14 -0
  105. package/types/adapters/parsers/task/HashStyleTaskParser.d.ts +13 -0
  106. package/types/adapters/parsers/task/MarkdownStyleTaskParser.d.ts +14 -0
  107. package/types/adapters/parsers/task/TaskParser.d.ts +7 -0
  108. package/types/adapters/parsers/task/index.d.ts +6 -0
  109. package/types/adapters/storage/config.d.ts +6 -0
  110. package/types/adapters/storage/index.d.ts +2 -0
  111. package/types/adapters/storage/tags.d.ts +3 -0
  112. package/types/adapters/yaml.d.ts +2 -0
  113. package/types/card.d.ts +166 -0
  114. package/types/checksum.d.ts +8 -0
  115. package/types/config.d.ts +61 -0
  116. package/types/constants.d.ts +46 -0
  117. package/types/context/ApplicationContext.d.ts +24 -0
  118. package/types/context/index.d.ts +1 -0
  119. package/types/default-settings.d.ts +2 -0
  120. package/types/domain/entities/FileProjectContext.d.ts +5 -0
  121. package/types/domain/entities/View.d.ts +17 -0
  122. package/types/domain/entities/index.d.ts +1 -0
  123. package/types/domain/index.d.ts +2 -0
  124. package/types/domain/usecases/GetViewsUsecase.d.ts +4 -0
  125. package/types/domain/usecases/SaveViewUsecase.d.ts +8 -0
  126. package/types/domain/usecases/index.d.ts +2 -0
  127. package/types/file.d.ts +344 -0
  128. package/types/get-tasks-to-modify.d.ts +3 -0
  129. package/types/index.d.ts +23 -0
  130. package/types/languages.d.ts +649 -0
  131. package/types/list.d.ts +30 -0
  132. package/types/migrate-config.d.ts +1 -0
  133. package/types/mixins/index.d.ts +2 -0
  134. package/types/mixins/repo-fs-store.d.ts +2 -0
  135. package/types/mixins/repo-watched-fs-store.d.ts +2 -0
  136. package/types/plugins/archive-plugin.d.ts +8 -0
  137. package/types/plugins/default-board-actions-plugin.d.ts +9 -0
  138. package/types/plugins/default-board-properties-plugin.d.ts +16 -0
  139. package/types/plugins/default-plugins.d.ts +6 -0
  140. package/types/plugins/epic-plugin.d.ts +19 -0
  141. package/types/plugins/extension-plugin.d.ts +15 -0
  142. package/types/plugins/index.d.ts +9 -0
  143. package/types/plugins/persist-tags-plugin.d.ts +4 -0
  144. package/types/plugins/plugin-manager.d.ts +68 -0
  145. package/types/plugins/plugin-registry.d.ts +1 -0
  146. package/types/project-factory.d.ts +14 -0
  147. package/types/project.d.ts +158 -0
  148. package/types/repository.d.ts +996 -0
  149. package/types/task.d.ts +202 -0
  150. package/types/tools.d.ts +29 -0
  151. package/types/usecases/actions.d.ts +7 -0
  152. package/types/usecases/get-imdone-url.d.ts +1 -0
  153. package/types/usecases/get-project-tags.d.ts +1 -0
  154. package/types/usecases/get-tasks-in-file.d.ts +4 -0
  155. package/types/usecases/index.d.ts +4 -0
  156. package/vitest.config.js +13 -0
  157. package/cli.js +0 -74
  158. package/index.js +0 -1
  159. package/lib/adapters/readers/FileSystemProjectReader.js +0 -45
  160. package/lib/context/StreamingApplicationContext.js +0 -31
  161. package/lib/controlers/SaveViewController.js +0 -10
  162. package/lib/domain/entities/FileProjectContext.js +0 -10
  163. package/lib/domain/usecases/OpenProjectUsecase.js +0 -13
package/lib/project.js CHANGED
@@ -1,24 +1,26 @@
1
- const { Project } = require('imdone-api/lib/project')
2
- const PluginManager = require('./plugins/plugin-manager')
3
- const Repository = require('./repository')
4
- const _cloneDeep = require('lodash.clonedeep')
5
- const newCard = require('./card')
6
- const { JOURNAL_TYPE, CONFIG_DIR } = require('./constants')
7
- const _path = require('path')
8
- const moment = require('moment')
9
- const { getIsoDateWithOffset } = require('./adapters/date-time')
10
- const fileGateway = require('./adapters/file-gateway')
11
- const matter = require('gray-matter')
12
- const _isObject = require('lodash.isobject')
13
- const _isString = require('lodash.isstring')
14
- const _isFunction = require('lodash.isfunction')
15
- const exec = require('child_process').exec
16
- const fastSort = require('fast-sort/dist/sort.js')
17
- const Task = require('./task')
18
- const eol = require('eol')
19
- const { renderMarkdown, extractWikilinkTopics } = require('./adapters/markdown')
20
- const { getFunctionSignature } = require('./adapters/parsers/function-parser')
21
- const { format } = require('./adapters/parsers/content-transformer')
1
+ import { Project } from 'imdone-api/lib/project.js';
2
+ import { PluginManager } from './plugins/plugin-manager.js';
3
+ import { Repository } from './repository.js';
4
+ import _cloneDeep from 'lodash.clonedeep';
5
+ import { newCard } from './card.js';
6
+ import { constants } from './constants.js';
7
+ const { JOURNAL_TYPE, CONFIG_DIR } = constants;
8
+ import _path from 'node:path';
9
+ import moment from 'moment';
10
+ import { getIsoDateWithOffset } from './adapters/date-time.js';
11
+ import * as fileGateway from './adapters/file-gateway.js';
12
+ import matter from 'gray-matter';
13
+ import _isObject from 'lodash.isobject';
14
+ import _isString from 'lodash.isstring';
15
+ import _isFunction from 'lodash.isfunction';
16
+ import { exec } from 'node:child_process';
17
+ import { sort } from 'fast-sort';
18
+ import { Task } from './task.js';
19
+ import eol from 'eol';
20
+ import { renderMarkdown, extractWikilinkTopics } from './adapters/markdown.js';
21
+ import { getFunctionSignature } from './adapters/parsers/function-parser.js';
22
+ import { format } from './adapters/parsers/content-transformer.js';
23
+ import { logger } from './adapters/logger.js';
22
24
 
23
25
  function calculateTotals(lists = []) {
24
26
  const totals = {}
@@ -26,7 +28,7 @@ function calculateTotals(lists = []) {
26
28
  try {
27
29
  totals[list.name] = list.tasks.length
28
30
  } catch (e) {
29
- console.error('Error calculating list totals:', e)
31
+ logger.error('Error calculating list totals:', e)
30
32
  }
31
33
  })
32
34
  return totals
@@ -45,7 +47,7 @@ const EVENTS = [
45
47
  'config.update',
46
48
  ]
47
49
 
48
- module.exports = class WorkerProject extends Project {
50
+ export class WorkerProject extends Project {
49
51
  constructor(repo) {
50
52
  super()
51
53
  this.repo = repo
@@ -146,44 +148,32 @@ module.exports = class WorkerProject extends Project {
146
148
  this.innerFilter = filter
147
149
  }
148
150
 
149
- async init(cb) {
150
- const promise = new Promise(async (resolve, reject) => {
151
- this.pluginManager.on('plugin-installed', () => this.emitUpdate())
152
- this.pluginManager.on('plugin-uninstalled', () => this.emitUpdate())
153
- this.pluginManager.on('plugins-reloaded', () => this.emitUpdate())
154
- await this.pluginManager.loadPlugins()
155
- this.data = await this.pluginManager.getBoardProperties()
156
- this.dataKeys = this.getDataKeys(this.data)
157
-
158
- console.log('data', this.data)
159
- console.log('dataKeys', this.dataKeys)
160
- EVENTS.forEach((event) => {
161
- this.repo.on(event, (data) => onChange(this, event, data))
162
- })
163
-
164
- this.repo.on('task.found', (task) => this.pluginManager.onTaskFound(task))
151
+ async init() {
152
+ this.pluginManager.on('plugin-installed', () => this.emitUpdate())
153
+ this.pluginManager.on('plugin-uninstalled', () => this.emitUpdate())
154
+ this.pluginManager.on('plugins-reloaded', () => this.emitUpdate())
155
+ await this.pluginManager.loadPlugins()
156
+ this.data = await this.pluginManager.getBoardProperties()
157
+ this.dataKeys = this.getDataKeys(this.data)
165
158
 
166
- this.repo.init(async (err, files) => {
167
- if (err) {
168
- if (cb) cb(err)
169
- else reject(err)
170
- return
171
- }
172
- this.pluginManager
173
- .startDevMode()
174
- .then(() => {
175
- if (cb) cb(null, files)
176
- else resolve(files)
177
- })
178
- .catch(err => {
179
- console.log('Error on starting dev mode', err)
180
- if (cb) cb(err)
181
- else reject(err)
182
- })
183
- })
159
+ logger.log('data', this.data)
160
+ logger.log('dataKeys', this.dataKeys)
161
+ EVENTS.forEach((event) => {
162
+ this.repo.on(event, (data) => onChange(this, event, data))
184
163
  })
185
164
 
186
- if (!cb) return promise
165
+ this.repo.on('task.found', (task) => this.pluginManager.onTaskFound(task))
166
+
167
+ const files = await this.repo.init()
168
+
169
+ try {
170
+ await this.pluginManager.startDevMode()
171
+ } catch (err) {
172
+ logger.log('Error on starting dev mode', err)
173
+ throw new Error('Error on starting dev mode', { cause: err })
174
+ }
175
+
176
+ return files
187
177
  }
188
178
 
189
179
  initIndexes(allLists) {
@@ -232,41 +222,41 @@ module.exports = class WorkerProject extends Project {
232
222
 
233
223
  async toImdoneJSON() {
234
224
  this.pluginManager.initDevMode()
235
- console.time('toJSON time')
225
+ logger.time('toJSON time')
236
226
  this._updatedAt = new Date()
237
227
  const { allLists , totals } = this.getListsForImdoneJSON()
238
228
 
239
- console.time('plugin onBeforeBoardUpdate time')
229
+ logger.time('plugin onBeforeBoardUpdate time')
240
230
  await this.pluginManager.onBeforeBoardUpdate()
241
- console.timeEnd('plugin onBeforeBoardUpdate time')
231
+ logger.timeEnd('plugin onBeforeBoardUpdate time')
242
232
 
243
- console.time('getBoardProperties time')
233
+ logger.time('getBoardProperties time')
244
234
  const data = this.data = await this.pluginManager.getBoardProperties()
245
- console.timeEnd('getBoardProperties time')
235
+ logger.timeEnd('getBoardProperties time')
246
236
 
247
- console.time('getDataKeys time')
237
+ logger.time('getDataKeys time')
248
238
  const dataKeys = this.dataKays = this.getDataKeys(data)
249
- console.timeEnd('getDataKeys time')
239
+ logger.timeEnd('getDataKeys time')
250
240
 
251
- console.time('card init time')
241
+ logger.time('card init time')
252
242
  const cards = this.getInitializedCards(allLists, totals)
253
- console.timeEnd('card init time')
243
+ logger.timeEnd('card init time')
254
244
 
255
- console.time('plugin onBoardUpdate time')
245
+ logger.time('plugin onBoardUpdate time')
256
246
  await this.pluginManager.onBoardUpdate(allLists)
257
- console.timeEnd('plugin onBoardUpdate time')
247
+ logger.timeEnd('plugin onBoardUpdate time')
258
248
 
259
- console.time('getTags time')
249
+ logger.time('getTags time')
260
250
  const tags = this.getTags(cards)
261
- console.timeEnd('getTags time')
251
+ logger.timeEnd('getTags time')
262
252
 
263
- console.time('getLists time')
253
+ logger.time('getLists time')
264
254
  const lists = this.filter
265
255
  ? this.getRequestedLists(cards)
266
256
  : allLists
267
- console.timeEnd('getLists time')
257
+ logger.timeEnd('getLists time')
268
258
 
269
- console.timeEnd('toJSON time')
259
+ logger.timeEnd('toJSON time')
270
260
  return {
271
261
  path: this.path,
272
262
  config: this.config,
@@ -308,8 +298,8 @@ module.exports = class WorkerProject extends Project {
308
298
  this.emit('file.update')
309
299
  }
310
300
 
311
- destroy() {
312
- this.repo.destroy()
301
+ async destroy() {
302
+ await this.repo.destroy()
313
303
  if (this.pluginManager) this.pluginManager.destroyPlugins()
314
304
  }
315
305
 
@@ -387,7 +377,7 @@ module.exports = class WorkerProject extends Project {
387
377
  })
388
378
  })
389
379
 
390
- return fastSort(tags).by([
380
+ return sort(tags).by([
391
381
  {desc: (tag) => tag.count},
392
382
  {asc: (tag) => tag.name},
393
383
  ])
@@ -434,10 +424,8 @@ module.exports = class WorkerProject extends Project {
434
424
  async removeMetadata(task, key, value) {
435
425
  if (!task.meta[key]) return
436
426
  const file = this.getFileForTask(task)
437
- return this.updateCardContent(
438
- task,
439
- file.removeMetaData(task.content, key, value)
440
- )
427
+ const content = file.removeMetaData(task.content, key, value)
428
+ return await this.updateCardContent(task,content)
441
429
  }
442
430
 
443
431
  async addTag(task, tag) {
@@ -449,7 +437,7 @@ module.exports = class WorkerProject extends Project {
449
437
  tagContent,
450
438
  this.config.isMetaNewLine()
451
439
  )
452
- return this.updateCardContent(task, content)
440
+ return await this.updateCardContent(task, content)
453
441
  }
454
442
 
455
443
  async removeTag(task, tag) {
@@ -458,18 +446,13 @@ module.exports = class WorkerProject extends Project {
458
446
  `\\${this.config.getTagPrefix()}${tag}\\s`,
459
447
  'g'
460
448
  )
461
- console.log('removeTag regex:', tagContent)
449
+ logger.log('removeTag regex:', tagContent)
462
450
  const content = task.content.replace(tagContent, '')
463
- return this.updateCardContent(task, content)
451
+ return await this.updateCardContent(task, content)
464
452
  }
465
453
 
466
454
  async moveTask(task, newList, newPos) {
467
- return new Promise((resolve, reject) => {
468
- this.repo.moveTask({task, newList, newPos}, (err) => {
469
- if (err) return reject(err)
470
- resolve()
471
- })
472
- })
455
+ return this.repo.moveTask({task, newList, newPos})
473
456
  }
474
457
 
475
458
  getFile(filePath) {
@@ -485,16 +468,9 @@ module.exports = class WorkerProject extends Project {
485
468
  }
486
469
 
487
470
  async updateCardContent(task, content) {
488
- return new Promise((resolve, reject) => {
489
- this.repo.modifyTaskFromContent(task, content, (err, file) => {
490
- if (err) {
491
- console.error(err)
492
- reject(err)
493
- }
494
- this.emitUpdate()
495
- resolve(file)
496
- })
497
- })
471
+ const file = await this.repo.modifyTaskFromContent(task, content)
472
+ this.emitUpdate()
473
+ return file
498
474
  }
499
475
 
500
476
  async snackBar({ message, type, duration }) {
@@ -550,7 +526,7 @@ module.exports = class WorkerProject extends Project {
550
526
  if (!path || !_path.parse(path).ext) path = this.getNewCardsFile({title})
551
527
  path = this.getFullPath(path)
552
528
 
553
- const { isFile, isDirectory } = fileGateway.preparePathForWriting(path)
529
+ const { isFile, isDirectory } = await fileGateway.preparePathForWriting(path)
554
530
 
555
531
  if (!template) template = this.getNewCardTemplate(path, isFile)
556
532
 
@@ -574,10 +550,10 @@ module.exports = class WorkerProject extends Project {
574
550
  }
575
551
 
576
552
  async addCardToFile(opts) {
577
- return this.addTaskToFile(opts)
553
+ return await this.addTaskToFile(opts)
578
554
  }
579
555
 
580
- async addTaskToFile({path, list = this.config.getDefaultList(), content, tags = [], contexts = [], meta = [], useCardTemplate = false}) {
556
+ async addTaskToFile({path, list = this.config?.getDefaultList(), content, tags = [], contexts = [], meta = [], useCardTemplate = false}) {
581
557
  const pluginMods = await this.pluginManager.onBeforeAddTask({path, list, meta, tags, contexts, content, useCardTemplate})
582
558
  path = pluginMods.path
583
559
  content = pluginMods.content
@@ -596,12 +572,7 @@ module.exports = class WorkerProject extends Project {
596
572
  content = this.addContextsToContent(contexts, content)
597
573
  content = this.addMetaToContent(meta, content)
598
574
 
599
- return new Promise((resolve, reject) => {
600
- this.repo.addTaskToFile(filePath, list, content, (err, file, task) => {
601
- if (err) return reject(err)
602
- resolve({ file, task })
603
- })
604
- })
575
+ return await this.repo.addTaskToFile(filePath, list, content)
605
576
  }
606
577
 
607
578
  addMetaToContent(meta, content) {
@@ -655,23 +626,12 @@ module.exports = class WorkerProject extends Project {
655
626
  }
656
627
 
657
628
  async deleteTask(task) {
658
- return new Promise((resolve, reject) => {
659
- this.repo.deleteTask(task, async (err) => {
660
- if (err) return reject(err)
661
- await this.pluginManager.onAfterDeleteTask(task)
662
- resolve()
663
- })
664
- })
629
+ await this.repo.deleteTask(task)
630
+ await this.pluginManager.onAfterDeleteTask(task)
665
631
  }
666
632
 
667
633
  async deleteTasks(tasks) {
668
- return new Promise((resolve, reject) => {
669
- this.repo.deleteTasks(tasks, async (err) => {
670
- if (err) return reject(err)
671
- resolve()
672
- })
673
- })
674
-
634
+ await this.repo.deleteTasks(tasks)
675
635
  }
676
636
 
677
637
  setFilter(filter) {
@@ -820,19 +780,19 @@ module.exports = class WorkerProject extends Project {
820
780
  }
821
781
 
822
782
  try {
823
- console.log('actionFunction:', actionFunction)
783
+ logger.log('actionFunction:', actionFunction)
824
784
  const func = new Function(`return ${actionFunction}`)()
825
785
  func.apply(actionThis)
826
786
  } catch (e) {
827
- console.error(e)
828
- console.log('action:', actionFunction)
829
- console.log('this:', actionThis)
787
+ logger.error(e)
788
+ logger.log('action:', actionFunction)
789
+ logger.log('this:', actionThis)
830
790
  }
831
791
  }
832
- performBoardAction(action, task) {
792
+ async performBoardAction(action, task) {
833
793
  if (task) task = this.repo.getTask(task.id)
834
794
  if (action && action.plugin)
835
- return this.pluginManager.performBoardAction(action, task)
795
+ return await this.pluginManager.performBoardAction(action, task)
836
796
  const actions = {
837
797
  filter: (filter) => {
838
798
  this.setFilter(filter)
@@ -850,7 +810,7 @@ module.exports = class WorkerProject extends Project {
850
810
  if (cc) params.push(`cc=${encodeURIComponent(cc)}`)
851
811
  if (bcc) params.push(`bcc=${encodeURIComponent(bcc)}`)
852
812
  const url = `mailto:${to}?${params.join('&')}`
853
- console.log('opening email with:', url)
813
+ logger.log('opening email with:', url)
854
814
  this.openUrl(url)
855
815
  },
856
816
  copy: (content, message) => {
@@ -865,16 +825,16 @@ module.exports = class WorkerProject extends Project {
865
825
  try {
866
826
  actionFunction.apply(actionThis)
867
827
  } catch (err) {
868
- console.error(err)
869
- console.log('action:', actionFunction)
870
- console.log('this:', actionThis)
828
+ logger.error(err)
829
+ logger.log('action:', actionFunction)
830
+ logger.log('this:', actionThis)
871
831
  }
872
832
  }
873
833
 
874
834
  exec(cmd) {
875
835
  return new Promise((resolve, reject) => {
876
836
  exec(cmd, (error, stdout, stderr) => {
877
- if (stderr) console.warn('cmd stderr:', stderr)
837
+ if (stderr) logger.warn('cmd stderr:', stderr)
878
838
  if (error) return reject(error)
879
839
  resolve(stdout)
880
840
  })
@@ -889,16 +849,9 @@ module.exports = class WorkerProject extends Project {
889
849
  return this.pluginManager.uninstallPlugin(name)
890
850
  }
891
851
 
892
- refresh() {
893
- return new Promise((resolve, reject) => {
894
- this.repo.refresh((err) => {
895
- if (err) return reject(err)
896
- ;(async () => {
897
- await this.pluginManager.reloadPlugins()
898
- resolve()
899
- })()
900
- })
901
- })
852
+ async refresh() {
853
+ await this.repo.refresh()
854
+ await this.pluginManager.reloadPlugins()
902
855
  }
903
856
 
904
857
  renderMarkdown(content, filePath) {