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.
- package/.dependency-cruiser.cjs +412 -0
- package/.github/workflows/ci.yml +2 -2
- package/.imdoneignore +2 -1
- package/README.md +2 -2
- package/_index.md +7 -0
- package/build.js +57 -0
- package/esm-migration.md +446 -0
- package/lib/FileProjectContext.js +13 -0
- package/lib/ProjectContext.js +19 -18
- package/lib/adapters/date-time.js +3 -8
- package/lib/adapters/environment.js +3 -0
- package/lib/adapters/file-gateway.js +133 -106
- package/lib/adapters/git-download.js +36 -16
- package/lib/adapters/index.js +9 -0
- package/lib/adapters/logger.js +136 -0
- package/lib/adapters/markdown.js +31 -19
- package/lib/adapters/parsers/DateLanguageParser.js +11 -9
- package/lib/adapters/parsers/content-transformer.js +35 -30
- package/lib/adapters/parsers/file/LocalFileParserFactory.js +8 -9
- package/lib/adapters/parsers/file/ReadStreamCodeParser.js +8 -8
- package/lib/adapters/parsers/file/ReadStreamMarkdownParser.js +4 -4
- package/lib/adapters/parsers/file/ReadStreamTaskParser.js +5 -3
- package/lib/adapters/parsers/file/index.js +4 -0
- package/lib/adapters/parsers/function-parser.js +1 -5
- package/lib/adapters/parsers/index.js +5 -0
- package/lib/adapters/parsers/task/CardContentParser.js +23 -32
- package/lib/adapters/parsers/task/CheckStyleTaskParser.js +2 -2
- package/lib/adapters/parsers/task/CodeStyleTaskParser.js +2 -2
- package/lib/adapters/parsers/task/HashStyleTaskParser.js +3 -3
- package/lib/adapters/parsers/task/MarkdownStyleTaskParser.js +2 -2
- package/lib/adapters/parsers/task/TaskParser.js +1 -1
- package/lib/adapters/parsers/task/index.js +6 -0
- package/lib/adapters/storage/config.js +15 -20
- package/lib/adapters/storage/index.js +2 -0
- package/lib/adapters/storage/tags.js +11 -12
- package/lib/adapters/yaml.js +8 -5
- package/lib/card.js +25 -26
- package/lib/checksum.js +22 -0
- package/lib/cli.js +114 -0
- package/lib/config.js +106 -71
- package/lib/constants.js +21 -50
- package/lib/context/ApplicationContext.js +7 -4
- package/lib/context/index.js +1 -0
- package/lib/default-settings.js +3 -3
- package/lib/domain/entities/View.js +4 -11
- package/lib/domain/entities/index.js +1 -0
- package/lib/domain/index.js +2 -0
- package/lib/domain/usecases/GetViewsUsecase.js +6 -12
- package/lib/domain/usecases/SaveViewUsecase.js +8 -14
- package/lib/domain/usecases/index.js +2 -0
- package/lib/file.js +1158 -1162
- package/lib/get-tasks-to-modify.js +117 -0
- package/lib/index.js +23 -0
- package/lib/languages.js +4 -5
- package/lib/list.js +46 -95
- package/lib/migrate-config.js +5 -5
- package/lib/mixins/index.js +2 -0
- package/lib/mixins/repo-fs-store.js +224 -289
- package/lib/mixins/repo-watched-fs-store.js +158 -147
- package/lib/plugins/archive-plugin.js +10 -8
- package/lib/plugins/default-board-actions-plugin.js +2 -2
- package/lib/plugins/default-board-properties-plugin.js +7 -7
- package/lib/plugins/default-plugins.js +7 -0
- package/lib/plugins/epic-plugin.js +6 -5
- package/lib/plugins/extension-plugin.js +24 -17
- package/lib/plugins/index.js +9 -0
- package/lib/plugins/persist-tags-plugin.js +4 -3
- package/lib/plugins/plugin-manager.js +89 -52
- package/lib/plugins/plugin-registry.js +12 -16
- package/lib/project-factory.js +21 -24
- package/lib/project.js +97 -144
- package/lib/repository.js +1323 -1555
- package/lib/task.js +562 -580
- package/lib/tools.js +39 -113
- package/lib/usecases/actions.js +32 -0
- package/lib/usecases/get-project-tags.js +3 -12
- package/lib/usecases/get-tasks-in-file.js +4 -7
- package/lib/usecases/index.js +4 -0
- package/package.json +44 -66
- package/scripts/delete-markdown-indexes.js +87 -0
- package/scripts/generate-index.js +35 -0
- package/{index-markdown.js → scripts/index-markdown.js} +7 -7
- package/tsconfig.json +15 -0
- package/types/FileProjectContext.d.ts +4 -0
- package/types/ProjectContext.d.ts +9 -0
- package/types/adapters/date-time.d.ts +2 -0
- package/types/adapters/environment.d.ts +1 -0
- package/types/adapters/file-gateway.d.ts +51 -0
- package/types/adapters/git-download.d.ts +1 -0
- package/types/adapters/index.d.ts +9 -0
- package/types/adapters/logger.d.ts +24 -0
- package/types/adapters/markdown.d.ts +13 -0
- package/types/adapters/parsers/DateLanguageParser.d.ts +1 -0
- package/types/adapters/parsers/content-transformer.d.ts +10 -0
- package/types/adapters/parsers/file/LocalFileParserFactory.d.ts +5 -0
- package/types/adapters/parsers/file/ReadStreamCodeParser.d.ts +13 -0
- package/types/adapters/parsers/file/ReadStreamMarkdownParser.d.ts +7 -0
- package/types/adapters/parsers/file/ReadStreamTaskParser.d.ts +19 -0
- package/types/adapters/parsers/file/index.d.ts +4 -0
- package/types/adapters/parsers/function-parser.d.ts +1 -0
- package/types/adapters/parsers/index.d.ts +5 -0
- package/types/adapters/parsers/task/CardContentParser.d.ts +45 -0
- package/types/adapters/parsers/task/CheckStyleTaskParser.d.ts +12 -0
- package/types/adapters/parsers/task/CodeStyleTaskParser.d.ts +14 -0
- package/types/adapters/parsers/task/HashStyleTaskParser.d.ts +13 -0
- package/types/adapters/parsers/task/MarkdownStyleTaskParser.d.ts +14 -0
- package/types/adapters/parsers/task/TaskParser.d.ts +7 -0
- package/types/adapters/parsers/task/index.d.ts +6 -0
- package/types/adapters/storage/config.d.ts +6 -0
- package/types/adapters/storage/index.d.ts +2 -0
- package/types/adapters/storage/tags.d.ts +3 -0
- package/types/adapters/yaml.d.ts +2 -0
- package/types/card.d.ts +166 -0
- package/types/checksum.d.ts +8 -0
- package/types/config.d.ts +61 -0
- package/types/constants.d.ts +46 -0
- package/types/context/ApplicationContext.d.ts +24 -0
- package/types/context/index.d.ts +1 -0
- package/types/default-settings.d.ts +2 -0
- package/types/domain/entities/FileProjectContext.d.ts +5 -0
- package/types/domain/entities/View.d.ts +17 -0
- package/types/domain/entities/index.d.ts +1 -0
- package/types/domain/index.d.ts +2 -0
- package/types/domain/usecases/GetViewsUsecase.d.ts +4 -0
- package/types/domain/usecases/SaveViewUsecase.d.ts +8 -0
- package/types/domain/usecases/index.d.ts +2 -0
- package/types/file.d.ts +344 -0
- package/types/get-tasks-to-modify.d.ts +3 -0
- package/types/index.d.ts +23 -0
- package/types/languages.d.ts +649 -0
- package/types/list.d.ts +30 -0
- package/types/migrate-config.d.ts +1 -0
- package/types/mixins/index.d.ts +2 -0
- package/types/mixins/repo-fs-store.d.ts +2 -0
- package/types/mixins/repo-watched-fs-store.d.ts +2 -0
- package/types/plugins/archive-plugin.d.ts +8 -0
- package/types/plugins/default-board-actions-plugin.d.ts +9 -0
- package/types/plugins/default-board-properties-plugin.d.ts +16 -0
- package/types/plugins/default-plugins.d.ts +6 -0
- package/types/plugins/epic-plugin.d.ts +19 -0
- package/types/plugins/extension-plugin.d.ts +15 -0
- package/types/plugins/index.d.ts +9 -0
- package/types/plugins/persist-tags-plugin.d.ts +4 -0
- package/types/plugins/plugin-manager.d.ts +68 -0
- package/types/plugins/plugin-registry.d.ts +1 -0
- package/types/project-factory.d.ts +14 -0
- package/types/project.d.ts +158 -0
- package/types/repository.d.ts +996 -0
- package/types/task.d.ts +202 -0
- package/types/tools.d.ts +29 -0
- package/types/usecases/actions.d.ts +7 -0
- package/types/usecases/get-imdone-url.d.ts +1 -0
- package/types/usecases/get-project-tags.d.ts +1 -0
- package/types/usecases/get-tasks-in-file.d.ts +4 -0
- package/types/usecases/index.d.ts +4 -0
- package/vitest.config.js +13 -0
- package/cli.js +0 -74
- package/index.js +0 -1
- package/lib/adapters/readers/FileSystemProjectReader.js +0 -45
- package/lib/context/StreamingApplicationContext.js +0 -31
- package/lib/controlers/SaveViewController.js +0 -10
- package/lib/domain/entities/FileProjectContext.js +0 -10
- package/lib/domain/usecases/OpenProjectUsecase.js +0 -13
package/lib/project.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
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
|
-
|
|
225
|
+
logger.time('toJSON time')
|
|
236
226
|
this._updatedAt = new Date()
|
|
237
227
|
const { allLists , totals } = this.getListsForImdoneJSON()
|
|
238
228
|
|
|
239
|
-
|
|
229
|
+
logger.time('plugin onBeforeBoardUpdate time')
|
|
240
230
|
await this.pluginManager.onBeforeBoardUpdate()
|
|
241
|
-
|
|
231
|
+
logger.timeEnd('plugin onBeforeBoardUpdate time')
|
|
242
232
|
|
|
243
|
-
|
|
233
|
+
logger.time('getBoardProperties time')
|
|
244
234
|
const data = this.data = await this.pluginManager.getBoardProperties()
|
|
245
|
-
|
|
235
|
+
logger.timeEnd('getBoardProperties time')
|
|
246
236
|
|
|
247
|
-
|
|
237
|
+
logger.time('getDataKeys time')
|
|
248
238
|
const dataKeys = this.dataKays = this.getDataKeys(data)
|
|
249
|
-
|
|
239
|
+
logger.timeEnd('getDataKeys time')
|
|
250
240
|
|
|
251
|
-
|
|
241
|
+
logger.time('card init time')
|
|
252
242
|
const cards = this.getInitializedCards(allLists, totals)
|
|
253
|
-
|
|
243
|
+
logger.timeEnd('card init time')
|
|
254
244
|
|
|
255
|
-
|
|
245
|
+
logger.time('plugin onBoardUpdate time')
|
|
256
246
|
await this.pluginManager.onBoardUpdate(allLists)
|
|
257
|
-
|
|
247
|
+
logger.timeEnd('plugin onBoardUpdate time')
|
|
258
248
|
|
|
259
|
-
|
|
249
|
+
logger.time('getTags time')
|
|
260
250
|
const tags = this.getTags(cards)
|
|
261
|
-
|
|
251
|
+
logger.timeEnd('getTags time')
|
|
262
252
|
|
|
263
|
-
|
|
253
|
+
logger.time('getLists time')
|
|
264
254
|
const lists = this.filter
|
|
265
255
|
? this.getRequestedLists(cards)
|
|
266
256
|
: allLists
|
|
267
|
-
|
|
257
|
+
logger.timeEnd('getLists time')
|
|
268
258
|
|
|
269
|
-
|
|
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
|
|
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
|
-
|
|
438
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
659
|
-
this.
|
|
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
|
-
|
|
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
|
-
|
|
783
|
+
logger.log('actionFunction:', actionFunction)
|
|
824
784
|
const func = new Function(`return ${actionFunction}`)()
|
|
825
785
|
func.apply(actionThis)
|
|
826
786
|
} catch (e) {
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
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
|
-
|
|
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
|
-
|
|
869
|
-
|
|
870
|
-
|
|
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)
|
|
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
|
-
|
|
894
|
-
|
|
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) {
|