imdone-core 2.5.1 → 2.5.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.5.3
2
+
3
+ - Reorder configured lists atomically with `repository.moveList`, preserving every list field and unrelated configuration, rolling back failed saves, and emitting `list.modified` only after persistence succeeds.
4
+
1
5
  ## 2.3.5
2
6
 
3
7
  - Incorporate newly added watched files into repository state before emitting `file.update`, so live board consumers can render the new task without a reload or restart.
package/lib/repository.js CHANGED
@@ -1129,13 +1129,26 @@ export class Repository extends Emitter {
1129
1129
  // order:-190
1130
1130
  // -->
1131
1131
  async moveList (name, pos) {
1132
- var list = this.getList(name)
1133
- if (list) {
1134
- _remove(this.getLists(), { name: name })
1135
- this.getLists().splice(pos, 0, list)
1132
+ const lists = this.getLists()
1133
+ const currentPosition = lists.findIndex((list) => list.name === name)
1134
+ if (currentPosition < 0) throw new Error(`List not found: ${name}`)
1135
+ if (!Number.isInteger(pos)) throw new TypeError('List position must be an integer')
1136
+ if (pos < 0 || pos >= lists.length) throw new RangeError(`List position out of range: ${pos}`)
1137
+ if (currentPosition === pos) return
1138
+
1139
+ const previousLists = lists.map((list) => ({ ...list }))
1140
+ const [list] = lists.splice(currentPosition, 1)
1141
+ lists.splice(pos, 0, list)
1142
+ this.config.lists = lists
1143
+
1144
+ try {
1136
1145
  await this.saveConfig()
1137
- this.emit('list.modified', name)
1146
+ } catch (error) {
1147
+ this.config.lists = previousLists
1148
+ throw error
1138
1149
  }
1150
+
1151
+ this.emit('list.modified', name)
1139
1152
  }
1140
1153
 
1141
1154
  // READY Refactor toggleListIgnore to use async/await
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "description": "imdone-core",
5
5
  "repository": {
6
6
  "type": "git",
@@ -93,14 +93,13 @@
93
93
  "remove-markdown": "^0.3.0",
94
94
  "sanitize-filename": "^1.6.3",
95
95
  "sift": "^17.1.3",
96
- "simple-git": "^3.19.1",
97
96
  "uniqid": "^5.4.0",
98
97
  "xregexp": "^5.1.2"
99
98
  },
100
99
  "devDependencies": {
101
100
  "@types/node": "^22.13.13",
102
- "@vitest/coverage-istanbul": "^4.1.9",
103
- "@vitest/coverage-v8": "^4.1.9",
101
+ "@vitest/coverage-istanbul": "^4.1.11",
102
+ "@vitest/coverage-v8": "^4.1.11",
104
103
  "chai": "^5.2.0",
105
104
  "colors": "^1.4.0",
106
105
  "dependency-cruiser": "^16.10.0",
@@ -112,7 +111,7 @@
112
111
  "json-stringify-safe": "~5.0.0",
113
112
  "prettier": "^2.5.1",
114
113
  "typescript": "^5.8.2",
115
- "vitest": "^4.1.9"
114
+ "vitest": "^4.1.11"
116
115
  },
117
116
  "allowScripts": {
118
117
  "core-js-pure@3.42.0": true,