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.
- package/.dependency-cruiser.cjs +412 -0
- package/.github/workflows/ci.yml +2 -2
- package/.imdoneignore +2 -1
- package/README.md +2 -2
- package/_index.md +7 -0
- package/build.js +57 -0
- package/esm-migration.md +446 -0
- package/lib/FileProjectContext.js +13 -0
- package/lib/ProjectContext.js +19 -18
- package/lib/adapters/date-time.js +3 -8
- package/lib/adapters/environment.js +3 -0
- package/lib/adapters/file-gateway.js +133 -106
- package/lib/adapters/git-download.js +36 -16
- package/lib/adapters/index.js +9 -0
- package/lib/adapters/logger.js +136 -0
- package/lib/adapters/markdown.js +31 -19
- package/lib/adapters/parsers/DateLanguageParser.js +11 -9
- package/lib/adapters/parsers/content-transformer.js +35 -30
- package/lib/adapters/parsers/file/LocalFileParserFactory.js +8 -9
- package/lib/adapters/parsers/file/ReadStreamCodeParser.js +8 -8
- package/lib/adapters/parsers/file/ReadStreamMarkdownParser.js +4 -4
- package/lib/adapters/parsers/file/ReadStreamTaskParser.js +5 -3
- package/lib/adapters/parsers/file/index.js +4 -0
- package/lib/adapters/parsers/function-parser.js +1 -5
- package/lib/adapters/parsers/index.js +5 -0
- package/lib/adapters/parsers/task/CardContentParser.js +23 -32
- package/lib/adapters/parsers/task/CheckStyleTaskParser.js +2 -2
- package/lib/adapters/parsers/task/CodeStyleTaskParser.js +2 -2
- package/lib/adapters/parsers/task/HashStyleTaskParser.js +3 -3
- package/lib/adapters/parsers/task/MarkdownStyleTaskParser.js +2 -2
- package/lib/adapters/parsers/task/TaskParser.js +1 -1
- package/lib/adapters/parsers/task/index.js +6 -0
- package/lib/adapters/storage/config.js +15 -20
- package/lib/adapters/storage/index.js +2 -0
- package/lib/adapters/storage/tags.js +11 -12
- package/lib/adapters/yaml.js +8 -5
- package/lib/card.js +25 -26
- package/lib/checksum.js +22 -0
- package/lib/cli.js +114 -0
- package/lib/config.js +106 -71
- package/lib/constants.js +21 -50
- package/lib/context/ApplicationContext.js +7 -4
- package/lib/context/index.js +1 -0
- package/lib/default-settings.js +3 -3
- package/lib/domain/entities/View.js +4 -11
- package/lib/domain/entities/index.js +1 -0
- package/lib/domain/index.js +2 -0
- package/lib/domain/usecases/GetViewsUsecase.js +6 -12
- package/lib/domain/usecases/SaveViewUsecase.js +8 -14
- package/lib/domain/usecases/index.js +2 -0
- package/lib/file.js +1158 -1162
- package/lib/get-tasks-to-modify.js +117 -0
- package/lib/index.js +23 -0
- package/lib/languages.js +4 -5
- package/lib/list.js +46 -95
- package/lib/migrate-config.js +5 -5
- package/lib/mixins/index.js +2 -0
- package/lib/mixins/repo-fs-store.js +224 -289
- package/lib/mixins/repo-watched-fs-store.js +158 -147
- package/lib/plugins/archive-plugin.js +10 -8
- package/lib/plugins/default-board-actions-plugin.js +2 -2
- package/lib/plugins/default-board-properties-plugin.js +7 -7
- package/lib/plugins/default-plugins.js +7 -0
- package/lib/plugins/epic-plugin.js +6 -5
- package/lib/plugins/extension-plugin.js +24 -17
- package/lib/plugins/index.js +9 -0
- package/lib/plugins/persist-tags-plugin.js +4 -3
- package/lib/plugins/plugin-manager.js +89 -52
- package/lib/plugins/plugin-registry.js +12 -16
- package/lib/project-factory.js +21 -24
- package/lib/project.js +97 -144
- package/lib/repository.js +1323 -1555
- package/lib/task.js +562 -580
- package/lib/tools.js +39 -113
- package/lib/usecases/actions.js +32 -0
- package/lib/usecases/get-project-tags.js +3 -12
- package/lib/usecases/get-tasks-in-file.js +4 -7
- package/lib/usecases/index.js +4 -0
- package/package.json +44 -66
- package/scripts/delete-markdown-indexes.js +87 -0
- package/scripts/generate-index.js +35 -0
- package/{index-markdown.js → scripts/index-markdown.js} +7 -7
- package/tsconfig.json +15 -0
- package/types/FileProjectContext.d.ts +4 -0
- package/types/ProjectContext.d.ts +9 -0
- package/types/adapters/date-time.d.ts +2 -0
- package/types/adapters/environment.d.ts +1 -0
- package/types/adapters/file-gateway.d.ts +51 -0
- package/types/adapters/git-download.d.ts +1 -0
- package/types/adapters/index.d.ts +9 -0
- package/types/adapters/logger.d.ts +24 -0
- package/types/adapters/markdown.d.ts +13 -0
- package/types/adapters/parsers/DateLanguageParser.d.ts +1 -0
- package/types/adapters/parsers/content-transformer.d.ts +10 -0
- package/types/adapters/parsers/file/LocalFileParserFactory.d.ts +5 -0
- package/types/adapters/parsers/file/ReadStreamCodeParser.d.ts +13 -0
- package/types/adapters/parsers/file/ReadStreamMarkdownParser.d.ts +7 -0
- package/types/adapters/parsers/file/ReadStreamTaskParser.d.ts +19 -0
- package/types/adapters/parsers/file/index.d.ts +4 -0
- package/types/adapters/parsers/function-parser.d.ts +1 -0
- package/types/adapters/parsers/index.d.ts +5 -0
- package/types/adapters/parsers/task/CardContentParser.d.ts +45 -0
- package/types/adapters/parsers/task/CheckStyleTaskParser.d.ts +12 -0
- package/types/adapters/parsers/task/CodeStyleTaskParser.d.ts +14 -0
- package/types/adapters/parsers/task/HashStyleTaskParser.d.ts +13 -0
- package/types/adapters/parsers/task/MarkdownStyleTaskParser.d.ts +14 -0
- package/types/adapters/parsers/task/TaskParser.d.ts +7 -0
- package/types/adapters/parsers/task/index.d.ts +6 -0
- package/types/adapters/storage/config.d.ts +6 -0
- package/types/adapters/storage/index.d.ts +2 -0
- package/types/adapters/storage/tags.d.ts +3 -0
- package/types/adapters/yaml.d.ts +2 -0
- package/types/card.d.ts +166 -0
- package/types/checksum.d.ts +8 -0
- package/types/config.d.ts +61 -0
- package/types/constants.d.ts +46 -0
- package/types/context/ApplicationContext.d.ts +24 -0
- package/types/context/index.d.ts +1 -0
- package/types/default-settings.d.ts +2 -0
- package/types/domain/entities/FileProjectContext.d.ts +5 -0
- package/types/domain/entities/View.d.ts +17 -0
- package/types/domain/entities/index.d.ts +1 -0
- package/types/domain/index.d.ts +2 -0
- package/types/domain/usecases/GetViewsUsecase.d.ts +4 -0
- package/types/domain/usecases/SaveViewUsecase.d.ts +8 -0
- package/types/domain/usecases/index.d.ts +2 -0
- package/types/file.d.ts +344 -0
- package/types/get-tasks-to-modify.d.ts +3 -0
- package/types/index.d.ts +23 -0
- package/types/languages.d.ts +649 -0
- package/types/list.d.ts +30 -0
- package/types/migrate-config.d.ts +1 -0
- package/types/mixins/index.d.ts +2 -0
- package/types/mixins/repo-fs-store.d.ts +2 -0
- package/types/mixins/repo-watched-fs-store.d.ts +2 -0
- package/types/plugins/archive-plugin.d.ts +8 -0
- package/types/plugins/default-board-actions-plugin.d.ts +9 -0
- package/types/plugins/default-board-properties-plugin.d.ts +16 -0
- package/types/plugins/default-plugins.d.ts +6 -0
- package/types/plugins/epic-plugin.d.ts +19 -0
- package/types/plugins/extension-plugin.d.ts +15 -0
- package/types/plugins/index.d.ts +9 -0
- package/types/plugins/persist-tags-plugin.d.ts +4 -0
- package/types/plugins/plugin-manager.d.ts +68 -0
- package/types/plugins/plugin-registry.d.ts +1 -0
- package/types/project-factory.d.ts +14 -0
- package/types/project.d.ts +158 -0
- package/types/repository.d.ts +996 -0
- package/types/task.d.ts +202 -0
- package/types/tools.d.ts +29 -0
- package/types/usecases/actions.d.ts +7 -0
- package/types/usecases/get-imdone-url.d.ts +1 -0
- package/types/usecases/get-project-tags.d.ts +1 -0
- package/types/usecases/get-tasks-in-file.d.ts +4 -0
- package/types/usecases/index.d.ts +4 -0
- package/vitest.config.js +13 -0
- package/cli.js +0 -74
- package/index.js +0 -1
- package/lib/adapters/readers/FileSystemProjectReader.js +0 -45
- package/lib/context/StreamingApplicationContext.js +0 -31
- package/lib/controlers/SaveViewController.js +0 -10
- package/lib/domain/entities/FileProjectContext.js +0 -10
- package/lib/domain/usecases/OpenProjectUsecase.js +0 -13
package/types/task.d.ts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Description
|
|
3
|
+
* @method Task
|
|
4
|
+
* @param {} obj
|
|
5
|
+
* @return
|
|
6
|
+
*/
|
|
7
|
+
export class Task {
|
|
8
|
+
static addToLastCommentInContent(content: any, toAdd: any, newLine: any): string;
|
|
9
|
+
static DATE_META_KEYS: string[];
|
|
10
|
+
static hasCheckPrefix(content: any): boolean;
|
|
11
|
+
static padDescription(description?: any[], beforeText?: string): any[];
|
|
12
|
+
static trimDescription(rawTaskContentLines: any, beforeText: any): any;
|
|
13
|
+
static Types: {
|
|
14
|
+
CODE: string;
|
|
15
|
+
HASHTAG: string;
|
|
16
|
+
MARKDOWN: string;
|
|
17
|
+
};
|
|
18
|
+
static AnyLanguageGroup: string;
|
|
19
|
+
static EmojiGroup: string;
|
|
20
|
+
static getTagRegexp(prefix?: string): RegExp;
|
|
21
|
+
static getTags(text: any, prefix?: string): string[];
|
|
22
|
+
static getMarkdownLinkLabelPositions(text: any): {
|
|
23
|
+
start: number;
|
|
24
|
+
end: number;
|
|
25
|
+
}[];
|
|
26
|
+
static isResultInMarkdownLinkLabel(linkLabelPositions: any, index: any): any;
|
|
27
|
+
static ContextRegExp: RegExp;
|
|
28
|
+
static getContext(text: any): string[];
|
|
29
|
+
static MetaRegExp: RegExp;
|
|
30
|
+
static getMetaRegExp(config: any): RegExp;
|
|
31
|
+
static getMetaRegExpQuotes(config: any): RegExp;
|
|
32
|
+
static parseMetaData(config: any, content: any): {};
|
|
33
|
+
static getMetaData(config: any, task: any): {};
|
|
34
|
+
static execMetaRegex(re: any, content: any, codePositions: any, cb: any): void;
|
|
35
|
+
static eachMetaInContent(config: any, content: any, cb: any): void;
|
|
36
|
+
static hasWindowsEOL(content: any): boolean;
|
|
37
|
+
static getLinePos(content: any, lineNo: any): any;
|
|
38
|
+
static getLineNumber(content: any, pos: any): number;
|
|
39
|
+
static getMetaOrderRegex(config: any): RegExp;
|
|
40
|
+
/**
|
|
41
|
+
* Description
|
|
42
|
+
* @method isTask
|
|
43
|
+
* @param {} task
|
|
44
|
+
* @return BinaryExpression
|
|
45
|
+
*/
|
|
46
|
+
static isTask(task: any): task is Task;
|
|
47
|
+
static getMarkdownCodePositions(text: any): {
|
|
48
|
+
start: number;
|
|
49
|
+
end: number;
|
|
50
|
+
}[];
|
|
51
|
+
static isResultInMarkdownCode(positions: any, index: any): boolean;
|
|
52
|
+
static removeTags(text: any, prefix?: string): any;
|
|
53
|
+
static removeContext(text: any): any;
|
|
54
|
+
static removeMetaDataFromText(config: any, text: any): any;
|
|
55
|
+
static removeMetaData({ config, content, key, value }: {
|
|
56
|
+
config: any;
|
|
57
|
+
content: any;
|
|
58
|
+
key: any;
|
|
59
|
+
value: any;
|
|
60
|
+
}): any;
|
|
61
|
+
constructor(config: any, obj: any, dontParse: any);
|
|
62
|
+
frontMatter: any;
|
|
63
|
+
pos: any;
|
|
64
|
+
rawTask: any;
|
|
65
|
+
beforeText: any;
|
|
66
|
+
text: any;
|
|
67
|
+
list: any;
|
|
68
|
+
set order(val: any);
|
|
69
|
+
get order(): any;
|
|
70
|
+
hasColon: any;
|
|
71
|
+
line: any;
|
|
72
|
+
id: any;
|
|
73
|
+
repoId: any;
|
|
74
|
+
source: any;
|
|
75
|
+
type: any;
|
|
76
|
+
tags: any;
|
|
77
|
+
context: any;
|
|
78
|
+
meta: any;
|
|
79
|
+
metaIndex: any;
|
|
80
|
+
inBlockComment: any;
|
|
81
|
+
singleLineBlockComment: any;
|
|
82
|
+
description: any;
|
|
83
|
+
rawTaskContentLines: any;
|
|
84
|
+
taskStartOnLine: any;
|
|
85
|
+
commentStartOnLine: any;
|
|
86
|
+
descriptionStartsWith: any;
|
|
87
|
+
filteredListName: any;
|
|
88
|
+
isWrappedWithCardTag: any;
|
|
89
|
+
config: any;
|
|
90
|
+
allMeta: any;
|
|
91
|
+
allContext: any;
|
|
92
|
+
allTags: any;
|
|
93
|
+
progress: any;
|
|
94
|
+
content: any;
|
|
95
|
+
lastLine: any;
|
|
96
|
+
orderModified: any;
|
|
97
|
+
index: any;
|
|
98
|
+
innerOrder: any;
|
|
99
|
+
get descriptionString(): any;
|
|
100
|
+
updateLastLine(): void;
|
|
101
|
+
getLastLine(): any;
|
|
102
|
+
parse(): void;
|
|
103
|
+
paddingLength: number | undefined;
|
|
104
|
+
metaKeys: string[] | undefined;
|
|
105
|
+
topics: string[] | undefined;
|
|
106
|
+
issueNumberRegExp(): RegExp;
|
|
107
|
+
get listId(): any;
|
|
108
|
+
get path(): any;
|
|
109
|
+
get markdownBeforeText(): string;
|
|
110
|
+
getTextAndDescription(): any;
|
|
111
|
+
getRawTextAndDescription(): any;
|
|
112
|
+
getProgress(): {
|
|
113
|
+
completed: any;
|
|
114
|
+
total: any;
|
|
115
|
+
};
|
|
116
|
+
getContent(): any;
|
|
117
|
+
updateContent(): void;
|
|
118
|
+
updateFromContent(content: any): void;
|
|
119
|
+
toJSON(): this & {
|
|
120
|
+
allTags: any;
|
|
121
|
+
allContext: any;
|
|
122
|
+
allMeta: any;
|
|
123
|
+
config: undefined;
|
|
124
|
+
expand: boolean;
|
|
125
|
+
};
|
|
126
|
+
getTagPrefix(): any;
|
|
127
|
+
addToLastCommentInContent(content: any, toAdd: any, newLine: any): string;
|
|
128
|
+
getCheckedData(): {
|
|
129
|
+
pad: number;
|
|
130
|
+
checked: boolean;
|
|
131
|
+
} | null;
|
|
132
|
+
updateOrderMeta(config: any, descContent?: any): undefined;
|
|
133
|
+
replaceContent(regex: any, replacement: any): void;
|
|
134
|
+
replaceMetaSep(oldMetaSep: any, newMetaSep: any): void;
|
|
135
|
+
updateContext(): void;
|
|
136
|
+
parseTodoTxt(): void;
|
|
137
|
+
getTags(): any[];
|
|
138
|
+
getContext(): any[];
|
|
139
|
+
getDueMeta(): any;
|
|
140
|
+
getMetaData(): any;
|
|
141
|
+
getListTrackingMeta(lists: any): any[];
|
|
142
|
+
hasListChanged(lists: any): boolean;
|
|
143
|
+
hasMetaData(key: any, value: any): any;
|
|
144
|
+
/**
|
|
145
|
+
* Returns metadata as list with links
|
|
146
|
+
* @method getMetaDataWithLinks
|
|
147
|
+
* @param {} repository config
|
|
148
|
+
* @return Array
|
|
149
|
+
*/
|
|
150
|
+
getMetaDataWithLinks(config: any): any[];
|
|
151
|
+
getMetaLink(config: any, metaKey: any, metaValue: any): {
|
|
152
|
+
title: string;
|
|
153
|
+
url: string;
|
|
154
|
+
icon: any;
|
|
155
|
+
} | undefined;
|
|
156
|
+
toString(): string;
|
|
157
|
+
/**
|
|
158
|
+
* Description
|
|
159
|
+
* @method getRepoId
|
|
160
|
+
* @return MemberExpression
|
|
161
|
+
*/
|
|
162
|
+
getRepoId(): any;
|
|
163
|
+
/**
|
|
164
|
+
* Description
|
|
165
|
+
* @method getSource
|
|
166
|
+
* @return MemberExpression
|
|
167
|
+
*/
|
|
168
|
+
getSource(): any;
|
|
169
|
+
/**
|
|
170
|
+
* Description
|
|
171
|
+
* @method getId
|
|
172
|
+
* @return MemberExpression
|
|
173
|
+
*/
|
|
174
|
+
getId(): any;
|
|
175
|
+
/**
|
|
176
|
+
* Description
|
|
177
|
+
* @method getList
|
|
178
|
+
* @return MemberExpression
|
|
179
|
+
*/
|
|
180
|
+
getList(): any;
|
|
181
|
+
/**
|
|
182
|
+
* Description
|
|
183
|
+
* @method getText
|
|
184
|
+
* @return text
|
|
185
|
+
*/
|
|
186
|
+
getText(opts: any, text: any): any;
|
|
187
|
+
getChecksFromHtml(html: any): boolean[];
|
|
188
|
+
/**
|
|
189
|
+
* Description
|
|
190
|
+
* @method getLine
|
|
191
|
+
* @return MemberExpression
|
|
192
|
+
*/
|
|
193
|
+
getLine(): any;
|
|
194
|
+
getType(): any;
|
|
195
|
+
/**
|
|
196
|
+
* Description
|
|
197
|
+
* @method equals
|
|
198
|
+
* @param {} task
|
|
199
|
+
* @return LogicalExpression
|
|
200
|
+
*/
|
|
201
|
+
equals(task: any): boolean | undefined;
|
|
202
|
+
}
|
package/types/tools.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export namespace tools {
|
|
2
|
+
export function union(...arrays: any[]): any[];
|
|
3
|
+
export function escapeRegExp(str: any): any;
|
|
4
|
+
export function userHome(): string | undefined;
|
|
5
|
+
export { deepEqual };
|
|
6
|
+
/**
|
|
7
|
+
* Description
|
|
8
|
+
* @method user
|
|
9
|
+
* @return LogicalExpression
|
|
10
|
+
*/
|
|
11
|
+
export function user(): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Description
|
|
14
|
+
* @method cb
|
|
15
|
+
* @param {} cb
|
|
16
|
+
* @return ConditionalExpression
|
|
17
|
+
*/
|
|
18
|
+
export function cb(cb: any): any;
|
|
19
|
+
export function inMixinsNoop(cb: any): any;
|
|
20
|
+
export function sha(data: any): string;
|
|
21
|
+
export function format(template: any, col: any, ...args: any[]): any;
|
|
22
|
+
export function isBinaryFile(fs: any, file: any, callback: any): void;
|
|
23
|
+
export { isBinaryCheck };
|
|
24
|
+
export function sortTasks(tasks: any): any[];
|
|
25
|
+
export function hasBlankLines(content: any): boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function deepEqual(a: any, b: any): any;
|
|
28
|
+
declare function isBinaryCheck(bytes: any, size: any): boolean;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function executeBoardAction({ projectPath, configPath, task, action }: {
|
|
2
|
+
projectPath: any;
|
|
3
|
+
configPath: any;
|
|
4
|
+
task: any;
|
|
5
|
+
action: any;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
export function listAvailableActions(projectPath: any, configPath: any, plugin: any): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getTags(filePath: any): Promise<any>;
|
package/vitest.config.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
include: ['lib/**/*.spec.js'], // Only look for test files inside src/
|
|
6
|
+
coverage: {
|
|
7
|
+
provider: "v8", // or "istanbul" if using @vitest/coverage-istanbul
|
|
8
|
+
reporter: ["text"], // Ensure text output is included
|
|
9
|
+
clean: false,
|
|
10
|
+
reportOnFailure: true,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
package/cli.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const { program } = require('commander');
|
|
4
|
-
const ora = require('ora')
|
|
5
|
-
const chalk = require('chalk')
|
|
6
|
-
const package = require('./package.json')
|
|
7
|
-
const { createFileSystemProject } = require('./lib/project-factory.js')
|
|
8
|
-
const { load } = require('./lib/adapters/storage/config.js')
|
|
9
|
-
// const { log } = hideLogs()
|
|
10
|
-
const spinner = ora('Loading unicorns')
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
setTimeout(() => {
|
|
14
|
-
spinner.color = 'yellow';
|
|
15
|
-
spinner.text = 'Loading rainbows';
|
|
16
|
-
}, 1000);
|
|
17
|
-
|
|
18
|
-
function actionCancelled() {
|
|
19
|
-
log(chalk.bgRed('Action canceled'))
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const mainCmd = program
|
|
23
|
-
.version(package.version, '-v, --version', 'output the current version')
|
|
24
|
-
|
|
25
|
-
mainCmd
|
|
26
|
-
.command('action <pluginName> <actionTitle>')
|
|
27
|
-
.option('-t, --task <task>', 'Task filePath:line')
|
|
28
|
-
.option('-w, --working-dir <workingDir>', 'Working directory')
|
|
29
|
-
.option('-c, --config <config>', 'Config file path')
|
|
30
|
-
.description('Run a board action')
|
|
31
|
-
.action(async function (plugin, title, options) {
|
|
32
|
-
spinner.start()
|
|
33
|
-
const action = {plugin, title}
|
|
34
|
-
const [filePath, line] = options.task ? options.task.split(':') : []
|
|
35
|
-
try {
|
|
36
|
-
const path = options.workingDir || process.env.PWD
|
|
37
|
-
const config = options.config && await load(options.config)
|
|
38
|
-
const project = createFileSystemProject({path, config})
|
|
39
|
-
await project.init()
|
|
40
|
-
await project.toImdoneJSON()
|
|
41
|
-
chalk.bgGreen('Project loaded')
|
|
42
|
-
const file = filePath && project.getFile(filePath)
|
|
43
|
-
const task = file && line > -1 && file.getTaskAtLine(line)
|
|
44
|
-
await project.performBoardAction(action, task)
|
|
45
|
-
} catch (e) {
|
|
46
|
-
console.error(e)
|
|
47
|
-
actionCancelled()
|
|
48
|
-
} finally {
|
|
49
|
-
spinner.stop()
|
|
50
|
-
process.exit(0)
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
program.parse();
|
|
56
|
-
|
|
57
|
-
function hideLogs() {
|
|
58
|
-
const log = console.log
|
|
59
|
-
const info = console.info
|
|
60
|
-
const warn = console.warn
|
|
61
|
-
const logQueue = {warn: [], info: [], log: []}
|
|
62
|
-
if (!process.env.DEBUG) {
|
|
63
|
-
Object.keys(logQueue).forEach((key) => {
|
|
64
|
-
console[key] = function(...args) {
|
|
65
|
-
logQueue[key].push(args)
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
return {log, info, warn, logQueue}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function actionCancelled() {
|
|
73
|
-
log(chalk.bgRed('Action canceled'))
|
|
74
|
-
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./lib');
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const fs = require('fs/promises')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const LocalFileParserFactory = require('../parsers/file/LocalFileParserFactory')
|
|
4
|
-
|
|
5
|
-
module.exports = class FileSystemProjectReader {
|
|
6
|
-
async read (projectPath) {
|
|
7
|
-
// BACKLOG ## Load the config file
|
|
8
|
-
// #adapter
|
|
9
|
-
// [lib/adapters/readers/FileSystemProjectReader.js](lib/adapters/readers/FileSystemProjectReader.js)
|
|
10
|
-
// <!-- epic:"Release 2.0"
|
|
11
|
-
// order:-590
|
|
12
|
-
// -->
|
|
13
|
-
const files = await this.getFilesFromDirectory(projectPath)
|
|
14
|
-
|
|
15
|
-
// BACKLOG ## Parse project files
|
|
16
|
-
// - Loop over the files in the filesystem
|
|
17
|
-
// - Give each one a file parser and parse the file
|
|
18
|
-
// - `const parser = LocalFileParserFactory.getFileParser(filePath, config)`
|
|
19
|
-
// - Use worker_threads
|
|
20
|
-
// - After tasks are parsed trim the description appropriately and look for Check style tasks in what's left of the description
|
|
21
|
-
// #adapter
|
|
22
|
-
// [lib/adapters/readers/FileSystemProjectReader.js](lib/adapters/readers/FileSystemProjectReader.js)
|
|
23
|
-
// <!-- epic:"Release 2.0"
|
|
24
|
-
// order:-600
|
|
25
|
-
// -->
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async getFilesFromDirectory (directoryPath) {
|
|
30
|
-
const filesInDirectory = await fs.readdir(directoryPath)
|
|
31
|
-
const files = await Promise.all(
|
|
32
|
-
filesInDirectory.map(async (file) => {
|
|
33
|
-
const filePath = path.join(directoryPath, file)
|
|
34
|
-
const stats = await fs.stat(filePath)
|
|
35
|
-
|
|
36
|
-
if (stats.isDirectory()) {
|
|
37
|
-
return this.getFilesFromDirectory(filePath)
|
|
38
|
-
} else {
|
|
39
|
-
return filePath
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
)
|
|
43
|
-
return files.filter((file) => file.length)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -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
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const appContext = require('../../context/ApplicationContext')
|
|
2
|
-
|
|
3
|
-
module.exports = class OpenProjectUsecase {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.projectReader = appContext().projectReader
|
|
6
|
-
this.projectPresenter = appContext().projectPresenter
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
execute(location) {
|
|
10
|
-
const project = this.projectReader.read(location)
|
|
11
|
-
this.projectPresenter.present(project)
|
|
12
|
-
}
|
|
13
|
-
}
|