imdone-core 1.54.10 → 2.0.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/README.md +2 -2
- package/lib/cli.js +114 -0
- package/lib/index.js +23 -0
- package/package.json +48 -66
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -37
- package/.github/workflows/ci.yml +0 -24
- package/.imdoneignore +0 -12
- package/.mocharc.json +0 -10
- package/.prettierrc +0 -6
- package/CHANGELOG.md +0 -160
- package/_navbar.md +0 -1
- package/cli.js +0 -74
- package/index-markdown.js +0 -55
- package/index.html +0 -184
- package/index.js +0 -1
- package/lib/ProjectContext.js +0 -42
- package/lib/adapters/date-time.js +0 -20
- package/lib/adapters/file-gateway.js +0 -127
- package/lib/adapters/git-download.js +0 -35
- package/lib/adapters/markdown.js +0 -168
- package/lib/adapters/parsers/DateLanguageParser.js +0 -10
- package/lib/adapters/parsers/content-transformer.js +0 -111
- package/lib/adapters/parsers/file/LocalFileParserFactory.js +0 -37
- package/lib/adapters/parsers/file/ReadStreamCodeParser.js +0 -126
- package/lib/adapters/parsers/file/ReadStreamMarkdownParser.js +0 -17
- package/lib/adapters/parsers/file/ReadStreamTaskParser.js +0 -104
- package/lib/adapters/parsers/function-parser.js +0 -29
- package/lib/adapters/parsers/task/CardContentParser.js +0 -376
- package/lib/adapters/parsers/task/CheckStyleTaskParser.js +0 -28
- package/lib/adapters/parsers/task/CodeStyleTaskParser.js +0 -24
- package/lib/adapters/parsers/task/HashStyleTaskParser.js +0 -27
- package/lib/adapters/parsers/task/MarkdownStyleTaskParser.js +0 -24
- package/lib/adapters/parsers/task/TaskParser.js +0 -38
- package/lib/adapters/readers/FileSystemProjectReader.js +0 -45
- package/lib/adapters/storage/config.js +0 -49
- package/lib/adapters/storage/tags.js +0 -30
- package/lib/adapters/yaml.js +0 -6
- package/lib/card.js +0 -300
- package/lib/config.js +0 -214
- package/lib/constants.js +0 -97
- package/lib/context/ApplicationContext.js +0 -32
- package/lib/context/StreamingApplicationContext.js +0 -31
- package/lib/controlers/SaveViewController.js +0 -10
- package/lib/default-settings.js +0 -37
- package/lib/domain/entities/FileProjectContext.js +0 -10
- package/lib/domain/entities/View.js +0 -30
- package/lib/domain/usecases/GetViewsUsecase.js +0 -50
- package/lib/domain/usecases/OpenProjectUsecase.js +0 -13
- package/lib/domain/usecases/SaveViewUsecase.js +0 -57
- package/lib/file.js +0 -1395
- package/lib/languages.js +0 -114
- package/lib/list.js +0 -105
- package/lib/migrate-config.js +0 -165
- package/lib/mixins/repo-fs-store.js +0 -424
- package/lib/mixins/repo-watched-fs-store.js +0 -195
- package/lib/plugins/archive-plugin.js +0 -70
- package/lib/plugins/default-board-actions-plugin.js +0 -56
- package/lib/plugins/default-board-properties-plugin.js +0 -101
- package/lib/plugins/epic-plugin.js +0 -176
- package/lib/plugins/extension-plugin.js +0 -87
- package/lib/plugins/persist-tags-plugin.js +0 -13
- package/lib/plugins/plugin-manager.js +0 -421
- package/lib/plugins/plugin-registry.js +0 -61
- package/lib/project-factory.js +0 -45
- package/lib/project.js +0 -911
- package/lib/repository.js +0 -1746
- package/lib/task.js +0 -798
- package/lib/tools.js +0 -250
- package/lib/usecases/get-imdone-url.js +0 -6
- package/lib/usecases/get-project-tags.js +0 -16
- package/lib/usecases/get-tasks-in-file.js +0 -29
package/lib/card.js
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
const Task = require('./task')
|
|
2
|
-
const _path = require('path')
|
|
3
|
-
const template = require('lodash.template')
|
|
4
|
-
const _pick = require('lodash.pick')
|
|
5
|
-
const _isFunction = require('lodash.isfunction')
|
|
6
|
-
const _isObject = require('lodash.isobject')
|
|
7
|
-
const _isEmpty = require('lodash.isempty')
|
|
8
|
-
const _get = require('lodash.get')
|
|
9
|
-
const eol = require('eol')
|
|
10
|
-
const allEmoji = require('markdown-it-emoji/lib/data/full.json')
|
|
11
|
-
const { getFunctionSignature } = require('./adapters/parsers/function-parser')
|
|
12
|
-
const { format, encodeMarkdownLinks } = require('./adapters/parsers/content-transformer')
|
|
13
|
-
const { removeMD } = require('./adapters/markdown')
|
|
14
|
-
|
|
15
|
-
const CONTENT_TOKEN = '__CONTENT__'
|
|
16
|
-
const lf = String(eol.lf)
|
|
17
|
-
|
|
18
|
-
module.exports = function newCard(task, _project, dontParse) {
|
|
19
|
-
const project = _project
|
|
20
|
-
const pluginManager = _project && _project.pluginManager
|
|
21
|
-
|
|
22
|
-
class Card extends Task {
|
|
23
|
-
constructor(task, dontParse) {
|
|
24
|
-
super(project.config, task, dontParse)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
get settings() {
|
|
28
|
-
return project.config.settings || {}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
get maxLines() {
|
|
32
|
-
return project.config.maxLines
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
get interpretedContent() {
|
|
36
|
-
return this.innerInterpretedContent || this.getTextAndDescription()
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
set interpretedContent(value) {
|
|
40
|
-
this.innerInterpretedContent = value
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// TODO This should take an object of project level data and make it available to the card
|
|
44
|
-
// <!--
|
|
45
|
-
// order:-120
|
|
46
|
-
// -->
|
|
47
|
-
init(totals = project.totals) {
|
|
48
|
-
this.updateLastLine()
|
|
49
|
-
this.totals = totals
|
|
50
|
-
this.onTaskUpdate()
|
|
51
|
-
this.initProps()
|
|
52
|
-
this.initComputed()
|
|
53
|
-
this.initData()
|
|
54
|
-
this.initActions()
|
|
55
|
-
return this
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
onTaskUpdate() {
|
|
59
|
-
// TODO We should be mapping to the imdone-api task
|
|
60
|
-
// #imdone-1.45.0
|
|
61
|
-
// <!--
|
|
62
|
-
// order:-20
|
|
63
|
-
// -->
|
|
64
|
-
const interpretedContent = pluginManager.onTaskUpdate(this)
|
|
65
|
-
if (interpretedContent && interpretedContent.length > 0) {
|
|
66
|
-
this.interpretedContent = interpretedContent
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
initProps() {
|
|
71
|
-
const props = _get(this.settings, 'cards.props', {}) || {}
|
|
72
|
-
this.props = this.frontMatter.props
|
|
73
|
-
? { ...props, ...this.frontMatter.props }
|
|
74
|
-
: { ...props }
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
initComputed() {
|
|
78
|
-
const computed = _get(this.settings, 'cards.computed', {}) || {}
|
|
79
|
-
this.computed = this.frontMatter.computed
|
|
80
|
-
? { ...computed, ...this.frontMatter.computed }
|
|
81
|
-
: { ...computed }
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
initActions() {
|
|
85
|
-
this.links = []
|
|
86
|
-
if (!pluginManager) return
|
|
87
|
-
this.links = [...pluginManager.getCardActions(this)]
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
get projectPath() {
|
|
91
|
-
return project.path
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
get relPath() {
|
|
95
|
-
return this.source ? this.source.path : null
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
get fullPath() {
|
|
99
|
-
return this.source ? _path.join(project.path, this.source.path) : null
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
get defaultData() {
|
|
103
|
-
return {
|
|
104
|
-
..._pick(
|
|
105
|
-
this,
|
|
106
|
-
...['beforeText',
|
|
107
|
-
'rawTask',
|
|
108
|
-
'id',
|
|
109
|
-
'text',
|
|
110
|
-
'progress',
|
|
111
|
-
'line',
|
|
112
|
-
'lastLine',
|
|
113
|
-
'list',
|
|
114
|
-
'source',
|
|
115
|
-
'due',
|
|
116
|
-
'created',
|
|
117
|
-
'started',
|
|
118
|
-
'completed',
|
|
119
|
-
'tags',
|
|
120
|
-
'context',
|
|
121
|
-
'meta',
|
|
122
|
-
'allTags',
|
|
123
|
-
'allContext',
|
|
124
|
-
'allMeta',
|
|
125
|
-
'metaKeys',
|
|
126
|
-
'content',
|
|
127
|
-
'filteredListName',
|
|
128
|
-
'interpretedContent',
|
|
129
|
-
'projectPath',
|
|
130
|
-
'relPath',
|
|
131
|
-
'fullPath',
|
|
132
|
-
'totals',
|
|
133
|
-
'topics'].sort()
|
|
134
|
-
),
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// TODO Add isInCodeFile property to card
|
|
139
|
-
// <!--
|
|
140
|
-
// order:-115
|
|
141
|
-
// -->
|
|
142
|
-
initData() {
|
|
143
|
-
const props = { ...this.props, content: CONTENT_TOKEN }
|
|
144
|
-
const computed = { ...this.computed }
|
|
145
|
-
const defaultData = this.defaultData
|
|
146
|
-
try {
|
|
147
|
-
for (let [key, value] of Object.entries(computed)) {
|
|
148
|
-
let computedValue = value.toString()
|
|
149
|
-
const computedProps = { ...props, ...computed, ...defaultData }
|
|
150
|
-
if (_isFunction(value) && !_isEmpty(props)) {
|
|
151
|
-
try {
|
|
152
|
-
// Call the computed function for a value
|
|
153
|
-
computedValue = value.call(computedProps)
|
|
154
|
-
} catch (e) {
|
|
155
|
-
console.info(
|
|
156
|
-
`Unable to compute key: ${key} with value: ${computedValue}`,
|
|
157
|
-
e.message
|
|
158
|
-
)
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
161
|
-
try {
|
|
162
|
-
// Use template for the computed value
|
|
163
|
-
computedValue = template(value)(computedProps)
|
|
164
|
-
} catch (e) {
|
|
165
|
-
console.info(
|
|
166
|
-
`Unable to compute key: ${key} with value: ${computedValue}`,
|
|
167
|
-
e.message
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
computed[key] = computedValue
|
|
172
|
-
}
|
|
173
|
-
} catch (e) {
|
|
174
|
-
console.error(e)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const pluginData = pluginManager
|
|
178
|
-
? { ...pluginManager.getCardProperties(defaultData) }
|
|
179
|
-
: {}
|
|
180
|
-
const data = {
|
|
181
|
-
...pluginData,
|
|
182
|
-
...props,
|
|
183
|
-
...computed,
|
|
184
|
-
...defaultData
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const keys = Object.keys(data).map((key) => {
|
|
188
|
-
const value = data[key]
|
|
189
|
-
if (_isFunction(value)) {
|
|
190
|
-
key = getFunctionSignature(value)
|
|
191
|
-
}
|
|
192
|
-
return key
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
keys.forEach((key) => {
|
|
196
|
-
const value = data[key]
|
|
197
|
-
if (_isObject(value) && !Array.isArray(value)) {
|
|
198
|
-
keys.push(...Object.keys(value).map((k) => `${key}.${k}`))
|
|
199
|
-
}
|
|
200
|
-
})
|
|
201
|
-
this.dataKeys = keys
|
|
202
|
-
|
|
203
|
-
this.data = { ...data }
|
|
204
|
-
this.updateDescriptionData()
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
updateDescriptionData() {
|
|
208
|
-
this.desc = this.getDescriptionData()
|
|
209
|
-
this.data = { ...this.data, ...this.desc }
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
getEncodedContent(content) {
|
|
213
|
-
const linkRegex = /\[([^[]+)\](\((.*)\))/gm
|
|
214
|
-
const plainDescription = removeMD(content.replace(linkRegex, '$3'), {
|
|
215
|
-
stripListLeaders: false,
|
|
216
|
-
}).replace(/:(\w+):/g, (match, p1) => {
|
|
217
|
-
return allEmoji[p1]
|
|
218
|
-
})
|
|
219
|
-
const encodedText = encodeURIComponent(plainDescription)
|
|
220
|
-
const encodedMD = encodeURIComponent(content)
|
|
221
|
-
content = content.replace(CONTENT_TOKEN, encodedText)
|
|
222
|
-
content = encodeMarkdownLinks(content)
|
|
223
|
-
return { encodedMD, encodedText, content }
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
formatContent(content, mustache) {
|
|
227
|
-
return this.getEncodedContent(this.format(content, mustache))
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
format(content, mustache) {
|
|
231
|
-
const projectData = project ? { ...project.data } : {}
|
|
232
|
-
const data = { ...this.data, ...projectData }
|
|
233
|
-
return format(content, data, mustache)
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
getCardMarkdown() {
|
|
237
|
-
// - eliminate <!--[ ]--> wrappers
|
|
238
|
-
let taskMD = this.interpretedContent
|
|
239
|
-
.replace(/%%[\s\S]*?%%/g, '')
|
|
240
|
-
.replace(/<\!--\s*?-->/gs, '')
|
|
241
|
-
.trim()
|
|
242
|
-
// taskMD = this.replaceImagePaths(taskMD)
|
|
243
|
-
// - Split on eol and append lines until visible line count equals lines
|
|
244
|
-
const displayContent = []
|
|
245
|
-
const rawContent = []
|
|
246
|
-
const mdArray = eol.split(taskMD)
|
|
247
|
-
let titleFound = false
|
|
248
|
-
mdArray.forEach((line) => {
|
|
249
|
-
rawContent.push(line)
|
|
250
|
-
if (!titleFound && line === `${this.beforeText}${this.text}`) {
|
|
251
|
-
line = `<span class="imdone-card-title">${lf}${lf}${line}${lf}${lf}</span>${lf}`
|
|
252
|
-
titleFound = true
|
|
253
|
-
}
|
|
254
|
-
displayContent.push(line)
|
|
255
|
-
})
|
|
256
|
-
this.truncLines = titleFound ? this.maxLines + 5 : this.maxLines
|
|
257
|
-
const totalLines = displayContent.length
|
|
258
|
-
const markdown = displayContent.join(eol.lf)
|
|
259
|
-
const rawMarkdown = rawContent.join(eol.lf)
|
|
260
|
-
return { totalLines, markdown, rawMarkdown }
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
getHtml(content) {
|
|
264
|
-
const html = project.renderMarkdown(content, this.fullPath)
|
|
265
|
-
const mdArray = eol.split(content)
|
|
266
|
-
let truncHtml = null
|
|
267
|
-
if (mdArray.length > this.truncLines) {
|
|
268
|
-
mdArray.length = this.truncLines
|
|
269
|
-
truncHtml = project.renderMarkdown(mdArray.join(eol.lf), this.fullPath)
|
|
270
|
-
}
|
|
271
|
-
return { html, truncHtml }
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
getDescriptionData() {
|
|
275
|
-
const { markdown, rawMarkdown } = this.getCardMarkdown()
|
|
276
|
-
|
|
277
|
-
let { encodedText, encodedMD, content } = this.formatContent(
|
|
278
|
-
markdown,
|
|
279
|
-
true
|
|
280
|
-
)
|
|
281
|
-
const formattedRawMarkdown = this.formatContent(rawMarkdown, true).content
|
|
282
|
-
const { html, truncHtml } = this.getHtml(content)
|
|
283
|
-
const title = this.format(this.text, true)
|
|
284
|
-
return {
|
|
285
|
-
title,
|
|
286
|
-
html,
|
|
287
|
-
truncHtml,
|
|
288
|
-
encodedText,
|
|
289
|
-
encodedMD,
|
|
290
|
-
markdown: content,
|
|
291
|
-
rawMarkdown: formattedRawMarkdown,
|
|
292
|
-
htmlLength: html.length,
|
|
293
|
-
htmlTruncLength: truncHtml && truncHtml.length,
|
|
294
|
-
isOverMaxLines: truncHtml && truncHtml.length < html.length,
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
return new Card(task, dontParse)
|
|
300
|
-
}
|
package/lib/config.js
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const _cloneDeep = require('lodash.clonedeep')
|
|
4
|
-
const _assign = require('lodash.assign')
|
|
5
|
-
const _get = require('lodash.get')
|
|
6
|
-
const {
|
|
7
|
-
JOURNAL_TYPE,
|
|
8
|
-
DEFAULT_CONFIG,
|
|
9
|
-
} = require('./constants')
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Description
|
|
13
|
-
* @method Config
|
|
14
|
-
* @param {} opts
|
|
15
|
-
* @return
|
|
16
|
-
*/
|
|
17
|
-
const COLON = ':'
|
|
18
|
-
const DOUBLE_COLON = '::'
|
|
19
|
-
const META_SEPS = [COLON, DOUBLE_COLON]
|
|
20
|
-
|
|
21
|
-
class Config {
|
|
22
|
-
constructor(opts) {
|
|
23
|
-
_assign(this, opts)
|
|
24
|
-
if (!this.settings) this.settings = {}
|
|
25
|
-
if (!this.settings.views) this.settings.views = []
|
|
26
|
-
if (!this.settings.cards) this.settings.cards = {}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get defaultFilter() {
|
|
30
|
-
return _get(this, 'settings.defaultFilter', '')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
set defaultFilter(filter) {
|
|
34
|
-
this.settings.defaultFilter = filter
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get name() {
|
|
38
|
-
_get(this, 'settings.name', '')
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
set name(name) {
|
|
42
|
-
this.settings.name = name
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
includeList(name) {
|
|
46
|
-
return (
|
|
47
|
-
this.code &&
|
|
48
|
-
this.code.include_lists &&
|
|
49
|
-
this.code.include_lists.slice &&
|
|
50
|
-
this.code.include_lists.includes(name)
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
ignoreList(name) {
|
|
55
|
-
const list = this.lists.find((list) => name === list.name)
|
|
56
|
-
return !list || (list && list.ignore)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
listExists(name) {
|
|
60
|
-
return this.lists.findIndex((list) => list.name === name) > -1
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getDefaultList() {
|
|
64
|
-
return _get(this, 'settings.cards.defaultList', this.lists[0].name)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
getDoneList() {
|
|
68
|
-
const lists = _cloneDeep(this.lists).reverse().filter((list) => !list.filter)
|
|
69
|
-
const defaultValue = lists && lists.length ? lists[0].name : undefined
|
|
70
|
-
return _get(this, 'settings.cards.doneList', defaultValue)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
getDoingList() {
|
|
74
|
-
const lists = _cloneDeep(this.lists).filter((list) => !list.filter)
|
|
75
|
-
.reverse().map(list => list.name)
|
|
76
|
-
const defaultValue = lists ? lists.find(list => /doing|progress/i.test(list.name)) :
|
|
77
|
-
lists[1].name || '';
|
|
78
|
-
return _get(this, 'settings.cards.doingList', defaultValue)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
isAddNewCardsToTop() {
|
|
82
|
-
return _get(this, 'settings.cards.addNewCardsToTop', false)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
getNewCardSyntax() {
|
|
86
|
-
return _get(this, 'settings.newCardSyntax', 'MARKDOWN')
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
isMetaNewLine() {
|
|
90
|
-
return _get(this, 'settings.cards.metaNewLine', false)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
getTagPrefix() {
|
|
94
|
-
return _get(this, 'settings.cards.tagPrefix', '+')
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
getTaskPrefix() {
|
|
98
|
-
return _get(this, 'settings.cards.taskPrefix', '')
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
isAddCheckBoxTasks() {
|
|
102
|
-
return _get(this, 'settings.cards.addCheckBoxTasks', false)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
isAddCompletedMeta() {
|
|
106
|
-
return _get(this, 'settings.cards.addCompletedMeta', false)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
get customCardTerminator() {
|
|
110
|
-
return _get(this, 'settings.cards.customCardTerminator')
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
set customCardTerminator(terminator) {
|
|
114
|
-
this.settings.cards.customCardTerminator = terminator
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
get markdownOnly() {
|
|
118
|
-
return this.settings.markdownOnly
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
get views() {
|
|
122
|
-
return this.settings.views
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
get appendNewCardsTo() {
|
|
126
|
-
return _get(this, 'settings.appendNewCardsTo', false)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
get ignoreFrontMatter() {
|
|
130
|
-
return _get(this, 'settings.ignoreFrontMatter', false)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
get ignoreFrontMatterTags() {
|
|
134
|
-
return _get(this, 'settings.ignoreFrontMatterTags', false)
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
get journalPath() {
|
|
138
|
-
return _get(this, 'settings.journalPath', '')
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
set journalPath(path) {
|
|
142
|
-
this.settings.journalPath = path
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
get journalTemplate() {
|
|
146
|
-
const template = _get(this, 'settings.journalTemplate', '')
|
|
147
|
-
return template === 'null' ? '' : template || ''
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
get journalType() {
|
|
151
|
-
return _get(this, 'settings.journalType', JOURNAL_TYPE.FOLDER)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
get journalFilePrefix() {
|
|
155
|
-
return _get(this, 'settings.journalFilePrefix', '')
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
get journalFileSuffix() {
|
|
159
|
-
return _get(this, 'settings.journalFileSuffix', '')
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
get replaceSpacesWith() {
|
|
163
|
-
return _get(this, 'settings.replaceSpacesWith')
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
get devMode() {
|
|
167
|
-
return _get(this, 'settings.plugins.devMode', false)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
get plugins() {
|
|
171
|
-
return _get(this, 'settings.plugins', { devMode: false })
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
get orderMeta() {
|
|
175
|
-
return _get(this, 'settings.cards.orderMeta', false)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
get maxLines() {
|
|
179
|
-
return _get(this, 'settings.cards.maxLines', 1)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
get archiveFolder() {
|
|
183
|
-
return _get(this, 'settings.cards.archiveFolder', '')
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
get archiveCompleted() {
|
|
187
|
-
return _get(this, 'settings.cards.archiveCompleted')
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
get tokenPrefix() {
|
|
191
|
-
return _get(this, 'settings.cards.tokenPrefix', '#')
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
get doneList() {
|
|
195
|
-
return this.getDoneList()
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
getMetaSep() {
|
|
199
|
-
const metaSep = _get(this, 'settings.cards.metaSep', COLON)
|
|
200
|
-
return META_SEPS.includes(metaSep) ? metaSep : COLON
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
Config.newDefaultConfig = (config = {}) => new Config(
|
|
205
|
-
{
|
|
206
|
-
...DEFAULT_CONFIG,
|
|
207
|
-
lists: [
|
|
208
|
-
...DEFAULT_CONFIG.lists
|
|
209
|
-
],
|
|
210
|
-
...config
|
|
211
|
-
}
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
module.exports = Config
|
package/lib/constants.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
var path = require('path')
|
|
3
|
-
|
|
4
|
-
var DEFAULT_IGNORE_DIRS = `
|
|
5
|
-
node_modules
|
|
6
|
-
bower_components
|
|
7
|
-
target
|
|
8
|
-
build
|
|
9
|
-
dist*
|
|
10
|
-
logs
|
|
11
|
-
flow-typed
|
|
12
|
-
.git
|
|
13
|
-
.svn
|
|
14
|
-
.hs
|
|
15
|
-
.npmignore
|
|
16
|
-
.obsidian
|
|
17
|
-
.imdone/templates
|
|
18
|
-
`
|
|
19
|
-
var DEFAULT_IGNORE_EXTS = `
|
|
20
|
-
*.jpg
|
|
21
|
-
*.png
|
|
22
|
-
*.gif
|
|
23
|
-
*.swp
|
|
24
|
-
*.ttf
|
|
25
|
-
*.odf
|
|
26
|
-
*.pdf
|
|
27
|
-
*.doc*
|
|
28
|
-
*.xls*
|
|
29
|
-
*.ppt*
|
|
30
|
-
*.pps*
|
|
31
|
-
*.ppa*
|
|
32
|
-
*.pot*
|
|
33
|
-
`
|
|
34
|
-
|
|
35
|
-
var DEFAULT_IGNORE = `
|
|
36
|
-
${DEFAULT_IGNORE_DIRS}
|
|
37
|
-
${DEFAULT_IGNORE_EXTS}
|
|
38
|
-
`
|
|
39
|
-
var CONFIG_DIR = '.imdone'
|
|
40
|
-
module.exports = {
|
|
41
|
-
JOURNAL_TYPE: {
|
|
42
|
-
SINGLE_FILE: 'Single File',
|
|
43
|
-
FOLDER: 'Folder',
|
|
44
|
-
NEW_FILE: 'New File',
|
|
45
|
-
},
|
|
46
|
-
ASYNC_LIMIT: 512,
|
|
47
|
-
CONFIG_DIR,
|
|
48
|
-
CONFIG_FILE: path.join(CONFIG_DIR, 'config.json'),
|
|
49
|
-
CONFIG_FILE_YML: path.join(CONFIG_DIR, 'config.yml'),
|
|
50
|
-
SORT_FILE: path.join(CONFIG_DIR, 'sort.json'),
|
|
51
|
-
TEMPLATES_DIR: path.join(CONFIG_DIR, 'templates'),
|
|
52
|
-
IGNORE_FILE: '.imdoneignore',
|
|
53
|
-
DEFAULT_FILE_PATTERN: '^(readme\\.md|home\\.md|readme\\.w+|home\\.w+)$',
|
|
54
|
-
DEFAULT_IGNORE,
|
|
55
|
-
DEFAULT_IGNORE_DIRS,
|
|
56
|
-
DEFAULT_IGNORE_EXTS,
|
|
57
|
-
ERRORS: {
|
|
58
|
-
NOT_A_FILE: 'file must be of type File',
|
|
59
|
-
CALLBACK_REQUIRED: 'Last paramter must be a callback function',
|
|
60
|
-
NO_CONTENT: 'File has no content',
|
|
61
|
-
LIST_NOT_FOUND: 'List not found',
|
|
62
|
-
TASK_NOT_FOUND: 'Task not found',
|
|
63
|
-
},
|
|
64
|
-
DEFAULT_CONFIG: {
|
|
65
|
-
keepEmptyPriority: false,
|
|
66
|
-
code: {
|
|
67
|
-
include_lists: [
|
|
68
|
-
'TODO',
|
|
69
|
-
'DOING',
|
|
70
|
-
'DONE',
|
|
71
|
-
'PLANNING',
|
|
72
|
-
'FIXME',
|
|
73
|
-
'ARCHIVE',
|
|
74
|
-
'HACK',
|
|
75
|
-
'CHANGED',
|
|
76
|
-
'XXX',
|
|
77
|
-
'IDEA',
|
|
78
|
-
'NOTE',
|
|
79
|
-
'REVIEW',
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
lists: [
|
|
83
|
-
{
|
|
84
|
-
hidden: false,
|
|
85
|
-
name: 'TODO',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
hidden: false,
|
|
89
|
-
name: 'DOING',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
hidden: false,
|
|
93
|
-
name: 'DONE',
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const Config = require('../config')
|
|
2
|
-
|
|
3
|
-
class ApplicationContext {
|
|
4
|
-
constructor({
|
|
5
|
-
project,
|
|
6
|
-
repo,
|
|
7
|
-
projectContext,
|
|
8
|
-
projectReader,
|
|
9
|
-
projectPresenter,
|
|
10
|
-
}) {
|
|
11
|
-
this.project = project;
|
|
12
|
-
this.repo = repo;
|
|
13
|
-
this.projectContext = projectContext;
|
|
14
|
-
this.projectReader = projectReader;
|
|
15
|
-
this.projectPresenter = projectPresenter;
|
|
16
|
-
this.innerConfig = Config.newDefaultConfig()
|
|
17
|
-
this.pluginRegistry = require('../plugins/plugin-registry')
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
set config(config) {
|
|
21
|
-
this.innerConfig = config
|
|
22
|
-
this.repo && (this.repo.config = config)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get config() {
|
|
26
|
-
return (this.repo && this.repo.config) || this.innerConfig
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
const context = new ApplicationContext({})
|
|
31
|
-
|
|
32
|
-
module.exports = () => context
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const Config = require('../config')
|
|
2
|
-
|
|
3
|
-
class ApplicationContext {
|
|
4
|
-
constructor({
|
|
5
|
-
project,
|
|
6
|
-
repo,
|
|
7
|
-
projectContext,
|
|
8
|
-
projectReader,
|
|
9
|
-
projectPresenter,
|
|
10
|
-
}) {
|
|
11
|
-
this.project = project;
|
|
12
|
-
this.repo = repo;
|
|
13
|
-
this.projectContext = projectContext;
|
|
14
|
-
this.projectReader = projectReader;
|
|
15
|
-
this.projectPresenter = projectPresenter;
|
|
16
|
-
this.innerConfig = Config.newDefaultConfig()
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
set config(config) {
|
|
20
|
-
this.innerConfig = config
|
|
21
|
-
this.repo && (this.repo.config = config)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get config() {
|
|
25
|
-
return (this.repo && this.repo.config) || this.innerConfig
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
const context = new ApplicationContext({})
|
|
30
|
-
|
|
31
|
-
module.exports = () => context
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const context = require('../context/ApplicationContext')
|
|
2
|
-
const { saveView } = require('../domain/usecases/SaveViewUsecase')
|
|
3
|
-
|
|
4
|
-
async function _saveView({id, name, lists = [], filter = context().project.defaultFilter}) {
|
|
5
|
-
return saveView({id, name, lists, filter})
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
saveView: _saveView
|
|
10
|
-
}
|