Skip to content

Commit 04f1e5f

Browse files
feat: sort tech stack output by category priority
1 parent f679b97 commit 04f1e5f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/scan.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,43 @@ const SKIPPED_TECHS = [
1010
'react-dom',
1111
];
1212

13+
const CATEGORY_PRIORITY = [
14+
"language",
15+
"framework",
16+
"mobile",
17+
"frontend",
18+
"backend",
19+
"runtime",
20+
"database",
21+
"orm",
22+
"auth",
23+
"api",
24+
"state",
25+
"css",
26+
"cloud",
27+
"hosting",
28+
"devops",
29+
"container",
30+
"ci",
31+
"testing",
32+
"build",
33+
"lint",
34+
"format",
35+
"automation",
36+
"package",
37+
"ai",
38+
"network",
39+
"utility",
40+
"cms",
41+
"ssg",
42+
"payment"
43+
];
44+
45+
const getCategoryPriority = (cat: string) => {
46+
const idx = CATEGORY_PRIORITY.indexOf(cat ? cat.toLowerCase() : "");
47+
return idx === -1 ? 999 : idx;
48+
};
49+
1350
// Helper to convert "example project" -> "exampleProject"
1451
function toCamelCase(str: string): string {
1552
return str
@@ -121,6 +158,14 @@ async function scan(options: SyncOptions = {}) {
121158
seenLogos.add(t.logo);
122159
return true;
123160
});
161+
162+
// 4. Sort by Category Priority
163+
uniqueTechs.sort((a, b) => {
164+
const pA = getCategoryPriority(a.type);
165+
const pB = getCategoryPriority(b.type);
166+
if (pA !== pB) return pA - pB;
167+
return a.name.localeCompare(b.name);
168+
});
124169

125170
// Resolve Assets (Copy & Fallback)
126171
const assetsDir = path.join(process.cwd(), 'public', 'assets', 'logos');

0 commit comments

Comments
 (0)