imdone-core 1.42.1 → 1.43.0
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/lib/card.js
CHANGED
|
@@ -74,6 +74,8 @@ module.exports = function newCard(task, _project, dontParse) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
getCardActions() {
|
|
77
|
+
// TODO Stop allowing links/actions from card config
|
|
78
|
+
// <!-- order:-80 -->
|
|
77
79
|
const links = project.config.cardActions
|
|
78
80
|
const allLinks = this.frontMatter.links
|
|
79
81
|
? [...links, ...this.frontMatter.links]
|
|
@@ -126,7 +126,7 @@ class BacklogProject {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
async addTaskToFile({path, list, tags, content, meta, contexts=[]}) {
|
|
129
|
-
return await this.project.addTaskToFile({path, list, tags, content, meta, contexts,
|
|
129
|
+
return await this.project.addTaskToFile({path, list, tags, content, meta, contexts, useCardTemplate: true})
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
async addMetadata(task, key, value) {
|
|
@@ -54,7 +54,6 @@ module.exports = class EpicPlugin extends Plugin {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
addEpic(name, task) {
|
|
57
|
-
if (task.filteredListName) return
|
|
58
57
|
this.initEpic(name)
|
|
59
58
|
this.epics[name].epic = task
|
|
60
59
|
}
|
|
@@ -62,7 +61,7 @@ module.exports = class EpicPlugin extends Plugin {
|
|
|
62
61
|
addEpicItem(name, task) {
|
|
63
62
|
const list = task.list
|
|
64
63
|
this.initEpic(name)
|
|
65
|
-
if (!this.
|
|
64
|
+
if (!this.getEpicItems(name, list)) this.epics[name].items[list] = []
|
|
66
65
|
this.epics[name].items[list].push(task)
|
|
67
66
|
}
|
|
68
67
|
|
|
@@ -94,7 +93,6 @@ module.exports = class EpicPlugin extends Plugin {
|
|
|
94
93
|
updateCardMD(lists) {
|
|
95
94
|
this.epicNames.forEach((epicId) => {
|
|
96
95
|
const epic = this.getEpic(epicId)
|
|
97
|
-
const tasks = this.getEpicItems(epicId)
|
|
98
96
|
const epicLists = this.getEpicLists(epicId)
|
|
99
97
|
if (!epic) return
|
|
100
98
|
if (epicLists.length === 0) return
|
|
@@ -102,8 +100,9 @@ module.exports = class EpicPlugin extends Plugin {
|
|
|
102
100
|
epic.list === this.project.doneList &&
|
|
103
101
|
(this.isListHidden(epic.list, lists) ||
|
|
104
102
|
this.isListIgnored(epic.list, lists))
|
|
105
|
-
)
|
|
103
|
+
) {
|
|
106
104
|
return
|
|
105
|
+
}
|
|
107
106
|
|
|
108
107
|
const epicText = removeMD(epic.text)
|
|
109
108
|
const epicFilter = encodeURIComponent(
|
|
@@ -119,7 +118,7 @@ module.exports = class EpicPlugin extends Plugin {
|
|
|
119
118
|
epicLists.length === 0
|
|
120
119
|
? '*None*\n'
|
|
121
120
|
: '\n<div class="imdone-epic-items">\n\n' +
|
|
122
|
-
this.getTaskListMD(lists,
|
|
121
|
+
this.getTaskListMD(lists, epicFilter, epicUrl, epicId) +
|
|
123
122
|
'\n\n</div>\n'
|
|
124
123
|
|
|
125
124
|
// Add epic link to epic tasks
|
|
@@ -141,7 +140,7 @@ module.exports = class EpicPlugin extends Plugin {
|
|
|
141
140
|
})
|
|
142
141
|
}
|
|
143
142
|
|
|
144
|
-
getTaskListMD(lists,
|
|
143
|
+
getTaskListMD(lists, epicFilter, epicUrl, epicId) {
|
|
145
144
|
let content = ''
|
|
146
145
|
|
|
147
146
|
lists
|
|
@@ -36,9 +36,10 @@ module.exports = class ExtensionPlugin extends Plugin {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
getBoardActions() {
|
|
39
|
-
return this.boardActionsFunction().map(({ title, action }) => ({
|
|
39
|
+
return this.boardActionsFunction().map(({ title, action, keys }) => ({
|
|
40
40
|
name: title,
|
|
41
41
|
action,
|
|
42
|
+
keys
|
|
42
43
|
}))
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -267,7 +267,7 @@ module.exports = class PluginManager extends Emitter {
|
|
|
267
267
|
async onBeforeAddTask({path, list, content, tags, contexts, meta, addTemplate}) {
|
|
268
268
|
await this.eachPluginAsync(async ({ pluginInstance }) => {
|
|
269
269
|
try {
|
|
270
|
-
const pluginMods = await pluginInstance.onBeforeAddTask({path, list, content, tags, contexts, meta,
|
|
270
|
+
const pluginMods = await pluginInstance.onBeforeAddTask({path, list, content, tags, contexts, meta, useCardTemplate})
|
|
271
271
|
path = pluginMods.path
|
|
272
272
|
content = pluginMods.content
|
|
273
273
|
tags = pluginMods.tags
|
|
@@ -329,6 +329,7 @@ module.exports = class PluginManager extends Emitter {
|
|
|
329
329
|
actions = [
|
|
330
330
|
...actions,
|
|
331
331
|
...pluginInstance.getBoardActions().map((item, index) => {
|
|
332
|
+
if (item.title) item.name = item.title
|
|
332
333
|
return {
|
|
333
334
|
...item,
|
|
334
335
|
plugin: this.getPluginName(pluginInstance),
|
|
@@ -361,10 +362,10 @@ module.exports = class PluginManager extends Emitter {
|
|
|
361
362
|
}
|
|
362
363
|
}
|
|
363
364
|
|
|
364
|
-
performBoardAction(action) {
|
|
365
|
+
performBoardAction(action, task) {
|
|
365
366
|
const plugin = this.getPluginInstance(action.plugin)
|
|
366
367
|
try {
|
|
367
|
-
return plugin.getBoardActions()[action.index].action()
|
|
368
|
+
return plugin.getBoardActions()[action.index].action(task)
|
|
368
369
|
} catch (e) {
|
|
369
370
|
this.pluginError('getBoardActions', plugin, e)
|
|
370
371
|
}
|
package/lib/project.js
CHANGED
|
@@ -287,6 +287,8 @@ module.exports = class WorkerProject extends Project {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
get boardActions() {
|
|
290
|
+
// TODO Stop allowing board actions from config
|
|
291
|
+
// <!-- order:-90 -->
|
|
290
292
|
return [
|
|
291
293
|
...this.config.boardActions.map((item, index) => {
|
|
292
294
|
return { ...item, index }
|
|
@@ -409,8 +411,7 @@ module.exports = class WorkerProject extends Project {
|
|
|
409
411
|
this.emit('project.saveFile', { file: filePath, content })
|
|
410
412
|
}
|
|
411
413
|
|
|
412
|
-
newCard(
|
|
413
|
-
let { list, path, template, title, emit = true } = opts
|
|
414
|
+
newCard({ list, path, template, title, emit = true }) {
|
|
414
415
|
if (path) {
|
|
415
416
|
path = this.getFullPath(path)
|
|
416
417
|
if (!fileGateway.existsSync(path)) {
|
|
@@ -432,8 +433,12 @@ module.exports = class WorkerProject extends Project {
|
|
|
432
433
|
return data
|
|
433
434
|
}
|
|
434
435
|
|
|
435
|
-
async
|
|
436
|
-
|
|
436
|
+
async addCardToFile(opts) {
|
|
437
|
+
return this.addTaskToFile(opts)
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
async addTaskToFile({path, list = this.config.getDefaultList(), content, tags = [], contexts = [], meta = [], useCardTemplate = false}) {
|
|
441
|
+
const pluginMods = await this.pluginManager.onBeforeAddTask({path, list, meta, tags, contexts, content, useCardTemplate})
|
|
437
442
|
path = pluginMods.path
|
|
438
443
|
content = pluginMods.content
|
|
439
444
|
meta = pluginMods.meta
|
|
@@ -441,7 +446,7 @@ module.exports = class WorkerProject extends Project {
|
|
|
441
446
|
contexts = pluginMods.contexts
|
|
442
447
|
const cardData = this.newCard({list, path, title: eol.split(content)[0], emit: false})
|
|
443
448
|
const filePath = cardData.path
|
|
444
|
-
if (
|
|
449
|
+
if (useCardTemplate) content += cardData.template
|
|
445
450
|
|
|
446
451
|
content = this.addTagsToContent(tags, content)
|
|
447
452
|
content = this.addContextsToContent(contexts, content)
|
|
@@ -689,9 +694,10 @@ module.exports = class WorkerProject extends Project {
|
|
|
689
694
|
console.log('this:', actionThis)
|
|
690
695
|
}
|
|
691
696
|
}
|
|
692
|
-
|
|
697
|
+
// DOING: This should also take a card/task object
|
|
698
|
+
performBoardAction(action, task) {
|
|
693
699
|
if (action && action.plugin)
|
|
694
|
-
return this.pluginManager.performBoardAction(action)
|
|
700
|
+
return this.pluginManager.performBoardAction(action, task)
|
|
695
701
|
const actions = {
|
|
696
702
|
filter: (filter) => {
|
|
697
703
|
this.setFilter(filter)
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imdone-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "imdone-core",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"imdone": "cli.js"
|
|
8
|
-
},
|
|
9
6
|
"scripts": {
|
|
10
7
|
"build": "doctoc --github --notitle README.md && npm test",
|
|
11
8
|
"coverage": "nyc --reporter=lcov --reporter=text --reporter=html mocha --exit",
|
|
@@ -62,7 +59,7 @@
|
|
|
62
59
|
"function-regex": "^1.0.2",
|
|
63
60
|
"gray-matter": "^4.0.2",
|
|
64
61
|
"ignore": "^5.2.0",
|
|
65
|
-
"imdone-api": "^0.0.
|
|
62
|
+
"imdone-api": "^0.0.18",
|
|
66
63
|
"isbinaryfile": "^3.0.2",
|
|
67
64
|
"js-yaml": "^3.14.1",
|
|
68
65
|
"json-fns": "^1.0.0",
|