imdone-core 1.54.6 → 1.54.8
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/cli.js +7 -1
- package/lib/adapters/storage/config.js +4 -5
- package/lib/mixins/repo-fs-store.js +1 -1
- package/lib/plugins/default-board-properties-plugin.js +1 -1
- package/lib/plugins/extension-plugin.js +2 -2
- package/lib/plugins/plugin-manager.js +7 -3
- package/lib/project-factory.js +4 -14
- package/lib/project.js +2 -2
- package/lib/repository.js +1 -0
- package/lib/task.js +11 -9
- package/package.json +3 -4
package/cli.js
CHANGED
|
@@ -5,9 +5,11 @@ const ora = require('ora')
|
|
|
5
5
|
const chalk = require('chalk')
|
|
6
6
|
const package = require('./package.json')
|
|
7
7
|
const { createFileSystemProject } = require('./lib/project-factory.js')
|
|
8
|
+
const { load } = require('./lib/adapters/storage/config.js')
|
|
8
9
|
// const { log } = hideLogs()
|
|
9
10
|
const spinner = ora('Loading unicorns')
|
|
10
11
|
|
|
12
|
+
|
|
11
13
|
setTimeout(() => {
|
|
12
14
|
spinner.color = 'yellow';
|
|
13
15
|
spinner.text = 'Loading rainbows';
|
|
@@ -23,13 +25,17 @@ const mainCmd = program
|
|
|
23
25
|
mainCmd
|
|
24
26
|
.command('action <pluginName> <actionTitle>')
|
|
25
27
|
.option('-t, --task <task>', 'Task filePath:line')
|
|
28
|
+
.option('-w, --working-dir <workingDir>', 'Working directory')
|
|
29
|
+
.option('-c, --config <config>', 'Config file path')
|
|
26
30
|
.description('Run a board action')
|
|
27
31
|
.action(async function (plugin, title, options) {
|
|
28
32
|
spinner.start()
|
|
29
33
|
const action = {plugin, title}
|
|
30
34
|
const [filePath, line] = options.task ? options.task.split(':') : []
|
|
31
35
|
try {
|
|
32
|
-
const
|
|
36
|
+
const path = options.workingDir || process.env.PWD
|
|
37
|
+
const config = options.config && await load(options.config)
|
|
38
|
+
const project = createFileSystemProject({path, config})
|
|
33
39
|
await project.init()
|
|
34
40
|
await project.toImdoneJSON()
|
|
35
41
|
chalk.bgGreen('Project loaded')
|
|
@@ -9,12 +9,11 @@ module.exports = {
|
|
|
9
9
|
load,
|
|
10
10
|
save,
|
|
11
11
|
loadForFilePath,
|
|
12
|
-
findImdonePath
|
|
12
|
+
findImdonePath
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async function load(projectPath) {
|
|
16
|
-
const
|
|
17
|
-
const configLike = await getYamlConfig(configPath)
|
|
15
|
+
async function load(projectPath, configPath = _path.join(projectPath, CONFIG_FILE_YML)) {
|
|
16
|
+
const configLike = await loadYamlConfig(configPath)
|
|
18
17
|
return configLike && new Config(configLike)
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -28,7 +27,7 @@ async function loadForFilePath(filePath) {
|
|
|
28
27
|
return load(projectPath)
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
async function
|
|
30
|
+
async function loadYamlConfig(filePath) {
|
|
32
31
|
if (!(await exists(filePath))) return
|
|
33
32
|
const configData = await readFile(filePath, 'utf-8')
|
|
34
33
|
let configLike = {}
|
|
@@ -252,7 +252,7 @@ function mixin(repo, fs = require('fs')) {
|
|
|
252
252
|
cb = tools.cb(cb)
|
|
253
253
|
repo.loadIgnore()
|
|
254
254
|
// new
|
|
255
|
-
|
|
255
|
+
const configData = (!repo.config || repo.config.dirty) ? this.getYamlConfig() : repo.config || {}
|
|
256
256
|
repo.updateConfig(configData, cb)
|
|
257
257
|
}
|
|
258
258
|
|
|
@@ -23,7 +23,7 @@ module.exports = class DefaultBoardPropertiesPlugin extends Plugin {
|
|
|
23
23
|
this.templates = await this.getTemplates()
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
getBoardProperties() {
|
|
26
|
+
async getBoardProperties() {
|
|
27
27
|
const templates = flattenObject(this.templates);
|
|
28
28
|
const clearFilterURL = this.getFilterURL('');
|
|
29
29
|
const getFilterURL = (filter) => this.getFilterURL(filter);
|
|
@@ -38,8 +38,8 @@ module.exports = class ExtensionPlugin extends Plugin {
|
|
|
38
38
|
return this.cardPropertiesFunction(task)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
getBoardProperties() {
|
|
42
|
-
return this.boardPropertiesFunction()
|
|
41
|
+
async getBoardProperties() {
|
|
42
|
+
return await this.boardPropertiesFunction()
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
getCardActions(task) {
|
|
@@ -321,11 +321,15 @@ module.exports = class PluginManager extends Emitter {
|
|
|
321
321
|
return cardProps
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
getBoardProperties
|
|
324
|
+
// READY Make getBoardProperties async
|
|
325
|
+
// <!--
|
|
326
|
+
// order:-10
|
|
327
|
+
// -->
|
|
328
|
+
async getBoardProperties() {
|
|
325
329
|
let boardProps = {}
|
|
326
|
-
this.
|
|
330
|
+
await this.eachPluginAsync(async ({ pluginInstance }) => {
|
|
327
331
|
try {
|
|
328
|
-
const pluginProps = pluginInstance.getBoardProperties ? pluginInstance.getBoardProperties() : {}
|
|
332
|
+
const pluginProps = pluginInstance.getBoardProperties ? await pluginInstance.getBoardProperties() : {}
|
|
329
333
|
boardProps = { ...boardProps, ...pluginProps }
|
|
330
334
|
} catch (e) {
|
|
331
335
|
this.pluginError('getBoardProperties', pluginInstance, e)
|
package/lib/project-factory.js
CHANGED
|
@@ -5,7 +5,7 @@ const ProjectContext = require('./ProjectContext')
|
|
|
5
5
|
const Project = require('./project')
|
|
6
6
|
const context = require('./context/ApplicationContext')
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function createFileSystemProject({path, config, repo = fsStore(new Repository(path, config))}) {
|
|
9
9
|
context().repo = repo
|
|
10
10
|
context().projectContext = new ProjectContext(repo)
|
|
11
11
|
context().project = new Project(repo)
|
|
@@ -13,19 +13,9 @@ function createWatchedFSProject({path, config, repo = watchedFsStore(new Reposit
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
module.exports = {
|
|
16
|
-
createWatchedFileSystemProject: function(path) {
|
|
17
|
-
|
|
18
|
-
const repo = watchedFsStore(new Repository(path))
|
|
19
|
-
context().repo = repo
|
|
20
|
-
context().projectContext = new ProjectContext(repo)
|
|
21
|
-
context().project = new Project(repo)
|
|
22
|
-
return context().project
|
|
16
|
+
createWatchedFileSystemProject: function({path, config, repo = watchedFsStore(new Repository(path, config))}) {
|
|
17
|
+
return createFileSystemProject({path, config, repo})
|
|
23
18
|
},
|
|
24
19
|
|
|
25
|
-
createFileSystemProject
|
|
26
|
-
context().repo = repo
|
|
27
|
-
context().projectContext = new ProjectContext(repo)
|
|
28
|
-
context().project = new Project(repo)
|
|
29
|
-
return context().project
|
|
30
|
-
}
|
|
20
|
+
createFileSystemProject
|
|
31
21
|
}
|
package/lib/project.js
CHANGED
|
@@ -65,7 +65,7 @@ module.exports = class WorkerProject extends Project {
|
|
|
65
65
|
this.pluginManager.on('plugin-uninstalled', () => this.emitUpdate())
|
|
66
66
|
this.pluginManager.on('plugins-reloaded', () => this.emitUpdate())
|
|
67
67
|
await this.pluginManager.loadPlugins()
|
|
68
|
-
this.data = this.pluginManager.getBoardProperties()
|
|
68
|
+
this.data = await this.pluginManager.getBoardProperties()
|
|
69
69
|
this.dataKeys = this.getDataKeys(this.data)
|
|
70
70
|
|
|
71
71
|
console.log('data', this.data)
|
|
@@ -154,7 +154,7 @@ module.exports = class WorkerProject extends Project {
|
|
|
154
154
|
console.timeEnd('plugin onBeforeBoardUpdate time')
|
|
155
155
|
|
|
156
156
|
console.time('getBoardProperties time')
|
|
157
|
-
const data = this.data = this.pluginManager.getBoardProperties()
|
|
157
|
+
const data = this.data = await this.pluginManager.getBoardProperties()
|
|
158
158
|
console.timeEnd('getBoardProperties time')
|
|
159
159
|
|
|
160
160
|
console.time('getDataKeys time')
|
package/lib/repository.js
CHANGED
package/lib/task.js
CHANGED
|
@@ -12,7 +12,6 @@ var _clone = require('lodash.clone'),
|
|
|
12
12
|
lineEnd = String(eol.auto),
|
|
13
13
|
fastSort = require('fast-sort/dist/sort.js'),
|
|
14
14
|
{ escapeRegExp } = require('./tools'),
|
|
15
|
-
cheerio = require('cheerio'),
|
|
16
15
|
{ extractWikilinkTopics } = require('./adapters/markdown');
|
|
17
16
|
|
|
18
17
|
const {
|
|
@@ -747,14 +746,17 @@ Task.prototype.getText = function (opts, text) {
|
|
|
747
746
|
}
|
|
748
747
|
|
|
749
748
|
Task.prototype.getChecksFromHtml = function (html) {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
749
|
+
const result = [];
|
|
750
|
+
const checkboxRegex = /<input[^>]*type=['"]checkbox['"][^>]*>/gi;
|
|
751
|
+
const checkedRegex = /checked(?:=['"]?checked['"]?)?/i;
|
|
752
|
+
|
|
753
|
+
let match;
|
|
754
|
+
while ((match = checkboxRegex.exec(html)) !== null) {
|
|
755
|
+
result.push(checkedRegex.test(match[0]));
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
return result;
|
|
759
|
+
};
|
|
758
760
|
|
|
759
761
|
/**
|
|
760
762
|
* Description
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imdone-core",
|
|
3
|
-
"version": "1.54.
|
|
3
|
+
"version": "1.54.8",
|
|
4
4
|
"description": "imdone-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"async": "~1.5.0",
|
|
49
49
|
"chalk": "^4.1.2",
|
|
50
50
|
"checksum": "^0.1.1",
|
|
51
|
-
"cheerio": "^1.0.0-rc.10",
|
|
52
51
|
"chrono-node": "^2.6.4",
|
|
53
52
|
"command-exists": "^1.2.9",
|
|
54
53
|
"commander": "^11.1.0",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
"find-up": "^5.0.0",
|
|
61
60
|
"gray-matter": "^4.0.2",
|
|
62
61
|
"ignore": "^5.2.0",
|
|
63
|
-
"imdone-api": "^1.
|
|
62
|
+
"imdone-api": "^1.54.0",
|
|
64
63
|
"isbinaryfile": "^3.0.2",
|
|
65
64
|
"js-yaml": "^3.14.1",
|
|
66
65
|
"json-fns": "^1.0.0",
|
|
@@ -104,7 +103,7 @@
|
|
|
104
103
|
"readdirp": "^3.6.0",
|
|
105
104
|
"remove-markdown": "^0.3.0",
|
|
106
105
|
"rimraf": "^3.0.2",
|
|
107
|
-
"sane": "^
|
|
106
|
+
"sane": "^5.0.1",
|
|
108
107
|
"sanitize-filename": "^1.6.3",
|
|
109
108
|
"sift": "^17.1.3",
|
|
110
109
|
"simple-git": "^3.19.1",
|