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.
Files changed (71) hide show
  1. package/README.md +2 -2
  2. package/lib/cli.js +114 -0
  3. package/lib/index.js +23 -0
  4. package/package.json +48 -66
  5. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -37
  6. package/.github/workflows/ci.yml +0 -24
  7. package/.imdoneignore +0 -12
  8. package/.mocharc.json +0 -10
  9. package/.prettierrc +0 -6
  10. package/CHANGELOG.md +0 -160
  11. package/_navbar.md +0 -1
  12. package/cli.js +0 -74
  13. package/index-markdown.js +0 -55
  14. package/index.html +0 -184
  15. package/index.js +0 -1
  16. package/lib/ProjectContext.js +0 -42
  17. package/lib/adapters/date-time.js +0 -20
  18. package/lib/adapters/file-gateway.js +0 -127
  19. package/lib/adapters/git-download.js +0 -35
  20. package/lib/adapters/markdown.js +0 -168
  21. package/lib/adapters/parsers/DateLanguageParser.js +0 -10
  22. package/lib/adapters/parsers/content-transformer.js +0 -111
  23. package/lib/adapters/parsers/file/LocalFileParserFactory.js +0 -37
  24. package/lib/adapters/parsers/file/ReadStreamCodeParser.js +0 -126
  25. package/lib/adapters/parsers/file/ReadStreamMarkdownParser.js +0 -17
  26. package/lib/adapters/parsers/file/ReadStreamTaskParser.js +0 -104
  27. package/lib/adapters/parsers/function-parser.js +0 -29
  28. package/lib/adapters/parsers/task/CardContentParser.js +0 -376
  29. package/lib/adapters/parsers/task/CheckStyleTaskParser.js +0 -28
  30. package/lib/adapters/parsers/task/CodeStyleTaskParser.js +0 -24
  31. package/lib/adapters/parsers/task/HashStyleTaskParser.js +0 -27
  32. package/lib/adapters/parsers/task/MarkdownStyleTaskParser.js +0 -24
  33. package/lib/adapters/parsers/task/TaskParser.js +0 -38
  34. package/lib/adapters/readers/FileSystemProjectReader.js +0 -45
  35. package/lib/adapters/storage/config.js +0 -49
  36. package/lib/adapters/storage/tags.js +0 -30
  37. package/lib/adapters/yaml.js +0 -6
  38. package/lib/card.js +0 -300
  39. package/lib/config.js +0 -214
  40. package/lib/constants.js +0 -97
  41. package/lib/context/ApplicationContext.js +0 -32
  42. package/lib/context/StreamingApplicationContext.js +0 -31
  43. package/lib/controlers/SaveViewController.js +0 -10
  44. package/lib/default-settings.js +0 -37
  45. package/lib/domain/entities/FileProjectContext.js +0 -10
  46. package/lib/domain/entities/View.js +0 -30
  47. package/lib/domain/usecases/GetViewsUsecase.js +0 -50
  48. package/lib/domain/usecases/OpenProjectUsecase.js +0 -13
  49. package/lib/domain/usecases/SaveViewUsecase.js +0 -57
  50. package/lib/file.js +0 -1395
  51. package/lib/languages.js +0 -114
  52. package/lib/list.js +0 -105
  53. package/lib/migrate-config.js +0 -165
  54. package/lib/mixins/repo-fs-store.js +0 -424
  55. package/lib/mixins/repo-watched-fs-store.js +0 -195
  56. package/lib/plugins/archive-plugin.js +0 -70
  57. package/lib/plugins/default-board-actions-plugin.js +0 -56
  58. package/lib/plugins/default-board-properties-plugin.js +0 -101
  59. package/lib/plugins/epic-plugin.js +0 -176
  60. package/lib/plugins/extension-plugin.js +0 -87
  61. package/lib/plugins/persist-tags-plugin.js +0 -13
  62. package/lib/plugins/plugin-manager.js +0 -421
  63. package/lib/plugins/plugin-registry.js +0 -61
  64. package/lib/project-factory.js +0 -45
  65. package/lib/project.js +0 -911
  66. package/lib/repository.js +0 -1746
  67. package/lib/task.js +0 -798
  68. package/lib/tools.js +0 -250
  69. package/lib/usecases/get-imdone-url.js +0 -6
  70. package/lib/usecases/get-project-tags.js +0 -16
  71. package/lib/usecases/get-tasks-in-file.js +0 -29
package/lib/tools.js DELETED
@@ -1,250 +0,0 @@
1
- 'use strict'
2
-
3
- var _isFunction = require('lodash.isfunction'),
4
- _noop = require('lodash.noop'),
5
- crypto = require('crypto'),
6
- _path = require('path'),
7
- fastSort = require('fast-sort/dist/sort.js'),
8
- eol = require('eol'),
9
- max_bytes = 512
10
-
11
- function mkdirp(fs, path, mode, cb, position) {
12
- if (_isFunction(mode)) {
13
- cb = mode
14
- mode = '0777'
15
- }
16
- if (!cb) cb = _noop
17
-
18
- var parts = _path.normalize(path).split(_path.sep)
19
- mode = mode || process.umask()
20
- position = position || 0
21
-
22
- if (position >= parts.length) {
23
- return cb()
24
- }
25
-
26
- var directory = parts.slice(0, position + 1).join(_path.sep) || _path.sep
27
- fs.stat(directory, function (err) {
28
- if (err === null) {
29
- mkdirp(fs, path, mode, cb, position + 1)
30
- } else {
31
- fs.mkdir(directory, mode, function (err) {
32
- if (err && err.code != 'EEXIST') {
33
- return cb(err)
34
- } else {
35
- mkdirp(fs, path, mode, cb, position + 1)
36
- }
37
- })
38
- }
39
- })
40
- }
41
-
42
- function isBinaryCheck(bytes, size) {
43
- if (size === 0) return false
44
-
45
- var suspicious_bytes = 0
46
- var total_bytes = Math.min(size, max_bytes)
47
-
48
- if (size >= 3 && bytes[0] == 0xef && bytes[1] == 0xbb && bytes[2] == 0xbf) {
49
- // UTF-8 BOM. This isn't binary.
50
- return false
51
- }
52
-
53
- for (var i = 0; i < total_bytes; i++) {
54
- if (bytes[i] === 0) {
55
- // NULL byte--it's binary!
56
- return true
57
- } else if (
58
- (bytes[i] < 7 || bytes[i] > 14) &&
59
- (bytes[i] < 32 || bytes[i] > 127)
60
- ) {
61
- // UTF-8 detection
62
- if (bytes[i] > 191 && bytes[i] < 224 && i + 1 < total_bytes) {
63
- i++
64
- if (bytes[i] < 192) {
65
- continue
66
- }
67
- } else if (bytes[i] > 223 && bytes[i] < 239 && i + 2 < total_bytes) {
68
- i++
69
- if (bytes[i] < 192 && bytes[i + 1] < 192) {
70
- i++
71
- continue
72
- }
73
- }
74
- suspicious_bytes++
75
- // Read at least 32 bytes before making a decision
76
- if (i > 32 && (suspicious_bytes * 100) / total_bytes > 10) {
77
- return true
78
- }
79
- }
80
- }
81
-
82
- if ((suspicious_bytes * 100) / total_bytes > 10) {
83
- return true
84
- }
85
-
86
- return false
87
- }
88
-
89
- module.exports = {
90
- escapeRegExp: require('escape-string-regexp'),
91
- userHome: function () {
92
- return process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE
93
- },
94
-
95
- /**
96
- * Description
97
- * @method user
98
- * @return LogicalExpression
99
- */
100
- user: function () {
101
- return process.env.USER || process.env.USERNAME
102
- },
103
-
104
- /**
105
- * Description
106
- * @method cb
107
- * @param {} cb
108
- * @return ConditionalExpression
109
- */
110
- cb: function (cb) {
111
- return _isFunction(cb) ? cb : _noop
112
- },
113
-
114
- inMixinsNoop: function (cb) {
115
- cb = this.cb(cb)
116
- cb(new Error('Implemented in mixins'))
117
- },
118
-
119
- /**
120
- * Description
121
- * @method sha
122
- * @param {} data
123
- * @return CallExpression
124
- */
125
- sha: function (data) {
126
- var shasum = crypto.createHash('sha1')
127
- shasum.update(data)
128
- return shasum.digest('hex')
129
- },
130
-
131
- /**
132
- * Description
133
- * @method format
134
- * @param {} template
135
- * @param {} col
136
- * @return CallExpression
137
- */
138
- format: function (template, col) {
139
- col =
140
- typeof col === 'object' ? col : Array.prototype.slice.call(arguments, 2)
141
-
142
- return template.replace(/\{\{|\}\}|\{(\w+)\}/g, function (m, n) {
143
- if (m == '{{') {
144
- return '{'
145
- }
146
- if (m == '}}') {
147
- return '}'
148
- }
149
- return col[n]
150
- })
151
- },
152
-
153
- isBinaryFile: function (fs, file, callback) {
154
- fs.exists(file, function (exists) {
155
- if (!exists) return callback(null, false)
156
-
157
- fs.open(file, 'r', function (err, descriptor) {
158
- if (err) return callback(err)
159
- var bytes = new Buffer(max_bytes)
160
- // Read the file with no encoding for raw buffer access.
161
- fs.read(
162
- descriptor,
163
- bytes,
164
- 0,
165
- bytes.length,
166
- 0,
167
- function (err, size, bytes) {
168
- fs.close(descriptor, function (err2) {
169
- if (err || err2) return callback(err || err2)
170
- return callback(null, isBinaryCheck(bytes, size))
171
- })
172
- }
173
- )
174
- })
175
- })
176
- },
177
-
178
- isBinaryCheck: isBinaryCheck,
179
-
180
- readdirSyncRecursive: function (fs, baseDir) {
181
- baseDir = baseDir.replace(/\/$/, '')
182
-
183
- var readdirSyncRecursive = function (baseDir) {
184
- var files = [],
185
- curFiles,
186
- nextDirs,
187
- isDir = function (fname) {
188
- return fs.existsSync(_path.join(baseDir, fname))
189
- ? fs.statSync(_path.join(baseDir, fname)).isDirectory()
190
- : false
191
- },
192
- prependBaseDir = function (fname) {
193
- return _path.join(baseDir, fname)
194
- }
195
-
196
- curFiles = fs.readdirSync(baseDir)
197
- nextDirs = curFiles.filter(isDir)
198
- curFiles = curFiles.map(prependBaseDir)
199
-
200
- files = files.concat(curFiles)
201
-
202
- while (nextDirs.length) {
203
- files = files.concat(
204
- readdirSyncRecursive(_path.join(baseDir, nextDirs.shift()))
205
- )
206
- }
207
-
208
- return files
209
- }
210
-
211
- // convert absolute paths to relative
212
- var fileList = readdirSyncRecursive(baseDir).map(function (val) {
213
- return _path.relative(baseDir, val)
214
- })
215
-
216
- return fileList
217
- },
218
-
219
- mkdirSyncRecursive: function (fs, path, mode) {
220
- var self = this
221
- path = _path.normalize(path)
222
-
223
- try {
224
- fs.mkdirSync(path, mode)
225
- } catch (err) {
226
- if (err.code == 'ENOENT') {
227
- var slashIdx = path.lastIndexOf(_path.sep)
228
-
229
- if (slashIdx > 0) {
230
- var parentPath = path.substring(0, slashIdx)
231
- this.mkdirSyncRecursive(parentPath, mode)
232
- this.mkdirSyncRecursive(path, mode)
233
- } else {
234
- throw err
235
- }
236
- } else if (err.code == 'EEXIST') {
237
- return
238
- } else {
239
- throw err
240
- }
241
- }
242
- },
243
- mkdirp: mkdirp,
244
- sortTasks(tasks) {
245
- return fastSort(tasks).asc([u => u.order, u => u.text])
246
- },
247
- hasBlankLines(content) {
248
- return new RegExp(`^\\s*${String(eol.auto)}`, 'gm').test(content)
249
- },
250
- }
@@ -1,6 +0,0 @@
1
- // TODO Add a function that returns the imdone url for vscode and obsidian plugins
2
- // <!--
3
- // created:2025-01-11T20:20:08.348Z
4
- // sid:wmr_a0ikOY39kInkmudPa
5
- // order:-110
6
- // -->
@@ -1,16 +0,0 @@
1
- const {
2
- load
3
- } = require('../adapters/storage/tags.js')
4
-
5
- const {
6
- findImdonePath
7
- } = require('../adapters/storage/config.js')
8
-
9
- module.exports = {
10
- getTags
11
- }
12
-
13
- async function getTags(filePath) {
14
- const projectPath = await findImdonePath(filePath)
15
- return await load(projectPath)
16
- }
@@ -1,29 +0,0 @@
1
- const { loadForFilePath } = require('../adapters/storage/config')
2
- const { getFileParser } = require('../adapters/parsers/file/LocalFileParserFactory')
3
- const { Readable } = require('stream');
4
-
5
- module.exports = {
6
- getTasks
7
- }
8
-
9
- async function getTasks({filePath, content}) {
10
- const config = await loadForFilePath(filePath)
11
-
12
- const readStream = new Readable({
13
- read() {
14
- this.push(content);
15
- this.push(null);
16
- }
17
- });
18
-
19
- const parser = await getFileParser(filePath, config, readStream)
20
-
21
- const tasks = []
22
- let task = true
23
- while (task) {
24
- task = await parser.readTask()
25
- if (task) tasks.push(task)
26
- }
27
- parser.close()
28
- return tasks
29
- }