skills-atlas-cli 0.6.0 → 0.6.1
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/package.json +1 -1
- package/src/format.js +11 -1
package/package.json
CHANGED
package/src/format.js
CHANGED
|
@@ -93,10 +93,20 @@ function groupOf(r, skillName, vendors) {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
// Is this row backed by a private (registry) source? Private vendors are tagged
|
|
97
|
+
// `_private` by mergeCatalogs, so on a same-name clash the org's own version leads.
|
|
98
|
+
function isPrivateRow(r, vendors) {
|
|
99
|
+
return (r.sources || []).some(s => vendors[s.name] && vendors[s.name]._private);
|
|
100
|
+
}
|
|
101
|
+
|
|
96
102
|
// Structured info for a skill (also the machine-readable --json shape). Groups
|
|
97
|
-
// are ordered best-first
|
|
103
|
+
// are ordered best-first — private (registry) groups first, then by stars — so the
|
|
104
|
+
// most relevant one leads (consistent with vendorsFor's install resolution).
|
|
98
105
|
function buildInfo(skillName, { skillIndex, vendors }) {
|
|
99
106
|
const rows = rowsFor(skillIndex, skillName).slice().sort((a, b) => {
|
|
107
|
+
const pa = isPrivateRow(a, vendors) ? 1 : 0;
|
|
108
|
+
const pb = isPrivateRow(b, vendors) ? 1 : 0;
|
|
109
|
+
if (pa !== pb) return pb - pa; // private (registry) groups first
|
|
100
110
|
const A = rowRank(a), B = rowRank(b);
|
|
101
111
|
return B.max - A.max || B.sum - A.sum || B.n - A.n;
|
|
102
112
|
});
|