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.
Files changed (163) hide show
  1. package/.dependency-cruiser.cjs +412 -0
  2. package/.github/workflows/ci.yml +2 -2
  3. package/.imdoneignore +2 -1
  4. package/README.md +2 -2
  5. package/_index.md +7 -0
  6. package/build.js +57 -0
  7. package/esm-migration.md +446 -0
  8. package/lib/FileProjectContext.js +13 -0
  9. package/lib/ProjectContext.js +19 -18
  10. package/lib/adapters/date-time.js +3 -8
  11. package/lib/adapters/environment.js +3 -0
  12. package/lib/adapters/file-gateway.js +133 -106
  13. package/lib/adapters/git-download.js +36 -16
  14. package/lib/adapters/index.js +9 -0
  15. package/lib/adapters/logger.js +136 -0
  16. package/lib/adapters/markdown.js +31 -19
  17. package/lib/adapters/parsers/DateLanguageParser.js +11 -9
  18. package/lib/adapters/parsers/content-transformer.js +35 -30
  19. package/lib/adapters/parsers/file/LocalFileParserFactory.js +8 -9
  20. package/lib/adapters/parsers/file/ReadStreamCodeParser.js +8 -8
  21. package/lib/adapters/parsers/file/ReadStreamMarkdownParser.js +4 -4
  22. package/lib/adapters/parsers/file/ReadStreamTaskParser.js +5 -3
  23. package/lib/adapters/parsers/file/index.js +4 -0
  24. package/lib/adapters/parsers/function-parser.js +1 -5
  25. package/lib/adapters/parsers/index.js +5 -0
  26. package/lib/adapters/parsers/task/CardContentParser.js +23 -32
  27. package/lib/adapters/parsers/task/CheckStyleTaskParser.js +2 -2
  28. package/lib/adapters/parsers/task/CodeStyleTaskParser.js +2 -2
  29. package/lib/adapters/parsers/task/HashStyleTaskParser.js +3 -3
  30. package/lib/adapters/parsers/task/MarkdownStyleTaskParser.js +2 -2
  31. package/lib/adapters/parsers/task/TaskParser.js +1 -1
  32. package/lib/adapters/parsers/task/index.js +6 -0
  33. package/lib/adapters/storage/config.js +15 -20
  34. package/lib/adapters/storage/index.js +2 -0
  35. package/lib/adapters/storage/tags.js +11 -12
  36. package/lib/adapters/yaml.js +8 -5
  37. package/lib/card.js +25 -26
  38. package/lib/checksum.js +22 -0
  39. package/lib/cli.js +114 -0
  40. package/lib/config.js +106 -71
  41. package/lib/constants.js +21 -50
  42. package/lib/context/ApplicationContext.js +7 -4
  43. package/lib/context/index.js +1 -0
  44. package/lib/default-settings.js +3 -3
  45. package/lib/domain/entities/View.js +4 -11
  46. package/lib/domain/entities/index.js +1 -0
  47. package/lib/domain/index.js +2 -0
  48. package/lib/domain/usecases/GetViewsUsecase.js +6 -12
  49. package/lib/domain/usecases/SaveViewUsecase.js +8 -14
  50. package/lib/domain/usecases/index.js +2 -0
  51. package/lib/file.js +1158 -1162
  52. package/lib/get-tasks-to-modify.js +117 -0
  53. package/lib/index.js +23 -0
  54. package/lib/languages.js +4 -5
  55. package/lib/list.js +46 -95
  56. package/lib/migrate-config.js +5 -5
  57. package/lib/mixins/index.js +2 -0
  58. package/lib/mixins/repo-fs-store.js +224 -289
  59. package/lib/mixins/repo-watched-fs-store.js +158 -147
  60. package/lib/plugins/archive-plugin.js +10 -8
  61. package/lib/plugins/default-board-actions-plugin.js +2 -2
  62. package/lib/plugins/default-board-properties-plugin.js +7 -7
  63. package/lib/plugins/default-plugins.js +7 -0
  64. package/lib/plugins/epic-plugin.js +6 -5
  65. package/lib/plugins/extension-plugin.js +24 -17
  66. package/lib/plugins/index.js +9 -0
  67. package/lib/plugins/persist-tags-plugin.js +4 -3
  68. package/lib/plugins/plugin-manager.js +89 -52
  69. package/lib/plugins/plugin-registry.js +12 -16
  70. package/lib/project-factory.js +21 -24
  71. package/lib/project.js +97 -144
  72. package/lib/repository.js +1323 -1555
  73. package/lib/task.js +562 -580
  74. package/lib/tools.js +39 -113
  75. package/lib/usecases/actions.js +32 -0
  76. package/lib/usecases/get-project-tags.js +3 -12
  77. package/lib/usecases/get-tasks-in-file.js +4 -7
  78. package/lib/usecases/index.js +4 -0
  79. package/package.json +44 -66
  80. package/scripts/delete-markdown-indexes.js +87 -0
  81. package/scripts/generate-index.js +35 -0
  82. package/{index-markdown.js → scripts/index-markdown.js} +7 -7
  83. package/tsconfig.json +15 -0
  84. package/types/FileProjectContext.d.ts +4 -0
  85. package/types/ProjectContext.d.ts +9 -0
  86. package/types/adapters/date-time.d.ts +2 -0
  87. package/types/adapters/environment.d.ts +1 -0
  88. package/types/adapters/file-gateway.d.ts +51 -0
  89. package/types/adapters/git-download.d.ts +1 -0
  90. package/types/adapters/index.d.ts +9 -0
  91. package/types/adapters/logger.d.ts +24 -0
  92. package/types/adapters/markdown.d.ts +13 -0
  93. package/types/adapters/parsers/DateLanguageParser.d.ts +1 -0
  94. package/types/adapters/parsers/content-transformer.d.ts +10 -0
  95. package/types/adapters/parsers/file/LocalFileParserFactory.d.ts +5 -0
  96. package/types/adapters/parsers/file/ReadStreamCodeParser.d.ts +13 -0
  97. package/types/adapters/parsers/file/ReadStreamMarkdownParser.d.ts +7 -0
  98. package/types/adapters/parsers/file/ReadStreamTaskParser.d.ts +19 -0
  99. package/types/adapters/parsers/file/index.d.ts +4 -0
  100. package/types/adapters/parsers/function-parser.d.ts +1 -0
  101. package/types/adapters/parsers/index.d.ts +5 -0
  102. package/types/adapters/parsers/task/CardContentParser.d.ts +45 -0
  103. package/types/adapters/parsers/task/CheckStyleTaskParser.d.ts +12 -0
  104. package/types/adapters/parsers/task/CodeStyleTaskParser.d.ts +14 -0
  105. package/types/adapters/parsers/task/HashStyleTaskParser.d.ts +13 -0
  106. package/types/adapters/parsers/task/MarkdownStyleTaskParser.d.ts +14 -0
  107. package/types/adapters/parsers/task/TaskParser.d.ts +7 -0
  108. package/types/adapters/parsers/task/index.d.ts +6 -0
  109. package/types/adapters/storage/config.d.ts +6 -0
  110. package/types/adapters/storage/index.d.ts +2 -0
  111. package/types/adapters/storage/tags.d.ts +3 -0
  112. package/types/adapters/yaml.d.ts +2 -0
  113. package/types/card.d.ts +166 -0
  114. package/types/checksum.d.ts +8 -0
  115. package/types/config.d.ts +61 -0
  116. package/types/constants.d.ts +46 -0
  117. package/types/context/ApplicationContext.d.ts +24 -0
  118. package/types/context/index.d.ts +1 -0
  119. package/types/default-settings.d.ts +2 -0
  120. package/types/domain/entities/FileProjectContext.d.ts +5 -0
  121. package/types/domain/entities/View.d.ts +17 -0
  122. package/types/domain/entities/index.d.ts +1 -0
  123. package/types/domain/index.d.ts +2 -0
  124. package/types/domain/usecases/GetViewsUsecase.d.ts +4 -0
  125. package/types/domain/usecases/SaveViewUsecase.d.ts +8 -0
  126. package/types/domain/usecases/index.d.ts +2 -0
  127. package/types/file.d.ts +344 -0
  128. package/types/get-tasks-to-modify.d.ts +3 -0
  129. package/types/index.d.ts +23 -0
  130. package/types/languages.d.ts +649 -0
  131. package/types/list.d.ts +30 -0
  132. package/types/migrate-config.d.ts +1 -0
  133. package/types/mixins/index.d.ts +2 -0
  134. package/types/mixins/repo-fs-store.d.ts +2 -0
  135. package/types/mixins/repo-watched-fs-store.d.ts +2 -0
  136. package/types/plugins/archive-plugin.d.ts +8 -0
  137. package/types/plugins/default-board-actions-plugin.d.ts +9 -0
  138. package/types/plugins/default-board-properties-plugin.d.ts +16 -0
  139. package/types/plugins/default-plugins.d.ts +6 -0
  140. package/types/plugins/epic-plugin.d.ts +19 -0
  141. package/types/plugins/extension-plugin.d.ts +15 -0
  142. package/types/plugins/index.d.ts +9 -0
  143. package/types/plugins/persist-tags-plugin.d.ts +4 -0
  144. package/types/plugins/plugin-manager.d.ts +68 -0
  145. package/types/plugins/plugin-registry.d.ts +1 -0
  146. package/types/project-factory.d.ts +14 -0
  147. package/types/project.d.ts +158 -0
  148. package/types/repository.d.ts +996 -0
  149. package/types/task.d.ts +202 -0
  150. package/types/tools.d.ts +29 -0
  151. package/types/usecases/actions.d.ts +7 -0
  152. package/types/usecases/get-imdone-url.d.ts +1 -0
  153. package/types/usecases/get-project-tags.d.ts +1 -0
  154. package/types/usecases/get-tasks-in-file.d.ts +4 -0
  155. package/types/usecases/index.d.ts +4 -0
  156. package/vitest.config.js +13 -0
  157. package/cli.js +0 -74
  158. package/index.js +0 -1
  159. package/lib/adapters/readers/FileSystemProjectReader.js +0 -45
  160. package/lib/context/StreamingApplicationContext.js +0 -31
  161. package/lib/controlers/SaveViewController.js +0 -10
  162. package/lib/domain/entities/FileProjectContext.js +0 -10
  163. package/lib/domain/usecases/OpenProjectUsecase.js +0 -13
@@ -0,0 +1,117 @@
1
+ import { isNumber } from "./adapters/parsers/task/CardContentParser.js";
2
+
3
+ export function getPreviousIndexWithDifferentOrder(tasks, pos) {
4
+ let closestIndexWithOrder = -1
5
+
6
+ if (pos === 0) return closestIndexWithOrder
7
+
8
+ let lastTask = tasks[pos] || tasks [pos - 1]
9
+
10
+ for (
11
+ let index = pos - 1;
12
+ index >= 0 && closestIndexWithOrder < 0;
13
+ index--
14
+ ) {
15
+ const t = tasks[index]
16
+ if (!tasksHaveSameOrder(lastTask, t)) closestIndexWithOrder = index
17
+ lastTask = t
18
+ }
19
+ return closestIndexWithOrder
20
+ }
21
+
22
+ export function getNextIndexWithDifferentOrder(tasks, pos) {
23
+ let closestIndexWithOrder = -1
24
+
25
+ let lastTask = tasks[pos]
26
+
27
+ for (
28
+ let index = pos;
29
+ index < tasks.length && closestIndexWithOrder < 0;
30
+ index++
31
+ ) {
32
+ const t = tasks[index]
33
+ if (!tasksHaveSameOrder(lastTask, t)) closestIndexWithOrder = index
34
+ lastTask = t
35
+ }
36
+ return closestIndexWithOrder
37
+ }
38
+
39
+ function taskBeforeAndAfterHaveDifferentOrder(taskList, newPos) {
40
+ const taskBefore = taskList[newPos - 1]
41
+ const taskAfter = taskList[newPos]
42
+ return taskBeforeHasOrder(taskList, newPos)
43
+ && taskAfterHasOrder(taskList, newPos)
44
+ && parseFloat(taskBefore.order) !== parseFloat(taskAfter.order)
45
+ }
46
+
47
+ function taskBeforeHasOrder(taskList, newPos) {
48
+ const taskBefore = taskList[newPos - 1]
49
+ return taskBefore && isNumber(taskBefore.order)
50
+ }
51
+
52
+ function taskAfterHasOrder(taskList, newPos) {
53
+ const taskAfter = taskList[newPos]
54
+ return taskAfter && isNumber(taskAfter.order)
55
+ }
56
+ function lastTaskHasOrder(taskList) {
57
+ const lastTask = taskList[taskList.length - 1]
58
+ return lastTask && isNumber(lastTask.order)
59
+ }
60
+
61
+ export function getTasksToModify(task, taskList, newPos) {
62
+ const previousIndexWithDifferentOrder = getPreviousIndexWithDifferentOrder(taskList, newPos)
63
+ const nextIndexWithDifferentOrder = getNextIndexWithDifferentOrder(taskList, newPos)
64
+ const previousTaskWithOrder = taskList[previousIndexWithDifferentOrder]
65
+ const nextTaskWithOrder = taskList[nextIndexWithDifferentOrder]
66
+
67
+ const startingOrder = previousTaskWithOrder
68
+ ? isNumber(previousTaskWithOrder.order) && previousTaskWithOrder.order || 0
69
+ : 0;
70
+ const endingOrder = nextTaskWithOrder
71
+ ? nextTaskWithOrder.order
72
+ : undefined;
73
+
74
+ const start = previousIndexWithDifferentOrder > -1 ? previousIndexWithDifferentOrder + 1 : 0;
75
+ const end = nextIndexWithDifferentOrder > -1 ? nextIndexWithDifferentOrder : newPos + 1;
76
+ const changes = nextIndexWithDifferentOrder - previousIndexWithDifferentOrder + 1
77
+ const increment = isNumber(endingOrder) ? (endingOrder - startingOrder) / changes : 10
78
+ const tasksToModify = []
79
+ let newOrder = startingOrder
80
+ let order = 0
81
+ if (taskList.length === 0) {
82
+ order = 0
83
+ } else if (newPos === 0) {
84
+ order = taskList[0].order - 10
85
+ } else if (newPos === taskList.length && lastTaskHasOrder(taskList)) {
86
+ order = taskList[taskList.length - 1].order + 10
87
+ } else if (taskBeforeAndAfterHaveDifferentOrder(taskList, newPos)) {
88
+ order = (taskList[newPos].order - taskList[newPos - 1].order) / 2 + taskList[newPos - 1].order
89
+ } else if (taskBeforeHasOrder(taskList, newPos) && !taskAfterHasOrder(taskList, newPos)) {
90
+ order = taskList[newPos - 1].order + 10
91
+ } else {
92
+ for (let index = start; index < end; index++) {
93
+ newOrder += increment
94
+ if (index === newPos) {
95
+ task.order = newOrder
96
+ tasksToModify.push(task)
97
+ newOrder += increment
98
+ }
99
+
100
+ if (!taskList[index]) continue
101
+ taskList[index].order = newOrder
102
+ tasksToModify.push(taskList[index])
103
+ }
104
+ }
105
+
106
+ if (tasksToModify.length === 0) {
107
+ task.order = order
108
+ tasksToModify.push(task)
109
+ }
110
+
111
+ return tasksToModify
112
+ }
113
+
114
+ function tasksHaveSameOrder(taskA, taskB) {
115
+ return taskA && taskB && taskA.order + "" === taskB.order + ""
116
+ }
117
+
package/lib/index.js ADDED
@@ -0,0 +1,23 @@
1
+ export * from './FileProjectContext.js';
2
+ export * from './ProjectContext.js';
3
+ export * from './card.js';
4
+ export * from './checksum.js';
5
+ export * from './config.js';
6
+ export * from './constants.js';
7
+ export * from './default-settings.js';
8
+ export * from './file.js';
9
+ export * from './get-tasks-to-modify.js';
10
+ export * from './languages.js';
11
+ export * from './list.js';
12
+ export * from './migrate-config.js';
13
+ export * from './project-factory.js';
14
+ export * from './project.js';
15
+ export * from './repository.js';
16
+ export * from './task.js';
17
+ export * from './tools.js';
18
+ export * as adapters from './adapters/index.js';
19
+ export * as context from './context/index.js';
20
+ export * as domain from './domain/index.js';
21
+ export * as mixins from './mixins/index.js';
22
+ export * as plugins from './plugins/index.js';
23
+ export * as usecases from './usecases/index.js';
package/lib/languages.js CHANGED
@@ -1,9 +1,8 @@
1
- 'use strict';
1
+ const cBlock = {"start":"/*", "end":"*/", "ignore":"*"};
2
+ const htmlBlock = {"start": "<!--", "end": "-->", "ignore": "-"};
3
+ const gamsBlock = {"start": "$ontext", "end": "$offtext", "ignore": "-"};
2
4
 
3
- var cBlock = {"start":"/*", "end":"*/", "ignore":"*"};
4
- var htmlBlock = {"start": "<!--", "end": "-->", "ignore": "-"};
5
- var gamsBlock = {"start": "$ontext", "end": "$offtext", "ignore": "-"};
6
- module.exports = {
5
+ export const languages = {
7
6
  ".boot": {"name": "boot", "symbol": ";"},
8
7
  ".coffee": {"name": "coffeescript", "symbol": "#"},
9
8
  ".litcoffee": {"name": "coffeescript", "symbol": "#", "literate": true},
package/lib/list.js CHANGED
@@ -1,10 +1,4 @@
1
- 'use strict';
2
-
3
- const uniqid = require('uniqid')
4
- // BACKLOG Create list groups to show and hide for projects/repos. gh:96 id:11
5
- // <!--
6
- // order:-610
7
- // -->
1
+ import uniqid from 'uniqid';
8
2
 
9
3
  /**
10
4
  * Description
@@ -13,93 +7,50 @@ const uniqid = require('uniqid')
13
7
  * @param {} hidden
14
8
  * @return
15
9
  */
16
- function List({ name, hidden, ignore, filter, id }) {
17
- this.name = name;
18
- this.hidden = hidden || false
19
- this.ignore = ignore || false
20
- this.id = id || uniqid()
21
- if (filter) this.filter = filter
22
- this.tasks = [];
23
- }
24
-
25
- /**
26
- * Description
27
- * @method isList
28
- * @param {} list
29
- * @return BinaryExpression
30
- */
31
- List.isList = function(list) {
32
- return list instanceof List;
33
- };
34
-
35
- /**
36
- * Description
37
- * @method isHidden
38
- * @return MemberExpression
39
- */
40
- List.prototype.isHidden = function() {
41
- return this.hidden;
42
- };
43
-
44
- /**
45
- * Description
46
- * @method getName
47
- * @return MemberExpression
48
- */
49
- List.prototype.getName = function() {
50
- return this.name;
51
- };
52
-
53
- /**
54
- * Description
55
- * @method getTasks
56
- * @return MemberExpression
57
- */
58
- List.prototype.getTasks = function() {
59
- return this.tasks;
60
- };
61
-
62
- /**
63
- * Description
64
- * @method addTask
65
- * @param {} task
66
- * @return
67
- */
68
- List.prototype.addTask = function(task) {
69
- if (!this.tasks.find(_task => _task.equals(task))) {
70
- this.tasks.push(task);
10
+ export class List {
11
+ constructor({ name, hidden, ignore, filter, id }) {
12
+ this.name = name;
13
+ this.hidden = hidden || false
14
+ this.ignore = ignore || false
15
+ this.id = id || uniqid()
16
+ if (filter) this.filter = filter
17
+ this.tasks = [];
71
18
  }
72
- };
73
-
74
- /**
75
- * Description
76
- * @method setTasks
77
- * @param {} tasks
78
- * @return
79
- */
80
- List.prototype.setTasks = function(tasks) {
81
- this.tasks = tasks;
82
- };
83
-
84
- /**
85
- * Description
86
- * @method hasTasks
87
- * @return BinaryExpression
88
- */
89
- List.prototype.hasTasks = function() {
90
- return this.tasks.length > 0;
91
- };
92
-
93
- /**
94
- * Description
95
- * @method toConfig
96
- * @return ObjectExpression
97
- */
98
- List.prototype.toConfig = function() {
99
- const list = { ...this }
100
- delete list.tasks
101
- if (list.filter == null) delete list.filter
102
- return list
103
- };
104
19
 
105
- module.exports = List;
20
+ static isList(list) {
21
+ return list instanceof List;
22
+ };
23
+
24
+ isHidden() {
25
+ return this.hidden;
26
+ };
27
+
28
+ getName() {
29
+ return this.name;
30
+ };
31
+
32
+ getTasks() {
33
+ return this.tasks;
34
+ };
35
+
36
+ addTask(task) {
37
+ if (!this.tasks.find(_task => _task.equals(task))) {
38
+ this.tasks.push(task);
39
+ }
40
+ };
41
+
42
+ setTasks(tasks) {
43
+ this.tasks = tasks;
44
+ };
45
+
46
+ hasTasks() {
47
+ return this.tasks.length > 0;
48
+ };
49
+
50
+ toConfig() {
51
+ const list = { ...this }
52
+ delete list.tasks
53
+ if (list.filter == null) delete list.filter
54
+ return list
55
+ };
56
+ }
@@ -1,9 +1,9 @@
1
- const _cloneDeep = require('lodash.clonedeep')
2
- const _path = require('path')
3
- const uniqid = require('uniqid')
4
- const defaultSettingsObject = require('./default-settings')
1
+ import _cloneDeep from 'lodash.clonedeep'
2
+ import _path from 'path'
3
+ import uniqid from 'uniqid'
4
+ import { defaultSettings as _defaultSettings } from './default-settings.js'
5
5
 
6
- module.exports = function (repo, defaultSettings = defaultSettingsObject) {
6
+ export function buildMigrateConfig (repo, defaultSettings = _defaultSettings) {
7
7
  const path = repo.path
8
8
  return function (config = repo.config) {
9
9
  const settings = config.settings
@@ -0,0 +1,2 @@
1
+ export * from './repo-fs-store.js';
2
+ export * from './repo-watched-fs-store.js';