imdone-core 1.54.5 → 1.54.7

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 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 project = createFileSystemProject({path: process.env.PWD})
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,6 +9,7 @@ const { Readable } = require('stream')
9
9
  // TODO Move to readstream parsing for code to improve performance
10
10
  // <!--
11
11
  // #important
12
+ // #imdone-1.55.0
12
13
  // order:-205
13
14
  // -->
14
15
  module.exports = class ReadStreamCodeParser extends ReadStreamTaskParser {
@@ -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 configPath = _path.join(projectPath, CONFIG_FILE_YML)
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 getYamlConfig(filePath) {
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 = {}
package/lib/languages.js CHANGED
@@ -36,6 +36,7 @@ module.exports = {
36
36
  ".php": {"name": "php", "symbol": "//", "block": htmlBlock},
37
37
  ".idr": {"name": "idris", "symbol": "--"},
38
38
  ".hs": {"name": "haskell", "symbol": "--"},
39
+ ".lhs": {"name": "haskell", "symbol": "--"},
39
40
  ".elm": {"name": "elm", "symbol": "--"},
40
41
  ".erl": {"name": "erlang", "symbol": "%"},
41
42
  ".hrl": {"name": "erlang", "symbol": "%"},
@@ -252,7 +252,7 @@ function mixin(repo, fs = require('fs')) {
252
252
  cb = tools.cb(cb)
253
253
  repo.loadIgnore()
254
254
  // new
255
- let configData = this.getYamlConfig() || {}
255
+ const configData = (!repo.config || repo.config.dirty) ? this.getYamlConfig() : repo.config || {}
256
256
  repo.updateConfig(configData, cb)
257
257
  }
258
258
 
@@ -64,10 +64,7 @@ module.exports = class DefaultBoardPropertiesPlugin extends Plugin {
64
64
  return encodeURI(`imdone://${this.project.path}?filter=${filter}`)
65
65
  }
66
66
 
67
- // READY Also include templates (md files) in .github and it's subdirs
68
- // <!--
69
- // order:0
70
- // -->
67
+
71
68
  async getTemplates() {
72
69
  const { preparePathForWriting, readdir, readFile, stat } = this.project.fileGateway;
73
70
  const templateDir = path.join(this.project.configDir, 'templates');
@@ -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 createWatchedFSProject({path, config, repo = watchedFsStore(new Repository(path, config))}) {
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
- if (typeof path === 'object' && path.confg) return createWatchedFSProject(path)
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: function ({path, config, repo = fsStore(new Repository(path, config))}) {
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/repository.js CHANGED
@@ -80,6 +80,7 @@ Repository.prototype.init = function (cb) {
80
80
 
81
81
  Repository.prototype.refresh = function (cb) {
82
82
  cb = tools.cb(cb)
83
+ this.config.dirty = true
83
84
  this.loadConfig((err, config) => {
84
85
  if (err) {
85
86
  return cb(err)
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
- let $ = cheerio.load(html)
751
- let checks = $('.task-description').find("input[type='checkbox']")
752
- const result = []
753
- checks.each(function () {
754
- result.push($(this).is(':checked'))
755
- })
756
- return result
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.5",
3
+ "version": "1.54.7",
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",
@@ -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": "^4.1.0",
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",