gcf-aif-ext 0.7.1 → 0.7.2
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/extension.json +1 -1
- package/lib/board.js +23 -3
- package/package.json +1 -1
package/extension.json
CHANGED
package/lib/board.js
CHANGED
|
@@ -132,8 +132,28 @@ const SCALARS = [
|
|
|
132
132
|
'effort',
|
|
133
133
|
];
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Ranked items first, lower rank sooner. The unranked follow in dependency order: what can run
|
|
137
|
+
* now first, each item after every open item it depends on; file order breaks a tie.
|
|
138
|
+
*/
|
|
139
|
+
function inRunOrder(items) {
|
|
140
|
+
const byId = new Map(items.map((i) => [i.id, i]));
|
|
141
|
+
const depth = new Map();
|
|
142
|
+
const depthOf = (i) => {
|
|
143
|
+
if (depth.has(i.id)) return depth.get(i.id);
|
|
144
|
+
depth.set(i.id, 0); // a depends cycle stops here
|
|
145
|
+
const open = i.depends.map((d) => byId.get(d)).filter(Boolean);
|
|
146
|
+
depth.set(i.id, open.length ? 1 + Math.max(...open.map(depthOf)) : 0);
|
|
147
|
+
|
|
148
|
+
return depth.get(i.id);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Two unranked items give NaN (Infinity - Infinity), which falls through to the depth.
|
|
152
|
+
return items.sort(
|
|
153
|
+
(a, b) => (a.priority ?? Infinity) - (b.priority ?? Infinity) || depthOf(a) - depthOf(b),
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
137
157
|
const LISTS = ['children', 'system', 'depends'];
|
|
138
158
|
|
|
139
159
|
/** One item of the board. */
|
|
@@ -174,7 +194,7 @@ export async function board(projectDir) {
|
|
|
174
194
|
const verified = verifiedOf(projectDir);
|
|
175
195
|
const items = [];
|
|
176
196
|
for (const c of ledger.items) items.push(await itemOf(projectDir, c, verified));
|
|
177
|
-
items
|
|
197
|
+
inRunOrder(items);
|
|
178
198
|
|
|
179
199
|
const config = await readConfig(root);
|
|
180
200
|
const live = await readLive(root);
|