imdone-core 1.54.3 → 1.54.5

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/README.md CHANGED
@@ -199,7 +199,8 @@ License
199
199
 
200
200
  <!-- # #NOTE Notes
201
201
 
202
- **Package Version {{version}}**
202
+ **Development Package Version {{version}}**
203
+ **Published Version**
203
204
 
204
205
  [Focus]({{getFilterURL('list = DOING or tags = focus')}})
205
206
  [Plan]({{getFilterURL(' ')}})
@@ -6,6 +6,11 @@ const extractComments = require('multilang-extract-comments')
6
6
  const eol = require('eol')
7
7
  const { Readable } = require('stream')
8
8
 
9
+ // TODO Move to readstream parsing for code to improve performance
10
+ // <!--
11
+ // #important
12
+ // order:-205
13
+ // -->
9
14
  module.exports = class ReadStreamCodeParser extends ReadStreamTaskParser {
10
15
  constructor(readStream, filePath, lang, lists) {
11
16
  super(readStream)
@@ -228,12 +228,6 @@ function mixin(repo, fs = require('fs')) {
228
228
  if (loadedConfig && loadedConfig.code)
229
229
  include_lists = _union(include_lists, loadedConfig.code.include_lists)
230
230
 
231
- if (loadedConfig && loadedConfig.sync)
232
- loadedConfig.sync = {
233
- ...loadedConfig.sync,
234
- useImdoneioForPriority: false,
235
- }
236
-
237
231
  const newConfig = new Config(
238
232
  _assign({}, baseConfig, repo.config, loadedConfig, { path: repo.path })
239
233
  )
@@ -95,7 +95,9 @@ module.exports = class DefaultBoardPropertiesPlugin extends Plugin {
95
95
  };
96
96
 
97
97
  const templatesFromTemplateDir = await readMarkdownFiles(templateDir);
98
- const templatesFromGithubDir = await readMarkdownFiles(githubDir, 'github_');
98
+ const templatesFromGithubDir = await stat(githubDir)
99
+ ? await readMarkdownFiles(githubDir, 'github_')
100
+ : {};
99
101
 
100
102
  return { simple: simpleTemplate, ...templatesFromTemplateDir, ...templatesFromGithubDir };
101
103
  }
package/lib/project.js CHANGED
@@ -20,7 +20,7 @@ const { renderMarkdown, extractWikilinkTopics } = require('./adapters/markdown')
20
20
  const { getFunctionSignature } = require('./adapters/parsers/function-parser')
21
21
  const { format } = require('./adapters/parsers/content-transformer')
22
22
 
23
- function calculateTotals(lists) {
23
+ function calculateTotals(lists = []) {
24
24
  const totals = {}
25
25
  lists.forEach((list) => {
26
26
  try {
@@ -56,7 +56,7 @@ module.exports = class WorkerProject extends Project {
56
56
  this.dataKeys = []
57
57
  }
58
58
 
59
- init(cb) {
59
+ async init(cb) {
60
60
  const promise = new Promise(async (resolve, reject) => {
61
61
  this.repo.project = this
62
62
 
@@ -381,7 +381,7 @@ module.exports = class WorkerProject extends Project {
381
381
  }
382
382
 
383
383
  get defaultFilter() {
384
- return this.config.defaultFilter
384
+ return this.config && this.config.defaultFilter
385
385
  }
386
386
 
387
387
  set defaultFilter(filter) {
package/lib/repository.js CHANGED
@@ -275,7 +275,8 @@ Repository.prototype.getConfig = function () {
275
275
  * @return MemberExpression
276
276
  */
277
277
  Repository.prototype.getLists = function () {
278
- return this.getConfig().lists.map(obj => ({...obj}));
278
+ const config = this.getConfig()
279
+ return config ? config.lists.map(obj => ({...obj})) : []
279
280
  }
280
281
 
281
282
  Repository.prototype.getVisibleLists = function () {
@@ -832,51 +833,49 @@ Repository.prototype.moveList = function (name, pos, cb) {
832
833
  } else cb()
833
834
  }
834
835
 
835
- Repository.prototype.toggleListIgnore = function (name, cb) {
836
- var self = this
837
- cb = tools.cb(cb)
838
- var list = this.getList(name)
839
- // Only modify the lists if the list name exists
840
- var fn = function (err) {
841
- if (!err) self.emit('list.modified', name)
842
- cb(err)
843
- }
844
-
845
- if (list) {
836
+ Repository.prototype.toggleListIgnore = async function (name) {
837
+ return new Promise(async (resolve, reject) => {
838
+ var self = this
839
+ var list = this.getList(name)
840
+ if (!list) return reject(new Error('List not found'))
846
841
  list.ignore = !list.ignore
847
- this.saveConfig(fn)
848
- } else cb()
842
+ await this.updateList(list.id, list)
843
+ this.saveConfig((err) => {
844
+ if (err) reject(err)
845
+ self.emit('list.modified', name)
846
+ resolve()
847
+ })
848
+ });
849
849
  }
850
850
 
851
- Repository.prototype.toggleList = function (name, cb) {
852
- var self = this
853
- cb = tools.cb(cb)
854
- var list = this.getList(name)
855
- // Only modify the lists if the list name exists
856
- var fn = function (err) {
857
- if (!err) self.emit('list.modified', name)
858
- cb(err)
859
- }
860
-
861
- if (list) {
851
+ Repository.prototype.toggleList = async function (name) {
852
+ return new Promise(async (resolve, reject) => {
853
+ var self = this
854
+ var list = this.getList(name)
855
+ if (!list) return reject(new Error('List not found'))
862
856
  list.hidden = !list.hidden
863
- this.saveConfig(fn)
864
- } else cb()
857
+ await this.updateList(list.id, list)
858
+ this.saveConfig((err) => {
859
+ if (err) reject(err)
860
+ self.emit('list.modified', name)
861
+ resolve()
862
+ })
863
+ });
865
864
  }
866
865
 
867
- Repository.prototype.updateList = function(id, {name, filter}) {
866
+ Repository.prototype.updateList = function(id, {name, hidden, ignore, filter}) {
868
867
  return new Promise((resolve, reject) => {
869
- if (!filter && this.listExists(name)) return resolve()
870
-
871
868
  const lists = this.getLists()
872
869
  const list = this.getListById(id, lists)
873
870
  const oldName = list.name
874
- const oldFilter = list.filter
871
+ const hasFilter = list.filter
875
872
  list.name = name
876
- if (oldFilter) list.filter = filter
873
+ list.hidden = hidden
874
+ list.ignore = ignore
875
+ if (hasFilter !== undefined) list.filter = filter
877
876
  this.setLists(lists)
878
877
 
879
- if (oldName === name || oldFilter) {
878
+ if (oldName === name || hasFilter) {
880
879
  this.saveConfig(err => {
881
880
  if (err) return reject(err)
882
881
  resolve()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "1.54.3",
3
+ "version": "1.54.5",
4
4
  "description": "imdone-core",
5
5
  "main": "index.js",
6
6
  "bin": {