imdone-core 1.53.15 → 1.53.17
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/README.md +2 -4
- package/lib/adapters/parsers/content-transformer.js +55 -15
- package/lib/adapters/parsers/task/CheckStyleTaskParser.js +1 -1
- package/lib/adapters/parsers/task/TaskParser.js +5 -0
- package/lib/card.js +1 -0
- package/lib/file.js +11 -0
- package/lib/plugins/default-board-properties-plugin.js +24 -1
- package/lib/project.js +29 -24
- package/lib/task.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -197,11 +197,9 @@ License
|
|
|
197
197
|
[travis-image]: https://img.shields.io/travis/imdone/imdone-core/master.svg?label=linux
|
|
198
198
|
[travis-url]: https://travis-ci.org/imdone/imdone-core
|
|
199
199
|
|
|
200
|
-
<!--
|
|
201
|
-
- #BACKLOG:-550 As a vscode user I would like to see the imdone board in vscode so I can get shit done! ic:gh gh:132 id:30 +enhancement
|
|
200
|
+
<!-- # #NOTE Notes
|
|
202
201
|
|
|
203
|
-
|
|
204
|
-
# #NOTE Notes
|
|
202
|
+
**Package Version {{version}}**
|
|
205
203
|
|
|
206
204
|
[Focus]({{getFilterURL('list = DOING or tags = focus')}})
|
|
207
205
|
[Plan]({{getFilterURL(' ')}})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const template = require('lodash.template')
|
|
2
|
+
const uuid = require('uuid'); // Ensure you have uuid installed: npm install uuid
|
|
2
3
|
|
|
3
4
|
module.exports = {
|
|
4
5
|
format,
|
|
@@ -30,31 +31,70 @@ function restoreCodeBlocks(content, codeBlocks) {
|
|
|
30
31
|
return content
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Interpolates the content with the provided data.
|
|
36
|
+
* @param {string} content - The content to interpolate.
|
|
37
|
+
* @param {object} data - The data to use for interpolation.
|
|
38
|
+
* @param {object} opts - The options for interpolation.
|
|
39
|
+
* @returns {object} - The interpolated content, whether there was interpolation, and error tokens.
|
|
40
|
+
*/
|
|
41
|
+
function interpolate(content, data, opts) {
|
|
42
|
+
const errorTokens = {};
|
|
43
|
+
let hasInterpolation = false;
|
|
44
|
+
|
|
45
|
+
content = content.replace(opts.interpolate, (match, p1) => {
|
|
46
|
+
try {
|
|
47
|
+
const result = template(match, opts)(data);
|
|
48
|
+
if (result !== match) {
|
|
49
|
+
hasInterpolation = true;
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
} catch (e) {
|
|
53
|
+
const token = `__ERROR_TOKEN_${uuid.v4()}__`;
|
|
54
|
+
errorTokens[token] = match;
|
|
55
|
+
return token;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return { content, hasInterpolation, errorTokens };
|
|
60
|
+
}
|
|
61
|
+
|
|
33
62
|
function format(content, data, mustache) {
|
|
34
|
-
const opts = { interpolate: /(?<![`\\])\${([\s\S]+?)}/g }
|
|
63
|
+
const opts = { interpolate: /(?<![`\\])\${([\s\S]+?)}/g };
|
|
64
|
+
const errorTokens = {};
|
|
35
65
|
|
|
36
|
-
if (mustache) content = removeDisplayComments(content)
|
|
66
|
+
if (mustache) content = removeDisplayComments(content);
|
|
37
67
|
|
|
38
68
|
// Escape code blocks before processing interpolation
|
|
39
|
-
const { content: escapedContent, codeBlocks } = escapeCodeBlocks(content)
|
|
69
|
+
const { content: escapedContent, codeBlocks } = escapeCodeBlocks(content);
|
|
70
|
+
|
|
71
|
+
let result = escapedContent;
|
|
72
|
+
let hasInterpolation = true;
|
|
40
73
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
74
|
+
while (hasInterpolation) {
|
|
75
|
+
const interpolationResult = interpolate(result, data, opts);
|
|
76
|
+
result = interpolationResult.content;
|
|
77
|
+
hasInterpolation = interpolationResult.hasInterpolation;
|
|
78
|
+
Object.assign(errorTokens, interpolationResult.errorTokens);
|
|
45
79
|
}
|
|
46
80
|
|
|
47
81
|
if (mustache) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
82
|
+
const mustacheOpts = { interpolate: /(?<!`){{([\s\S]+?)}}/g };
|
|
83
|
+
hasInterpolation = true;
|
|
84
|
+
while (hasInterpolation) {
|
|
85
|
+
const interpolationResult = interpolate(result, data, mustacheOpts);
|
|
86
|
+
result = interpolationResult.content;
|
|
87
|
+
hasInterpolation = interpolationResult.hasInterpolation;
|
|
88
|
+
Object.assign(errorTokens, interpolationResult.errorTokens);
|
|
54
89
|
}
|
|
55
90
|
}
|
|
56
91
|
|
|
57
|
-
|
|
92
|
+
result = restoreCodeBlocks(result, codeBlocks);
|
|
58
93
|
|
|
59
|
-
|
|
94
|
+
// Restore error tokens
|
|
95
|
+
Object.keys(errorTokens).forEach(token => {
|
|
96
|
+
result = result.replace(new RegExp(token, 'g'), errorTokens[token]);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
return result;
|
|
60
100
|
}
|
|
@@ -28,6 +28,11 @@ module.exports = class TaskParser {
|
|
|
28
28
|
const re = new RegExp(this.pattern)
|
|
29
29
|
const result = re.exec(lineContent)
|
|
30
30
|
const parseResult = result && this.parse(lineContent, line, result, task)
|
|
31
|
+
|
|
32
|
+
if (parseResult && this.config.lists && !this.config.listExists(parseResult.list)) {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
return parseResult && new Task(parseResult)
|
|
32
37
|
}
|
|
33
38
|
}
|
package/lib/card.js
CHANGED
package/lib/file.js
CHANGED
|
@@ -206,6 +206,11 @@ File.parseDeferDate = function (config, text) {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
File.parseDate = function (config, text, dateType) {
|
|
209
|
+
// TODO Add the ability to set multiple reminders
|
|
210
|
+
// #imdone-1.54.0
|
|
211
|
+
// <!--
|
|
212
|
+
// order:-150
|
|
213
|
+
// -->
|
|
209
214
|
if (text.includes(`${dateType}${config.getMetaSep()}`)) return text
|
|
210
215
|
let dateString
|
|
211
216
|
return text.replace(new RegExp(`(\\s${dateType})\\s.*?\\.`,'gi'), (match, p1) => {
|
|
@@ -597,6 +602,12 @@ File.prototype.deleteDescription = function (task, config) {
|
|
|
597
602
|
this.modifyDescription(task, config)
|
|
598
603
|
}
|
|
599
604
|
|
|
605
|
+
// TODO This isn't deleting all the newlines at the end of each line in code files
|
|
606
|
+
// <!--
|
|
607
|
+
// #bug
|
|
608
|
+
// #imdone-1.54.0
|
|
609
|
+
// order:-165
|
|
610
|
+
// -->
|
|
600
611
|
File.prototype.deleteCodeOrHashTask = function (re, task, config) {
|
|
601
612
|
var log = require('debug')('delete-task:deleteCodeOrHashTask')
|
|
602
613
|
var self = this
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
const Plugin = require('imdone-api')
|
|
2
2
|
const {getIsoDateWithOffset} = require('../adapters/date-time')
|
|
3
3
|
const path = require('path')
|
|
4
|
+
|
|
4
5
|
const simpleTemplate = '\n<!--\ncreated:${timestamp}\n-->\n'
|
|
5
6
|
|
|
7
|
+
const codeSpan = (value) => '`' + value + '`';
|
|
8
|
+
const codeBlock = (value, language = '') => '```' + language + '\n' + value + '\n```';
|
|
9
|
+
|
|
6
10
|
function flattenObject(object) {
|
|
7
11
|
return Object.keys(object).reduce((acc, key) => {
|
|
8
12
|
return { ...acc, [`template_${key}`]: object[key] };
|
|
@@ -24,10 +28,29 @@ module.exports = class DefaultBoardPropertiesPlugin extends Plugin {
|
|
|
24
28
|
const clearFilterURL = this.getFilterURL('');
|
|
25
29
|
const getFilterURL = (filter) => this.getFilterURL(filter);
|
|
26
30
|
const getFilterLink = (filter) => `[Filter By: ${filter}](${this.getFilterURL(filter)})`;
|
|
27
|
-
|
|
31
|
+
// DOING Make board properties self documenting
|
|
32
|
+
// <!--
|
|
33
|
+
// #imdone-1.53.16
|
|
34
|
+
// #feature
|
|
35
|
+
// created:2025-02-14T16:54:22-05:00
|
|
36
|
+
// -->
|
|
37
|
+
// [Feature Description]
|
|
38
|
+
// ## :ballot_box_with_check: Tasks
|
|
39
|
+
// - [ ] Add tasks here
|
|
40
|
+
// ## :white_check_mark: DoD
|
|
41
|
+
// - [ ] Code complete (No Tech Debt)
|
|
42
|
+
// - [ ] Update tests
|
|
43
|
+
// - [ ] Automate what's working
|
|
44
|
+
// - [ ] Update tutorial project
|
|
45
|
+
// - [ ] Update documentation
|
|
46
|
+
// - [ ] Run like a new user and make the experience better
|
|
47
|
+
// - [ ] Make sure the first card is expanded by default or in view mode
|
|
48
|
+
// - [ ] Make sure global and default settings isn't modified when opened for the first time
|
|
28
49
|
return {
|
|
29
50
|
date: `${getIsoDateWithOffset(new Date()).substring(0, 10)}`,
|
|
30
51
|
timestamp: getIsoDateWithOffset(new Date()),
|
|
52
|
+
codeSpan,
|
|
53
|
+
codeBlock,
|
|
31
54
|
clearFilterURL,
|
|
32
55
|
getFilterURL,
|
|
33
56
|
getFilterLink,
|
package/lib/project.js
CHANGED
|
@@ -98,6 +98,14 @@ module.exports = class WorkerProject extends Project {
|
|
|
98
98
|
|
|
99
99
|
if (!cb) return promise
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
initIndexes(allLists) {
|
|
103
|
+
allLists.forEach((list) => {
|
|
104
|
+
list.tasks.filter(list => !list.filter).forEach((task, index) => {
|
|
105
|
+
task.index = index
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
}
|
|
101
109
|
|
|
102
110
|
// HACK To handle circular dependency issue with file
|
|
103
111
|
// <!--
|
|
@@ -107,17 +115,23 @@ module.exports = class WorkerProject extends Project {
|
|
|
107
115
|
return { path: this.path }
|
|
108
116
|
}
|
|
109
117
|
|
|
110
|
-
getListsForImdoneJSON(
|
|
111
|
-
|
|
118
|
+
getListsForImdoneJSON() {
|
|
119
|
+
this.initIndexes(this.repo.getTasksByList())
|
|
120
|
+
let allLists = this.getLists({
|
|
121
|
+
populateFiltered: true,
|
|
122
|
+
})
|
|
123
|
+
const totals = calculateTotals(allLists)
|
|
124
|
+
allLists = allLists.map((list) => {
|
|
112
125
|
list = { ...list }
|
|
113
126
|
list.tasks = list.tasks.map((card, index) => {
|
|
114
127
|
card.interpretedContent = ''
|
|
115
128
|
card.totals = totals
|
|
116
|
-
card.index = index
|
|
117
129
|
return card
|
|
118
130
|
})
|
|
119
131
|
return list
|
|
120
132
|
})
|
|
133
|
+
|
|
134
|
+
return { allLists, totals }
|
|
121
135
|
}
|
|
122
136
|
|
|
123
137
|
getInitializedCards(allLists, totals) {
|
|
@@ -133,12 +147,7 @@ module.exports = class WorkerProject extends Project {
|
|
|
133
147
|
this.pluginManager.initDevMode()
|
|
134
148
|
console.time('toJSON time')
|
|
135
149
|
this._updatedAt = new Date()
|
|
136
|
-
const totals =
|
|
137
|
-
this.getLists({
|
|
138
|
-
populateFiltered: true,
|
|
139
|
-
})
|
|
140
|
-
)
|
|
141
|
-
const allLists = this.getListsForImdoneJSON(totals)
|
|
150
|
+
const { allLists , totals } = this.getListsForImdoneJSON()
|
|
142
151
|
|
|
143
152
|
console.time('plugin onBeforeBoardUpdate')
|
|
144
153
|
await this.pluginManager.onBeforeBoardUpdate()
|
|
@@ -152,17 +161,13 @@ module.exports = class WorkerProject extends Project {
|
|
|
152
161
|
console.timeEnd('card init')
|
|
153
162
|
|
|
154
163
|
console.time('plugin onBoardUpdate')
|
|
155
|
-
await this.pluginManager.onBoardUpdate(
|
|
156
|
-
this.getLists({
|
|
157
|
-
tasks: cards,
|
|
158
|
-
})
|
|
159
|
-
)
|
|
164
|
+
await this.pluginManager.onBoardUpdate(allLists)
|
|
160
165
|
console.timeEnd('plugin onBoardUpdate')
|
|
161
166
|
|
|
162
|
-
const lists = this.getLists({
|
|
167
|
+
const lists = this.filter ? this.getLists({
|
|
163
168
|
tasks: this.getCards(this.filter, cards),
|
|
164
169
|
populateFiltered: true,
|
|
165
|
-
})
|
|
170
|
+
}) : allLists
|
|
166
171
|
|
|
167
172
|
console.timeEnd('toJSON time')
|
|
168
173
|
return {
|
|
@@ -263,8 +268,8 @@ module.exports = class WorkerProject extends Project {
|
|
|
263
268
|
getLists(opts) {
|
|
264
269
|
const {tasks = this.getDefaultFilteredCards(), populateFiltered = false} = opts || {}
|
|
265
270
|
return Repository.getTasksByList(this.repo, tasks, true, populateFiltered)
|
|
266
|
-
}
|
|
267
|
-
|
|
271
|
+
}
|
|
272
|
+
|
|
268
273
|
getTaskQueryProps(props) {
|
|
269
274
|
const queryProps = []
|
|
270
275
|
if (props) {
|
|
@@ -328,15 +333,15 @@ module.exports = class WorkerProject extends Project {
|
|
|
328
333
|
return this.getCards(filter, allTasks)
|
|
329
334
|
}
|
|
330
335
|
|
|
331
|
-
getCards(filter,
|
|
332
|
-
|
|
333
|
-
return
|
|
336
|
+
getCards(filter, cards = this.getDefaultFilteredCards()) {
|
|
337
|
+
cards = filter ? this.filterCards(cards, filter) : cards
|
|
338
|
+
return cards
|
|
334
339
|
}
|
|
335
340
|
|
|
336
|
-
filterCards(
|
|
341
|
+
filterCards(cards, filter) {
|
|
337
342
|
const {
|
|
338
343
|
result,
|
|
339
|
-
} = Repository.filterCards(
|
|
344
|
+
} = Repository.filterCards(cards, filter)
|
|
340
345
|
return result
|
|
341
346
|
}
|
|
342
347
|
|
|
@@ -479,7 +484,7 @@ module.exports = class WorkerProject extends Project {
|
|
|
479
484
|
})
|
|
480
485
|
}
|
|
481
486
|
|
|
482
|
-
async copyToClipboard(text, message) {
|
|
487
|
+
async copyToClipboard(text, message) {this.files
|
|
483
488
|
this.emit('project.copyToClipboard', { text, message })
|
|
484
489
|
}
|
|
485
490
|
|
package/lib/task.js
CHANGED