@grove-dev/astro 0.2.20 → 0.3.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/LICENSE +21 -0
- package/README.md +9 -75
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/display.d.ts +1 -26
- package/dist/lib/display.d.ts.map +1 -1
- package/dist/lib/display.js +1 -103
- package/dist/lib/display.js.map +1 -1
- package/dist/lib/format.d.ts +1 -28
- package/dist/lib/format.d.ts.map +1 -1
- package/dist/lib/format.js +1 -71
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/lenses.d.ts +1 -57
- package/dist/lib/lenses.d.ts.map +1 -1
- package/dist/lib/lenses.js +1 -198
- package/dist/lib/lenses.js.map +1 -1
- package/dist/lib/repo.d.ts +1 -19
- package/dist/lib/repo.d.ts.map +1 -1
- package/dist/lib/repo.js +1 -30
- package/dist/lib/repo.js.map +1 -1
- package/dist/lib/scores.d.ts +1 -36
- package/dist/lib/scores.d.ts.map +1 -1
- package/dist/lib/scores.js +1 -75
- package/dist/lib/scores.js.map +1 -1
- package/dist/lib/search.d.ts +1 -113
- package/dist/lib/search.d.ts.map +1 -1
- package/dist/lib/search.js +1 -379
- package/dist/lib/search.js.map +1 -1
- package/dist/lib/taxonomy-counts.d.ts +1 -10
- package/dist/lib/taxonomy-counts.d.ts.map +1 -1
- package/dist/lib/taxonomy-counts.js +1 -21
- package/dist/lib/taxonomy-counts.js.map +1 -1
- package/package.json +22 -10
- package/src/components/ContributorsGrid.astro +3 -3
- package/src/components/CurationGrid.astro +2 -2
- package/src/components/DirectoryIndexClient.astro +240 -0
- package/src/components/FilterGroupMenu.astro +8 -4
- package/src/components/FinalCta.astro +41 -0
- package/src/components/Hero.astro +15 -18
- package/src/components/Icon.astro +99 -27
- package/src/components/RefinePanel.astro +7 -7
- package/src/components/SmartLensTabs.astro +5 -4
- package/src/components/StackGrid.astro +1 -1
- package/src/components/SubmissionClient.astro +133 -0
- package/src/index.ts +11 -1
- package/src/layouts/BaseLayout.astro +19 -1
- package/src/layouts/Footer.astro +25 -56
- package/src/layouts/Header.astro +33 -15
- package/src/layouts/ThemeToggle.astro +7 -3
- package/src/lib/display.ts +1 -111
- package/src/lib/format.ts +1 -64
- package/src/lib/lenses.ts +1 -220
- package/src/lib/repo.ts +1 -32
- package/src/lib/scores.ts +1 -90
- package/src/lib/search.ts +1 -418
- package/src/lib/taxonomy-counts.ts +1 -26
- package/{templates/default/src/data/records.ts → src/server/directory.ts} +90 -8
- package/src/server/index.ts +2 -0
- package/src/server/models.ts +432 -0
- package/dist/theme.test.d.ts +0 -2
- package/dist/theme.test.d.ts.map +0 -1
- package/dist/theme.test.js +0 -55
- package/dist/theme.test.js.map +0 -1
- package/src/theme.test.ts +0 -67
- package/templates/default/.github/ISSUE_TEMPLATE/bug_report.md +0 -33
- package/templates/default/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/templates/default/.github/ISSUE_TEMPLATE/record_submission.md +0 -48
- package/templates/default/.github/pull_request_template.md +0 -27
- package/templates/default/.github/workflows/build.yml +0 -55
- package/templates/default/.github/workflows/cleanup-stale-records.yml +0 -48
- package/templates/default/.github/workflows/daily-refresh.yml +0 -53
- package/templates/default/.github/workflows/sync-contributors.yml +0 -53
- package/templates/default/.github/workflows/sync-github-metadata.yml +0 -58
- package/templates/default/.github/workflows/validate-data.yml +0 -35
- package/templates/default/astro.config.mjs +0 -25
- package/templates/default/content/pages/about.md +0 -66
- package/templates/default/content/pages/methodology.md +0 -103
- package/templates/default/data/records/.gitkeep +0 -0
- package/templates/default/data/records/coolify.yml +0 -46
- package/templates/default/data/records/gitea.yml +0 -46
- package/templates/default/data/records/hoppscotch.yml +0 -47
- package/templates/default/data/records/inventree.yml +0 -47
- package/templates/default/data/records/label-studio.yml +0 -46
- package/templates/default/data/records/logseq.yml +0 -48
- package/templates/default/data/records/private-gpt.yml +0 -47
- package/templates/default/data/records/wakapi.yml +0 -44
- package/templates/default/data/taxonomy/categories.yml +0 -47
- package/templates/default/data/taxonomy/distribution-channels.yml +0 -43
- package/templates/default/data/taxonomy/platforms.yml +0 -27
- package/templates/default/data/taxonomy/stacks.yml +0 -41
- package/templates/default/grove.config.ts +0 -36
- package/templates/default/package.json +0 -38
- package/templates/default/public/icons/platforms/android.svg +0 -1
- package/templates/default/public/icons/platforms/apple-dark.svg +0 -1
- package/templates/default/public/icons/platforms/apple-light.svg +0 -1
- package/templates/default/public/icons/platforms/chrome.svg +0 -1
- package/templates/default/public/icons/platforms/chromeos.svg +0 -5
- package/templates/default/public/icons/platforms/desktop.svg +0 -4
- package/templates/default/public/icons/platforms/embedded.svg +0 -5
- package/templates/default/public/icons/platforms/ios.svg +0 -1
- package/templates/default/public/icons/platforms/linux.svg +0 -1
- package/templates/default/public/icons/platforms/macos.svg +0 -1
- package/templates/default/public/icons/platforms/ubuntu.svg +0 -1
- package/templates/default/public/icons/platforms/web.svg +0 -5
- package/templates/default/public/icons/platforms/windows.svg +0 -6
- package/templates/default/public/icons/stacks/android.svg +0 -1
- package/templates/default/public/icons/stacks/apple-dark.svg +0 -1
- package/templates/default/public/icons/stacks/apple-light.svg +0 -1
- package/templates/default/public/icons/stacks/bun.svg +0 -1
- package/templates/default/public/icons/stacks/capacitor.svg +0 -14
- package/templates/default/public/icons/stacks/clojure.svg +0 -1
- package/templates/default/public/icons/stacks/clojurescript.svg +0 -1
- package/templates/default/public/icons/stacks/dart.svg +0 -1
- package/templates/default/public/icons/stacks/deno.svg +0 -1
- package/templates/default/public/icons/stacks/django.svg +0 -1
- package/templates/default/public/icons/stacks/docker.svg +0 -1
- package/templates/default/public/icons/stacks/firebase.svg +0 -1
- package/templates/default/public/icons/stacks/flutter.svg +0 -1
- package/templates/default/public/icons/stacks/go.svg +0 -1
- package/templates/default/public/icons/stacks/graphql.svg +0 -1
- package/templates/default/public/icons/stacks/ionic.svg +0 -4
- package/templates/default/public/icons/stacks/java.svg +0 -1
- package/templates/default/public/icons/stacks/javascript.svg +0 -1
- package/templates/default/public/icons/stacks/kotlin.svg +0 -1
- package/templates/default/public/icons/stacks/llm.svg +0 -1
- package/templates/default/public/icons/stacks/mongodb.svg +0 -1
- package/templates/default/public/icons/stacks/node.js.svg +0 -1
- package/templates/default/public/icons/stacks/nodejs.svg +0 -1
- package/templates/default/public/icons/stacks/python.svg +0 -1
- package/templates/default/public/icons/stacks/rag.svg +0 -7
- package/templates/default/public/icons/stacks/react-native.svg +0 -1
- package/templates/default/public/icons/stacks/react.svg +0 -1
- package/templates/default/public/icons/stacks/rust.svg +0 -1
- package/templates/default/public/icons/stacks/solidity.svg +0 -1
- package/templates/default/public/icons/stacks/sveltekit.svg +0 -1
- package/templates/default/public/icons/stacks/swift.svg +0 -1
- package/templates/default/public/icons/stacks/tensorflow.svg +0 -1
- package/templates/default/public/icons/stacks/typescript.svg +0 -1
- package/templates/default/public/icons/stacks/vue.svg +0 -1
- package/templates/default/public/llms-full.txt +0 -206
- package/templates/default/public/llms.txt +0 -112
- package/templates/default/public/og-image.svg +0 -48
- package/templates/default/public/robots.txt +0 -53
- package/templates/default/public/sitemap.xml +0 -63
- package/templates/default/scripts/build-llms.mjs +0 -123
- package/templates/default/scripts/build-records-json.mjs +0 -27
- package/templates/default/scripts/build-sitemap.mjs +0 -20
- package/templates/default/scripts/cleanup-stale-records.mjs +0 -20
- package/templates/default/scripts/enrich-github-metadata.mjs +0 -99
- package/templates/default/scripts/fetch-icons.mjs +0 -137
- package/templates/default/scripts/migrate-legacy-to-schema-v1.mjs +0 -86
- package/templates/default/scripts/parse-legacy-readme.mjs +0 -59
- package/templates/default/scripts/refresh-records-activity.mjs +0 -24
- package/templates/default/scripts/repair-license-format.mjs +0 -72
- package/templates/default/scripts/report-cleanup-candidates.mjs +0 -21
- package/templates/default/scripts/seed-from-github.mjs +0 -62
- package/templates/default/scripts/sync-contributors.mjs +0 -145
- package/templates/default/scripts/sync-github-metadata.mjs +0 -28
- package/templates/default/scripts/validate-records.mjs +0 -27
- package/templates/default/src/pages/404.astro +0 -64
- package/templates/default/src/pages/[slug]/[recordSlug].astro +0 -689
- package/templates/default/src/pages/[slug]/index.astro +0 -278
- package/templates/default/src/pages/about.astro +0 -182
- package/templates/default/src/pages/apps/[recordSlug].astro +0 -33
- package/templates/default/src/pages/contributors.astro +0 -175
- package/templates/default/src/pages/index.astro +0 -225
- package/templates/default/src/pages/sitemap.xml.ts +0 -89
- package/templates/default/src/pages/submit.astro +0 -281
- package/templates/default/src/styles/global.css +0 -33
- package/templates/default/wrangler.jsonc +0 -28
package/src/lib/format.ts
CHANGED
|
@@ -1,64 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Shared formatting helpers used across components.
|
|
3
|
-
*
|
|
4
|
-
* Keep these dependency-free so they can be imported by both server-
|
|
5
|
-
* rendered Astro components and any future client-side scripts.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Format a number compactly: 1234 → "1.2k", 12345 → "12k", 79 → "79".
|
|
10
|
-
* Used for hero/header star counts and other large-num displays.
|
|
11
|
-
*/
|
|
12
|
-
export function compact(n: number): string {
|
|
13
|
-
if (n >= 1000) {
|
|
14
|
-
const k = n / 1000;
|
|
15
|
-
return (k >= 10 ? Math.round(k).toString() : k.toFixed(1)) + "k";
|
|
16
|
-
}
|
|
17
|
-
return n.toString();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Format a star count compactly. Returns null when input is not a
|
|
22
|
-
* finite number, so callers can render "—" without an extra guard.
|
|
23
|
-
*/
|
|
24
|
-
export function formatStars(n: number | null | undefined): string | null {
|
|
25
|
-
if (typeof n !== "number" || !Number.isFinite(n)) return null;
|
|
26
|
-
return compact(n);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Format an ISO date as a human "Xd ago" / "Xmo ago" / "Xy ago" string.
|
|
31
|
-
* Returns "—" for missing or invalid input, and "today" for future
|
|
32
|
-
* dates (which can happen with bad upstream timestamps).
|
|
33
|
-
*/
|
|
34
|
-
export function formatRelative(iso: string | null | undefined): string {
|
|
35
|
-
if (!iso) return "—";
|
|
36
|
-
const d = new Date(iso);
|
|
37
|
-
if (Number.isNaN(d.valueOf())) return "—";
|
|
38
|
-
const days = Math.floor((Date.now() - d.valueOf()) / (1000 * 60 * 60 * 24));
|
|
39
|
-
if (days <= 0) return "today";
|
|
40
|
-
if (days === 1) return "1d ago";
|
|
41
|
-
if (days < 30) return `${days}d ago`;
|
|
42
|
-
const months = Math.floor(days / 30);
|
|
43
|
-
if (months === 1) return "1mo ago";
|
|
44
|
-
if (months < 12) return `${months}mo ago`;
|
|
45
|
-
const years = Math.floor(months / 12);
|
|
46
|
-
if (years === 1) return "1y ago";
|
|
47
|
-
return `${years}y ago`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Format an ISO date as a localized short date (e.g. "Jan 5, 2026").
|
|
52
|
-
* Returns the original string for unparseable input, or "—" when
|
|
53
|
-
* no value is provided.
|
|
54
|
-
*/
|
|
55
|
-
export function formatDate(iso: string | null | undefined): string {
|
|
56
|
-
if (!iso) return "—";
|
|
57
|
-
const d = new Date(iso);
|
|
58
|
-
if (Number.isNaN(d.valueOf())) return iso;
|
|
59
|
-
return d.toLocaleDateString("en-US", {
|
|
60
|
-
year: "numeric",
|
|
61
|
-
month: "short",
|
|
62
|
-
day: "numeric",
|
|
63
|
-
});
|
|
64
|
-
}
|
|
1
|
+
export * from "@grove-dev/core";
|
package/src/lib/lenses.ts
CHANGED
|
@@ -1,220 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Curated lenses for the list page.
|
|
3
|
-
*
|
|
4
|
-
* Two flavors:
|
|
5
|
-
* - "label-based": maps to a single `labels` value (e.g. new / hot / mature).
|
|
6
|
-
* No extra curation needed — every item already has a label.
|
|
7
|
-
* - "curator-assigned": maps to a `lenses` value on the item. The 5 anchor
|
|
8
|
-
* items get these populated. Other items will simply not match.
|
|
9
|
-
*
|
|
10
|
-
* The lens id is what shows up in the URL as `?lens=...`. For
|
|
11
|
-
* label-based lenses, the lens id is the same as the label.
|
|
12
|
-
*
|
|
13
|
-
* The 6 lenses in `PRIMARY_LENSES` are rendered as top-row tabs. The rest
|
|
14
|
-
* remain in the union type for URL deep-linking and future use, but are
|
|
15
|
-
* not shown in the UI by default.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
export type LensId =
|
|
19
|
-
// Label-based (tabbed)
|
|
20
|
-
| "all"
|
|
21
|
-
| "new"
|
|
22
|
-
| "hot"
|
|
23
|
-
| "mature"
|
|
24
|
-
// Curator-assigned (tabbed)
|
|
25
|
-
| "good-to-learn"
|
|
26
|
-
| "production-like"
|
|
27
|
-
// Available in URL state, but not tabbed
|
|
28
|
-
| "beginner-friendly"
|
|
29
|
-
| "contribution-ready"
|
|
30
|
-
| "launches"
|
|
31
|
-
// Status-based (available in URL state, not tabbed)
|
|
32
|
-
| "actively-developed"
|
|
33
|
-
| "needs-maintainer";
|
|
34
|
-
|
|
35
|
-
export interface LensDef {
|
|
36
|
-
id: LensId;
|
|
37
|
-
label: string;
|
|
38
|
-
/** Short blurb shown when the lens is active. */
|
|
39
|
-
description?: string;
|
|
40
|
-
/** What URL state this lens implies. Empty means no filter. */
|
|
41
|
-
toParams: () => Record<string, string | string[]>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const LENSES: LensDef[] = [
|
|
45
|
-
{ id: "all", label: "All items", description: "Every item in the directory", toParams: () => ({}) },
|
|
46
|
-
{
|
|
47
|
-
id: "new",
|
|
48
|
-
label: "Recently added",
|
|
49
|
-
description: "Apps recently added to the directory",
|
|
50
|
-
toParams: () => ({ label: "new" }),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: "hot",
|
|
54
|
-
label: "Trending",
|
|
55
|
-
description: "Apps with recent activity and attention",
|
|
56
|
-
toParams: () => ({ label: "hot" }),
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: "mature",
|
|
60
|
-
label: "Established",
|
|
61
|
-
description: "Long-running projects with stable history",
|
|
62
|
-
toParams: () => ({ label: "mature" }),
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: "production-like",
|
|
66
|
-
label: "Production-like",
|
|
67
|
-
description: "Real items, not toy projects",
|
|
68
|
-
toParams: () => ({ lens: "production-like" }),
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
id: "good-to-learn",
|
|
72
|
-
label: "Good to learn",
|
|
73
|
-
description: "Readable codebases with useful patterns",
|
|
74
|
-
toParams: () => ({ lens: "good-to-learn" }),
|
|
75
|
-
},
|
|
76
|
-
// Secondary (URL-only, not rendered as tabs)
|
|
77
|
-
{
|
|
78
|
-
id: "beginner-friendly",
|
|
79
|
-
label: "Beginner friendly",
|
|
80
|
-
description: "Smaller, readable, easier to understand",
|
|
81
|
-
toParams: () => ({ lens: "beginner-friendly" }),
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: "contribution-ready",
|
|
85
|
-
label: "Contribution ready",
|
|
86
|
-
description: "Clear issues, active maintainers, license, contribution docs",
|
|
87
|
-
toParams: () => ({ lens: "contribution-ready" }),
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: "launches",
|
|
91
|
-
label: "Launches",
|
|
92
|
-
description: "Recently launched OSS items seeking feedback",
|
|
93
|
-
toParams: () => ({ lens: "launches" }),
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
id: "actively-developed",
|
|
97
|
-
label: "Active",
|
|
98
|
-
description: "Apps with recent commits, releases, and issue activity",
|
|
99
|
-
toParams: () => ({ status: "active" }),
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "needs-maintainer",
|
|
103
|
-
label: "Needs maintainer",
|
|
104
|
-
description: "Useful items that need help",
|
|
105
|
-
toParams: () => ({ status: "stale,quiet" }),
|
|
106
|
-
},
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* The 6 lenses shown as top-row tabs on /items. Order matters — left to right.
|
|
111
|
-
* Keep this list aligned with what the design calls for: All, signal lenses,
|
|
112
|
-
* and the two curator-assigned lenses that have any matches.
|
|
113
|
-
*/
|
|
114
|
-
export const PRIMARY_LENSES: LensId[] = [
|
|
115
|
-
"all",
|
|
116
|
-
"new",
|
|
117
|
-
"hot",
|
|
118
|
-
"mature",
|
|
119
|
-
"production-like",
|
|
120
|
-
"good-to-learn",
|
|
121
|
-
];
|
|
122
|
-
|
|
123
|
-
export function lensById(id: string | null | undefined): LensDef | undefined {
|
|
124
|
-
if (!id) return undefined;
|
|
125
|
-
return LENSES.find((l) => l.id === id);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Check whether the current URL search params match a given lens's
|
|
130
|
-
* implied filter state. Used to highlight the active tab when a
|
|
131
|
-
* deep-link uses the underlying filter key (e.g. ?label=hot) rather
|
|
132
|
-
* than the abstract lens id (?lens=hot).
|
|
133
|
-
*/
|
|
134
|
-
export function isLensActive(lensId: LensId, sp: URLSearchParams): boolean {
|
|
135
|
-
if (lensId === "all") {
|
|
136
|
-
// "All" is active when no lens-shaped filter is present.
|
|
137
|
-
return !lensFromSearchParams(sp) && !sp.get("label") && !sp.get("status");
|
|
138
|
-
}
|
|
139
|
-
const def = lensById(lensId);
|
|
140
|
-
if (!def) return false;
|
|
141
|
-
const target = def.toParams();
|
|
142
|
-
for (const [k, v] of Object.entries(target)) {
|
|
143
|
-
if (Array.isArray(v)) {
|
|
144
|
-
if (sp.getAll(k).length !== v.length) return false;
|
|
145
|
-
for (const item of v) if (!sp.getAll(k).includes(item)) return false;
|
|
146
|
-
} else {
|
|
147
|
-
if (sp.get(k) !== v) return false;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export function isPrimaryLens(id: string | null | undefined): boolean {
|
|
154
|
-
if (!id) return false;
|
|
155
|
-
return PRIMARY_LENSES.includes(id as LensId);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Turn a lens's `toParams()` output into a URLSearchParams string
|
|
160
|
-
* (with the existing query preserved, then lens params merged on top).
|
|
161
|
-
*/
|
|
162
|
-
export function lensToQuery(id: LensId | null | undefined, current: URLSearchParams): string {
|
|
163
|
-
if (!id || id === "all") return "";
|
|
164
|
-
const def = lensById(id);
|
|
165
|
-
if (!def) return "";
|
|
166
|
-
const next = new URLSearchParams(current);
|
|
167
|
-
for (const [k, v] of Object.entries(def.toParams())) {
|
|
168
|
-
if (Array.isArray(v)) {
|
|
169
|
-
next.delete(k);
|
|
170
|
-
for (const item of v) next.append(k, item);
|
|
171
|
-
} else {
|
|
172
|
-
next.set(k, v);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return next.toString();
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Read a `?lens=...` value from URL search params.
|
|
180
|
-
*/
|
|
181
|
-
export function lensFromSearchParams(sp: URLSearchParams): LensId | null {
|
|
182
|
-
const v = sp.get("lens");
|
|
183
|
-
if (!v) return null;
|
|
184
|
-
if (LENSES.some((l) => l.id === v)) return v as LensId;
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Build a `href` for a lens tab. Per the single-select-view rule,
|
|
190
|
-
* clicking a lens resets the "view" params (lens, label, status, page)
|
|
191
|
-
* and applies only the chosen lens's params. Stack/Platform/Category/
|
|
192
|
-
* License/q/sort/density filters are preserved.
|
|
193
|
-
*/
|
|
194
|
-
export function hrefForLens(
|
|
195
|
-
lensId: LensId | null | undefined,
|
|
196
|
-
current: URLSearchParams,
|
|
197
|
-
pathPrefix = "/items",
|
|
198
|
-
): string {
|
|
199
|
-
const sp = new URLSearchParams(current);
|
|
200
|
-
sp.delete("lens");
|
|
201
|
-
sp.delete("label");
|
|
202
|
-
sp.delete("status");
|
|
203
|
-
sp.delete("page");
|
|
204
|
-
if (lensId && lensId !== "all") {
|
|
205
|
-
const def = lensById(lensId);
|
|
206
|
-
if (def) {
|
|
207
|
-
for (const [k, v] of Object.entries(def.toParams())) {
|
|
208
|
-
if (Array.isArray(v)) {
|
|
209
|
-
sp.delete(k);
|
|
210
|
-
for (const item of v) sp.append(k, item);
|
|
211
|
-
} else {
|
|
212
|
-
sp.set(k, v);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
const qs = sp.toString();
|
|
218
|
-
const base = pathPrefix.replace(/\/$/, "") || "/";
|
|
219
|
-
return qs ? `${base}?${qs}` : base;
|
|
220
|
-
}
|
|
1
|
+
export * from "@grove-dev/core";
|
package/src/lib/repo.ts
CHANGED
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Parse a GitHub repo URL into its owner and repo components.
|
|
3
|
-
* Returns nulls if the URL doesn't match github.com/{owner}/{repo}.
|
|
4
|
-
*
|
|
5
|
-
* Used in:
|
|
6
|
-
* - ItemCard avatar fallback (owner avatar via GitHub avatars
|
|
7
|
-
* API; component name retained for V1 published API stability)
|
|
8
|
-
* - App detail page (showing owner + repo name in breadcrumb / header)
|
|
9
|
-
* - Anywhere we need to display "@owner / repo" or link to the owner
|
|
10
|
-
*/
|
|
11
|
-
export function getOwnerAndRepoFromRepoUrl(repoUrl: string): {
|
|
12
|
-
owner: string | null;
|
|
13
|
-
repo: string | null;
|
|
14
|
-
} {
|
|
15
|
-
if (!repoUrl || !repoUrl.includes("github.com/")) {
|
|
16
|
-
return { owner: null, repo: null };
|
|
17
|
-
}
|
|
18
|
-
const m = repoUrl.match(/github\.com\/([^/]+)\/([^/?#]+)/);
|
|
19
|
-
if (!m) return { owner: null, repo: null };
|
|
20
|
-
const owner = m[1] ?? null;
|
|
21
|
-
const repo = m[2]?.replace(/\.git$/, "") ?? null;
|
|
22
|
-
return { owner, repo };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Build a GitHub avatar URL for a given owner.
|
|
27
|
-
* Returns null if owner is null/empty.
|
|
28
|
-
*/
|
|
29
|
-
export function getOwnerAvatarUrl(owner: string | null, size: number = 80): string | null {
|
|
30
|
-
if (!owner) return null;
|
|
31
|
-
return `https://avatars.githubusercontent.com/${owner}?v=4&s=${size}`;
|
|
32
|
-
}
|
|
1
|
+
export * from "@grove-dev/core";
|
package/src/lib/scores.ts
CHANGED
|
@@ -1,90 +1 @@
|
|
|
1
|
-
|
|
2
|
-
activity?: number;
|
|
3
|
-
maturity?: number;
|
|
4
|
-
learning?: number;
|
|
5
|
-
contribution?: number;
|
|
6
|
-
docs?: number;
|
|
7
|
-
overall?: number;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Format a single score (0-100) into a 0-5 "tier" used by the UI:
|
|
12
|
-
*
|
|
13
|
-
* 0-19 → 0 (very low)
|
|
14
|
-
* 20-39 → 1 (low)
|
|
15
|
-
* 40-59 → 2 (medium)
|
|
16
|
-
* 60-79 → 3 (high)
|
|
17
|
-
* 80-100 → 4 (very high)
|
|
18
|
-
*
|
|
19
|
-
* The list page renders each score as a 4-cell bar; this gives the
|
|
20
|
-
* visual a stable shape regardless of the underlying number.
|
|
21
|
-
*/
|
|
22
|
-
export function scoreTier(n: number): 0 | 1 | 2 | 3 | 4 {
|
|
23
|
-
if (n < 20) return 0;
|
|
24
|
-
if (n < 40) return 1;
|
|
25
|
-
if (n < 60) return 2;
|
|
26
|
-
if (n < 80) return 3;
|
|
27
|
-
return 4;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** Compact textual label for a score tier (used in tooltips). */
|
|
31
|
-
export function scoreTierLabel(n: number): string {
|
|
32
|
-
switch (scoreTier(n)) {
|
|
33
|
-
case 0:
|
|
34
|
-
return "Very low";
|
|
35
|
-
case 1:
|
|
36
|
-
return "Low";
|
|
37
|
-
case 2:
|
|
38
|
-
return "Medium";
|
|
39
|
-
case 3:
|
|
40
|
-
return "High";
|
|
41
|
-
case 4:
|
|
42
|
-
return "Very high";
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Short numeric label used inline next to a score bar, e.g. "82". */
|
|
47
|
-
export function scoreLabel(n: number | undefined): string {
|
|
48
|
-
if (typeof n !== "number") return "—";
|
|
49
|
-
return Math.round(n).toString();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** Order of score dimensions, used by both list and detail. */
|
|
53
|
-
export const SCORE_DIMENSIONS: (keyof AppScores)[] = [
|
|
54
|
-
"activity",
|
|
55
|
-
"maturity",
|
|
56
|
-
"learning",
|
|
57
|
-
"contribution",
|
|
58
|
-
"docs",
|
|
59
|
-
"overall",
|
|
60
|
-
];
|
|
61
|
-
|
|
62
|
-
/** Human-readable label for a score dimension. */
|
|
63
|
-
export const SCORE_LABELS: Record<keyof AppScores, string> = {
|
|
64
|
-
activity: "Activity",
|
|
65
|
-
maturity: "Maturity",
|
|
66
|
-
learning: "Learning",
|
|
67
|
-
contribution: "Contribution",
|
|
68
|
-
docs: "Docs",
|
|
69
|
-
overall: "Overall",
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Reasoning copy per dimension, surfaced in the detail page so the
|
|
74
|
-
* numbers don't feel magical. These are intentionally short — the
|
|
75
|
-
* curation.notes on each item carries the longer story.
|
|
76
|
-
*/
|
|
77
|
-
export const SCORE_REASONING: Record<keyof AppScores, string> = {
|
|
78
|
-
activity:
|
|
79
|
-
"Recent commits, open and merged PRs, issue response time, release cadence.",
|
|
80
|
-
maturity:
|
|
81
|
-
"Repo age, stable structure, real-world production usage, contributor stability.",
|
|
82
|
-
learning:
|
|
83
|
-
"Codebase readability, useful architecture patterns, comment quality, examples.",
|
|
84
|
-
contribution:
|
|
85
|
-
"Open issues, recent merged PRs from new contributors, maintainer responsiveness, contribution guide.",
|
|
86
|
-
docs:
|
|
87
|
-
"README quality, architecture docs, contributing guide, examples, code comments.",
|
|
88
|
-
overall:
|
|
89
|
-
"Composite judgment — how likely this item is to satisfy a curious developer.",
|
|
90
|
-
};
|
|
1
|
+
export * from "@grove-dev/core";
|