@grove-dev/core 0.7.0 → 0.8.0
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/dist/audit.d.ts +3 -3
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +25 -6
- package/dist/audit.js.map +1 -1
- package/dist/awesome-readme.d.ts.map +1 -1
- package/dist/awesome-readme.js +31 -31
- package/dist/awesome-readme.js.map +1 -1
- package/dist/build-data.d.ts +1 -1
- package/dist/build-data.d.ts.map +1 -1
- package/dist/build-data.js +82 -77
- package/dist/build-data.js.map +1 -1
- package/dist/collections-io.d.ts +1 -1
- package/dist/collections-io.js +8 -8
- package/dist/collections-io.js.map +1 -1
- package/dist/collections.d.ts +2 -2
- package/dist/collections.d.ts.map +1 -1
- package/dist/collections.js +8 -9
- package/dist/collections.js.map +1 -1
- package/dist/collector.d.ts +1 -1
- package/dist/collector.d.ts.map +1 -1
- package/dist/collector.js +2 -2
- package/dist/collector.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -4
- package/dist/config.js.map +1 -1
- package/dist/content-body.d.ts.map +1 -1
- package/dist/content-body.js +22 -22
- package/dist/content-body.js.map +1 -1
- package/dist/contributors.d.ts.map +1 -1
- package/dist/contributors.js +22 -23
- package/dist/contributors.js.map +1 -1
- package/dist/decisions.d.ts +1 -1
- package/dist/decisions.d.ts.map +1 -1
- package/dist/decisions.js +18 -20
- package/dist/decisions.js.map +1 -1
- package/dist/directory-client.d.ts +6 -4
- package/dist/directory-client.d.ts.map +1 -1
- package/dist/directory-client.js +9 -4
- package/dist/directory-client.js.map +1 -1
- package/dist/directory-facets.d.ts +1 -1
- package/dist/directory-facets.d.ts.map +1 -1
- package/dist/directory-facets.js +35 -17
- package/dist/directory-facets.js.map +1 -1
- package/dist/directory-filter-keys.d.ts +53 -0
- package/dist/directory-filter-keys.d.ts.map +1 -0
- package/dist/directory-filter-keys.js +66 -0
- package/dist/directory-filter-keys.js.map +1 -0
- package/dist/directory-format.d.ts.map +1 -1
- package/dist/directory-format.js +15 -15
- package/dist/directory-format.js.map +1 -1
- package/dist/directory-lenses.d.ts +1 -1
- package/dist/directory-lenses.d.ts.map +1 -1
- package/dist/directory-lenses.js +66 -61
- package/dist/directory-lenses.js.map +1 -1
- package/dist/directory-repo.js +2 -2
- package/dist/directory-scores.d.ts.map +1 -1
- package/dist/directory-scores.js +25 -25
- package/dist/directory-scores.js.map +1 -1
- package/dist/directory-search.d.ts +4 -4
- package/dist/directory-search.d.ts.map +1 -1
- package/dist/directory-search.js +99 -107
- package/dist/directory-search.js.map +1 -1
- package/dist/directory-taxonomy.d.ts +1 -1
- package/dist/directory-taxonomy.d.ts.map +1 -1
- package/dist/directory-taxonomy.js +2 -2
- package/dist/directory-taxonomy.js.map +1 -1
- package/dist/enrich.d.ts.map +1 -1
- package/dist/enrich.js +15 -12
- package/dist/enrich.js.map +1 -1
- package/dist/github-client.js +6 -6
- package/dist/github.d.ts +1 -1
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +15 -13
- package/dist/github.js.map +1 -1
- package/dist/health.d.ts +1 -1
- package/dist/health.js +44 -44
- package/dist/host.js +2 -2
- package/dist/importer.d.ts +2 -2
- package/dist/importer.d.ts.map +1 -1
- package/dist/importer.js +1 -1
- package/dist/importer.js.map +1 -1
- package/dist/index.d.ts +66 -63
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -75
- package/dist/index.js.map +1 -1
- package/dist/io.js +8 -8
- package/dist/llms.d.ts +1 -1
- package/dist/llms.d.ts.map +1 -1
- package/dist/llms.js +65 -64
- package/dist/llms.js.map +1 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/og-image.d.ts +8 -8
- package/dist/og-image.d.ts.map +1 -1
- package/dist/og-image.js +91 -84
- package/dist/og-image.js.map +1 -1
- package/dist/page-document.d.ts +8 -8
- package/dist/page-document.d.ts.map +1 -1
- package/dist/page-document.js +48 -54
- package/dist/page-document.js.map +1 -1
- package/dist/parseReadme.d.ts.map +1 -1
- package/dist/parseReadme.js +9 -11
- package/dist/parseReadme.js.map +1 -1
- package/dist/prepare.d.ts +5 -5
- package/dist/prepare.d.ts.map +1 -1
- package/dist/prepare.js +25 -35
- package/dist/prepare.js.map +1 -1
- package/dist/related.d.ts +1 -1
- package/dist/schema.d.ts +21 -21
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +130 -141
- package/dist/schema.js.map +1 -1
- package/dist/site-artifacts.js +1 -1
- package/dist/sitemap.d.ts +2 -2
- package/dist/sitemap.d.ts.map +1 -1
- package/dist/sitemap.js +39 -39
- package/dist/sitemap.js.map +1 -1
- package/dist/slug.js +4 -4
- package/dist/sync-icons.js +15 -15
- package/dist/taxonomy-inference.d.ts +27 -0
- package/dist/taxonomy-inference.d.ts.map +1 -0
- package/dist/taxonomy-inference.js +38 -0
- package/dist/taxonomy-inference.js.map +1 -0
- package/dist/validate.d.ts +3 -3
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +56 -58
- package/dist/validate.js.map +1 -1
- package/dist/yaml.d.ts +47 -0
- package/dist/yaml.d.ts.map +1 -0
- package/dist/yaml.js +56 -0
- package/dist/yaml.js.map +1 -0
- package/package.json +1 -1
package/dist/audit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type PageType =
|
|
2
|
-
export type Profile =
|
|
1
|
+
export type PageType = 'home' | 'directory' | 'collection' | 'record' | 'content' | 'empty' | '404';
|
|
2
|
+
export type Profile = 'mobile' | 'desktop';
|
|
3
3
|
export interface PageManifestEntry {
|
|
4
4
|
path: string;
|
|
5
5
|
type: PageType;
|
|
@@ -38,7 +38,7 @@ export interface BudgetConfig {
|
|
|
38
38
|
export interface BudgetViolation {
|
|
39
39
|
page: PageManifestEntry;
|
|
40
40
|
profile: Profile;
|
|
41
|
-
category:
|
|
41
|
+
category: 'score' | 'metric';
|
|
42
42
|
name: keyof LighthouseScores | keyof LighthouseMetrics;
|
|
43
43
|
expected: number;
|
|
44
44
|
actual: number;
|
package/dist/audit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;AACpG,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,iBAAiB,CA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W,YAAY;IAC3B,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC7B,IAAI,EAAE,MAAM,gBAAgB,GAAG,MAAM,iBAAiB,CAAC;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AA0BD,eAAO,MAAM,cAAc,EAAE,YAG5B,CAAC;AAUF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,iBAAiB,EACvB,MAAM,GAAE,YAA6B,GACpC,eAAe,EAAE,CAqCnB"}
|
package/dist/audit.js
CHANGED
|
@@ -26,13 +26,18 @@ export const DEFAULT_BUDGET = {
|
|
|
26
26
|
scores: { performance: 0.9, accessibility: 0.9, bestPractices: 0.9, seo: 0.9 },
|
|
27
27
|
metrics: { lcp: 2500, cls: 0.25, tbt: 200 },
|
|
28
28
|
};
|
|
29
|
-
const SCORE_KEYS = [
|
|
30
|
-
|
|
29
|
+
const SCORE_KEYS = [
|
|
30
|
+
'performance',
|
|
31
|
+
'accessibility',
|
|
32
|
+
'bestPractices',
|
|
33
|
+
'seo',
|
|
34
|
+
];
|
|
35
|
+
const METRIC_KEYS = ['lcp', 'cls', 'tbt'];
|
|
31
36
|
export function evaluateBudget(result, page, budget = DEFAULT_BUDGET) {
|
|
32
37
|
// Lighthouse cannot meaningfully measure 404 responses — all scores come
|
|
33
38
|
// back as 0 and all metrics as Infinity. The audit still runs the page
|
|
34
39
|
// for completeness, but the 100×4 budget does not apply.
|
|
35
|
-
if (page.type ===
|
|
40
|
+
if (page.type === '404')
|
|
36
41
|
return [];
|
|
37
42
|
const violations = [];
|
|
38
43
|
for (const key of SCORE_KEYS) {
|
|
@@ -40,15 +45,29 @@ export function evaluateBudget(result, page, budget = DEFAULT_BUDGET) {
|
|
|
40
45
|
// Lighthouse's SEO category fails its is-crawlable audit on any
|
|
41
46
|
// noindex page — so the SEO score can never reach 1 there. The
|
|
42
47
|
// other three categories still apply in full.
|
|
43
|
-
if (key ===
|
|
48
|
+
if (key === 'seo' && page.type === 'empty')
|
|
44
49
|
continue;
|
|
45
50
|
if (result.scores[key] < budget.scores[key]) {
|
|
46
|
-
violations.push({
|
|
51
|
+
violations.push({
|
|
52
|
+
page,
|
|
53
|
+
profile: result.profile,
|
|
54
|
+
category: 'score',
|
|
55
|
+
name: key,
|
|
56
|
+
expected: budget.scores[key],
|
|
57
|
+
actual: result.scores[key],
|
|
58
|
+
});
|
|
47
59
|
}
|
|
48
60
|
}
|
|
49
61
|
for (const key of METRIC_KEYS) {
|
|
50
62
|
if (result.metrics[key] > budget.metrics[key]) {
|
|
51
|
-
violations.push({
|
|
63
|
+
violations.push({
|
|
64
|
+
page,
|
|
65
|
+
profile: result.profile,
|
|
66
|
+
category: 'metric',
|
|
67
|
+
name: key,
|
|
68
|
+
expected: budget.metrics[key],
|
|
69
|
+
actual: result.metrics[key],
|
|
70
|
+
});
|
|
52
71
|
}
|
|
53
72
|
}
|
|
54
73
|
return violations;
|
package/dist/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAoDA,sEAAsE;AACtE,qEAAqE;AACrE,cAAc;AACd,EAAE;AACF,oEAAoE;AACpE,iEAAiE;AACjE,gEAAgE;AAChE,oEAAoE;AACpE,sEAAsE;AACtE,kEAAkE;AAClE,SAAS;AACT,EAAE;AACF,+CAA+C;AAC/C,oEAAoE;AACpE,oEAAoE;AACpE,oEAAoE;AACpE,qEAAqE;AACrE,8DAA8D;AAC9D,sEAAsE;AACtE,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,gCAAgC;AAChC,MAAM,CA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AW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACjC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC9B,CAAC;IACF,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;CAC3C;AAED,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AA0D9D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CA8EpE;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,CAchF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ9E"}
|
package/dist/awesome-readme.js
CHANGED
|
@@ -11,25 +11,25 @@
|
|
|
11
11
|
* intro, contributing notes, and license section are preserved across
|
|
12
12
|
* regenerations. When the sentinels are absent, a new block is appended.
|
|
13
13
|
*/
|
|
14
|
-
export const AWESOME_README_START =
|
|
15
|
-
export const AWESOME_README_END =
|
|
14
|
+
export const AWESOME_README_START = '<!-- grove-readme:start -->';
|
|
15
|
+
export const AWESOME_README_END = '<!-- grove-readme:end -->';
|
|
16
16
|
const SENTINEL_PATTERN = /<!--\s*grove-readme:start\s*-->[\s\S]*?<!--\s*grove-readme:end\s*-->/;
|
|
17
17
|
function normalizeDescription(value) {
|
|
18
18
|
if (!value)
|
|
19
|
-
return
|
|
20
|
-
const collapsed = value.replace(/\s+/g,
|
|
21
|
-
const stripped = collapsed.replace(/[.!?…]+\s*$/u,
|
|
19
|
+
return '';
|
|
20
|
+
const collapsed = value.replace(/\s+/g, ' ').trim();
|
|
21
|
+
const stripped = collapsed.replace(/[.!?…]+\s*$/u, '');
|
|
22
22
|
return stripped;
|
|
23
23
|
}
|
|
24
24
|
function entryUrl(record) {
|
|
25
|
-
return record.homepageUrl ?? record.repoUrl ??
|
|
25
|
+
return record.homepageUrl ?? record.repoUrl ?? '';
|
|
26
26
|
}
|
|
27
27
|
function entryLabel(record) {
|
|
28
28
|
return record.name?.trim() || record.slug.trim();
|
|
29
29
|
}
|
|
30
30
|
function sortByName(a, b) {
|
|
31
31
|
return entryLabel(a).localeCompare(entryLabel(b), undefined, {
|
|
32
|
-
sensitivity:
|
|
32
|
+
sensitivity: 'base',
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
function categoryDisplayName(id, categories) {
|
|
@@ -37,16 +37,16 @@ function categoryDisplayName(id, categories) {
|
|
|
37
37
|
if (match)
|
|
38
38
|
return match.name;
|
|
39
39
|
return id
|
|
40
|
-
.split(
|
|
41
|
-
.map((part) => (part ? part[0].toUpperCase() + part.slice(1) :
|
|
42
|
-
.join(
|
|
40
|
+
.split('-')
|
|
41
|
+
.map((part) => (part ? part[0].toUpperCase() + part.slice(1) : ''))
|
|
42
|
+
.join(' ');
|
|
43
43
|
}
|
|
44
44
|
function categoryAnchor(name) {
|
|
45
45
|
return name
|
|
46
46
|
.toLowerCase()
|
|
47
|
-
.replace(/[^a-z0-9\s-]/g,
|
|
47
|
+
.replace(/[^a-z0-9\s-]/g, '')
|
|
48
48
|
.trim()
|
|
49
|
-
.replace(/\s+/g,
|
|
49
|
+
.replace(/\s+/g, '-');
|
|
50
50
|
}
|
|
51
51
|
function buildEntryLine(record) {
|
|
52
52
|
const label = entryLabel(record);
|
|
@@ -56,7 +56,7 @@ function buildEntryLine(record) {
|
|
|
56
56
|
return desc ? `- ${link} - ${desc}.` : `- ${link}`;
|
|
57
57
|
}
|
|
58
58
|
function isVisible(record) {
|
|
59
|
-
return record.visibility !==
|
|
59
|
+
return record.visibility !== 'hide' && record.visibility !== 'remove';
|
|
60
60
|
}
|
|
61
61
|
function hasLabel(record) {
|
|
62
62
|
return Boolean(record.name?.trim() || record.slug?.trim());
|
|
@@ -84,7 +84,7 @@ export function buildAwesomeReadme(input) {
|
|
|
84
84
|
orderedIds.push(id);
|
|
85
85
|
const grouped = new Map();
|
|
86
86
|
for (const record of visible) {
|
|
87
|
-
const id = record.category ??
|
|
87
|
+
const id = record.category ?? 'other';
|
|
88
88
|
if (!grouped.has(id))
|
|
89
89
|
grouped.set(id, []);
|
|
90
90
|
grouped.get(id).push(record);
|
|
@@ -94,35 +94,35 @@ export function buildAwesomeReadme(input) {
|
|
|
94
94
|
const title = opts.title ?? input.site.name;
|
|
95
95
|
const tagline = opts.tagline ?? opts.description ?? input.site.tagline ?? input.site.description;
|
|
96
96
|
const browseUrl = opts.url ?? input.site.url;
|
|
97
|
-
const browseLabel = opts.browseLabel ??
|
|
97
|
+
const browseLabel = opts.browseLabel ?? 'Browse the full directory →';
|
|
98
98
|
const lines = [];
|
|
99
99
|
lines.push(`# ${title}`);
|
|
100
|
-
lines.push(
|
|
100
|
+
lines.push('');
|
|
101
101
|
if (showBadge) {
|
|
102
|
-
lines.push(
|
|
103
|
-
lines.push(
|
|
102
|
+
lines.push('[](https://awesome.re)');
|
|
103
|
+
lines.push('');
|
|
104
104
|
}
|
|
105
105
|
if (tagline) {
|
|
106
106
|
lines.push(tagline);
|
|
107
|
-
lines.push(
|
|
107
|
+
lines.push('');
|
|
108
108
|
}
|
|
109
109
|
if (showBrowseLink && browseUrl) {
|
|
110
110
|
lines.push(`${browseLabel} ${browseUrl}`);
|
|
111
|
-
lines.push(
|
|
111
|
+
lines.push('');
|
|
112
112
|
}
|
|
113
113
|
if (opts.intro) {
|
|
114
|
-
const introLines = opts.intro.replace(/\n+$/,
|
|
114
|
+
const introLines = opts.intro.replace(/\n+$/, '').split('\n');
|
|
115
115
|
lines.push(...introLines);
|
|
116
|
-
lines.push(
|
|
116
|
+
lines.push('');
|
|
117
117
|
}
|
|
118
118
|
if (showToc) {
|
|
119
|
-
lines.push(
|
|
120
|
-
lines.push(
|
|
119
|
+
lines.push('## Contents');
|
|
120
|
+
lines.push('');
|
|
121
121
|
for (const id of orderedIds) {
|
|
122
122
|
const name = categoryDisplayName(id, input.categories);
|
|
123
123
|
lines.push(`- [${name}](#${categoryAnchor(name)})`);
|
|
124
124
|
}
|
|
125
|
-
lines.push(
|
|
125
|
+
lines.push('');
|
|
126
126
|
}
|
|
127
127
|
for (const id of orderedIds) {
|
|
128
128
|
const name = categoryDisplayName(id, input.categories);
|
|
@@ -130,17 +130,17 @@ export function buildAwesomeReadme(input) {
|
|
|
130
130
|
if (records.length === 0)
|
|
131
131
|
continue;
|
|
132
132
|
lines.push(`## ${name}`);
|
|
133
|
-
lines.push(
|
|
133
|
+
lines.push('');
|
|
134
134
|
for (const record of records)
|
|
135
135
|
lines.push(buildEntryLine(record));
|
|
136
|
-
lines.push(
|
|
136
|
+
lines.push('');
|
|
137
137
|
}
|
|
138
|
-
return lines.join(
|
|
138
|
+
return lines.join('\n').replace(/\n+$/, '\n');
|
|
139
139
|
}
|
|
140
140
|
export function parseAwesomeReadmeSections(readme) {
|
|
141
141
|
const match = readme.match(SENTINEL_PATTERN);
|
|
142
142
|
if (!match || match.index === undefined) {
|
|
143
|
-
return { before: readme, entries:
|
|
143
|
+
return { before: readme, entries: '', after: '' };
|
|
144
144
|
}
|
|
145
145
|
const start = match.index;
|
|
146
146
|
const end = match.index + match[0].length;
|
|
@@ -153,12 +153,12 @@ export function parseAwesomeReadmeSections(readme) {
|
|
|
153
153
|
return { before, entries, after };
|
|
154
154
|
}
|
|
155
155
|
export function injectAwesomeReadmeBlock(readme, block) {
|
|
156
|
-
const trimmed = block.replace(/\n+$/,
|
|
156
|
+
const trimmed = block.replace(/\n+$/, '\n');
|
|
157
157
|
const wrapped = `${AWESOME_README_START}\n${trimmed}${AWESOME_README_END}`;
|
|
158
158
|
if (SENTINEL_PATTERN.test(readme)) {
|
|
159
159
|
return readme.replace(SENTINEL_PATTERN, wrapped);
|
|
160
160
|
}
|
|
161
|
-
const trailing = readme.endsWith(
|
|
161
|
+
const trailing = readme.endsWith('\n') ? readme : `${readme}\n`;
|
|
162
162
|
return `${trailing}\n${wrapped}\n`;
|
|
163
163
|
}
|
|
164
164
|
//# sourceMappingURL=awesome-readme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"awesome-readme.js","sourceRoot":"","sources":["../src/awesome-readme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA6CH,MAAM,CAAC,MAAM,oBAAoB,GAAG,6BAA6B,CAAC;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAE9D,MAAM,gBAAgB,GAAG,sEAAsE,CAAC;AAEhG,SAAS,oBAAoB,CAAC,KAAyB;IACrD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACpD,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IACvD,OAAO,QAAQ,CAAC;AACl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AC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC,MAAM,CAAC;IACvF,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAc,EAAE,KAAa;IACpE,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,GAAG,oBAAoB,KAAK,OAAO,GAAG,kBAAkB,EAAE,CAAC;IAC3E,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC;IAChE,OAAO,GAAG,QAAQ,KAAK,OAAO,IAAI,CAAC;AACrC,CAAC"}
|
package/dist/build-data.d.ts
CHANGED
package/dist/build-data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-data.d.ts","sourceRoot":"","sources":["../src/build-data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-data.d.ts","sourceRoot":"","sources":["../src/build-data.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,WAAW,EAUjB,MAAM,aAAa,CAAC;AA0GrB;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzC;AAiDD;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,wBAAsB,QAAQ,CAAC,GAAG,SAAgB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAiQjG"}
|
package/dist/build-data.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { mkdir, readdir, readFile, writeFile } from
|
|
2
|
-
import { basename, join, resolve } from
|
|
3
|
-
import { parse as parseYaml } from
|
|
4
|
-
import {
|
|
5
|
-
import { classifyHealth } from
|
|
6
|
-
import {
|
|
1
|
+
import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { basename, join, resolve } from 'node:path';
|
|
3
|
+
import { parse as parseYaml } from 'yaml';
|
|
4
|
+
import { loadConfig } from './config.js';
|
|
5
|
+
import { classifyHealth } from './health.js';
|
|
6
|
+
import { blueprintKind, decisionsFileSchema, healthFileSchema, overridesFileSchema, recordsFileSchema, toIndexRecord, unwrapDecisions, unwrapHealth, unwrapOverrides, } from './schema.js';
|
|
7
7
|
/**
|
|
8
8
|
* Apply a minimal decisions.yml override to a normalized record. The
|
|
9
9
|
* human curation layer is the single source of truth for visibility:
|
|
@@ -30,14 +30,17 @@ function applyDecision(record, visibilityById) {
|
|
|
30
30
|
const override = visibilityById.get(record.slug);
|
|
31
31
|
if (!override)
|
|
32
32
|
return record;
|
|
33
|
-
if (record.kind ===
|
|
33
|
+
if (record.kind === 'project') {
|
|
34
34
|
const existing = record.health;
|
|
35
35
|
// Fabricate a default "no signals" health block via the canonical
|
|
36
36
|
// classifier. Keeps the threshold/format in lockstep with the rest
|
|
37
37
|
// of the package — if `classifyHealth` ever changes its unknown
|
|
38
38
|
// shape, this fabrication updates automatically.
|
|
39
39
|
const fabricated = classifyHealth(record.slug).health;
|
|
40
|
-
const merged = {
|
|
40
|
+
const merged = {
|
|
41
|
+
...(existing ?? fabricated),
|
|
42
|
+
visibility: override,
|
|
43
|
+
};
|
|
41
44
|
return { ...record, health: merged };
|
|
42
45
|
}
|
|
43
46
|
// Resource-hub / ecosystem-map: no `health` block; the top-level
|
|
@@ -55,8 +58,8 @@ function applyDecision(record, visibilityById) {
|
|
|
55
58
|
*/
|
|
56
59
|
async function loadHealthEntries(healthPath, cwd) {
|
|
57
60
|
try {
|
|
58
|
-
const raw = await readFile(resolve(cwd, healthPath),
|
|
59
|
-
const parsed = healthFileSchema.parse(parseYaml(raw, { schema:
|
|
61
|
+
const raw = await readFile(resolve(cwd, healthPath), 'utf8');
|
|
62
|
+
const parsed = healthFileSchema.parse(parseYaml(raw, { schema: 'core' }) ?? {});
|
|
60
63
|
const out = new Map();
|
|
61
64
|
for (const entry of unwrapHealth(parsed))
|
|
62
65
|
out.set(entry.id, entry.health);
|
|
@@ -73,8 +76,8 @@ async function loadHealthEntries(healthPath, cwd) {
|
|
|
73
76
|
*/
|
|
74
77
|
async function loadOverridePatches(overridesPath, cwd) {
|
|
75
78
|
try {
|
|
76
|
-
const raw = await readFile(resolve(cwd, overridesPath),
|
|
77
|
-
const parsed = overridesFileSchema.parse(parseYaml(raw, { schema:
|
|
79
|
+
const raw = await readFile(resolve(cwd, overridesPath), 'utf8');
|
|
80
|
+
const parsed = overridesFileSchema.parse(parseYaml(raw, { schema: 'core' }) ?? {});
|
|
78
81
|
const out = new Map();
|
|
79
82
|
for (const entry of unwrapOverrides(parsed))
|
|
80
83
|
out.set(entry.id, entry.patch);
|
|
@@ -86,8 +89,8 @@ async function loadOverridePatches(overridesPath, cwd) {
|
|
|
86
89
|
}
|
|
87
90
|
async function loadDecisionVisibility(decisionsPath, cwd) {
|
|
88
91
|
try {
|
|
89
|
-
const raw = await readFile(resolve(cwd, decisionsPath),
|
|
90
|
-
const parsed = decisionsFileSchema.parse(parseYaml(raw, { schema:
|
|
92
|
+
const raw = await readFile(resolve(cwd, decisionsPath), 'utf8');
|
|
93
|
+
const parsed = decisionsFileSchema.parse(parseYaml(raw, { schema: 'core' }) ?? {});
|
|
91
94
|
const decisions = unwrapDecisions(parsed);
|
|
92
95
|
const out = new Map();
|
|
93
96
|
for (const d of decisions)
|
|
@@ -101,15 +104,15 @@ async function loadDecisionVisibility(decisionsPath, cwd) {
|
|
|
101
104
|
}
|
|
102
105
|
async function loadTaxonomyFile(cwd, taxonomyDir, filename) {
|
|
103
106
|
try {
|
|
104
|
-
const text = await readFile(resolve(cwd, taxonomyDir, filename),
|
|
105
|
-
const raw = parseYaml(text, { schema:
|
|
107
|
+
const text = await readFile(resolve(cwd, taxonomyDir, filename), 'utf8');
|
|
108
|
+
const raw = parseYaml(text, { schema: 'core' });
|
|
106
109
|
if (!Array.isArray(raw))
|
|
107
110
|
return [];
|
|
108
111
|
const items = raw
|
|
109
112
|
.filter((item) => Boolean(item) &&
|
|
110
|
-
typeof item ===
|
|
111
|
-
typeof item.id ===
|
|
112
|
-
typeof item.name ===
|
|
113
|
+
typeof item === 'object' &&
|
|
114
|
+
typeof item.id === 'string' &&
|
|
115
|
+
typeof item.name === 'string')
|
|
113
116
|
.map((item) => ({
|
|
114
117
|
...item,
|
|
115
118
|
id: item.id,
|
|
@@ -122,8 +125,8 @@ async function loadTaxonomyFile(cwd, taxonomyDir, filename) {
|
|
|
122
125
|
return items
|
|
123
126
|
.map((item, index) => ({ item, index }))
|
|
124
127
|
.sort((a, b) => {
|
|
125
|
-
const orderA = typeof a.item.order ===
|
|
126
|
-
const orderB = typeof b.item.order ===
|
|
128
|
+
const orderA = typeof a.item.order === 'number' ? a.item.order : Number.POSITIVE_INFINITY;
|
|
129
|
+
const orderB = typeof b.item.order === 'number' ? b.item.order : Number.POSITIVE_INFINITY;
|
|
127
130
|
return orderA - orderB || a.index - b.index;
|
|
128
131
|
})
|
|
129
132
|
.map(({ item }) => item);
|
|
@@ -139,7 +142,7 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
139
142
|
await mkdir(outDir, { recursive: true });
|
|
140
143
|
const expectedKind = blueprintKind[cfg.blueprint];
|
|
141
144
|
const entries = await readdir(recordsDir).catch(() => []);
|
|
142
|
-
const files = entries.filter((f) => f.endsWith(
|
|
145
|
+
const files = entries.filter((f) => f.endsWith('.yml')).sort();
|
|
143
146
|
// Load the three side files once; a missing file is an empty map.
|
|
144
147
|
// Precedence, lowest to highest: overrides patch the parsed record,
|
|
145
148
|
// health.yml supplies a health block the record does not carry, and
|
|
@@ -150,10 +153,10 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
150
153
|
const out = [];
|
|
151
154
|
const errors = [];
|
|
152
155
|
for (const file of files) {
|
|
153
|
-
const fileSlug = basename(file,
|
|
156
|
+
const fileSlug = basename(file, '.yml');
|
|
154
157
|
try {
|
|
155
|
-
const text = await readFile(join(recordsDir, file),
|
|
156
|
-
const raw = (parseYaml(text, { schema:
|
|
158
|
+
const text = await readFile(join(recordsDir, file), 'utf8');
|
|
159
|
+
const raw = (parseYaml(text, { schema: 'core' }) ?? {});
|
|
157
160
|
if (!raw.kind)
|
|
158
161
|
raw.kind = expectedKind;
|
|
159
162
|
const patch = patchBySlug.get(fileSlug);
|
|
@@ -161,7 +164,7 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
161
164
|
normalized.slug = fileSlug;
|
|
162
165
|
// A health block written inline on the record wins; otherwise
|
|
163
166
|
// take the one keyed by this slug in health.yml, if there is one.
|
|
164
|
-
if (normalized.kind ===
|
|
167
|
+
if (normalized.kind === 'project' && !normalized.health) {
|
|
165
168
|
const health = healthBySlug.get(fileSlug);
|
|
166
169
|
if (health)
|
|
167
170
|
normalized.health = health;
|
|
@@ -185,15 +188,15 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
185
188
|
.map((record) => toIndexRecord(record))
|
|
186
189
|
.filter((r) => {
|
|
187
190
|
const vis = r.visibility;
|
|
188
|
-
return vis !==
|
|
191
|
+
return vis !== 'hide' && vis !== 'remove';
|
|
189
192
|
});
|
|
190
193
|
// ── Derive directory stats from the records themselves ──────────
|
|
191
194
|
// Single source of truth for the hero/origin/contributors counts.
|
|
192
195
|
// Pages and components read this from site-config.json so the
|
|
193
196
|
// numbers are guaranteed to match what's actually rendered.
|
|
194
|
-
const projects = indexRecords.filter((r) => r.kind ===
|
|
195
|
-
const resources = indexRecords.filter((r) => r.kind ===
|
|
196
|
-
const entities = indexRecords.filter((r) => r.kind ===
|
|
197
|
+
const projects = indexRecords.filter((r) => r.kind === 'project');
|
|
198
|
+
const resources = indexRecords.filter((r) => r.kind === 'resource');
|
|
199
|
+
const entities = indexRecords.filter((r) => r.kind === 'entity');
|
|
197
200
|
const categories = new Set();
|
|
198
201
|
const stacks = new Set();
|
|
199
202
|
const platforms = new Set();
|
|
@@ -213,21 +216,21 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
213
216
|
for (const p of ps)
|
|
214
217
|
platforms.add(p);
|
|
215
218
|
const gh = r.github;
|
|
216
|
-
if (gh?.fullName && gh.fullName.includes(
|
|
217
|
-
const [owner] = gh.fullName.split(
|
|
219
|
+
if (gh?.fullName && gh.fullName.includes('/')) {
|
|
220
|
+
const [owner] = gh.fullName.split('/');
|
|
218
221
|
if (owner)
|
|
219
222
|
owners.add(owner);
|
|
220
223
|
}
|
|
221
|
-
if (typeof gh?.stars ===
|
|
224
|
+
if (typeof gh?.stars === 'number')
|
|
222
225
|
totalStars += gh.stars;
|
|
223
226
|
}
|
|
224
227
|
// Try to merge in the optional repo-stats.json (origin / source repo).
|
|
225
228
|
// This file is produced by the `sync:repo-stats` workflow, but the
|
|
226
229
|
// generate step must not require it — fallback to a sane empty shape.
|
|
227
|
-
const repoStatsPath = join(outDir,
|
|
230
|
+
const repoStatsPath = join(outDir, 'repo-stats.json');
|
|
228
231
|
let repoStats = {};
|
|
229
232
|
try {
|
|
230
|
-
repoStats = JSON.parse(await readFile(repoStatsPath,
|
|
233
|
+
repoStats = JSON.parse(await readFile(repoStatsPath, 'utf8'));
|
|
231
234
|
}
|
|
232
235
|
catch {
|
|
233
236
|
/* not present — pages render gracefully */
|
|
@@ -254,42 +257,46 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
254
257
|
// Override in `grove.config.ts` via `routes.directory` if you
|
|
255
258
|
// want a custom path that doesn't match the blueprint id.
|
|
256
259
|
routeSlug: cfg.routes?.directory ??
|
|
257
|
-
|
|
258
|
-
project:
|
|
259
|
-
resource:
|
|
260
|
-
entity:
|
|
261
|
-
}[kind] ??
|
|
260
|
+
{
|
|
261
|
+
project: 'projects',
|
|
262
|
+
resource: 'resources',
|
|
263
|
+
entity: 'entities',
|
|
264
|
+
}[kind] ??
|
|
265
|
+
'items',
|
|
262
266
|
itemSlug: cfg.routes?.item ??
|
|
263
|
-
|
|
264
|
-
project:
|
|
265
|
-
resource:
|
|
266
|
-
entity:
|
|
267
|
-
}[kind] ??
|
|
267
|
+
{
|
|
268
|
+
project: 'project',
|
|
269
|
+
resource: 'resource',
|
|
270
|
+
entity: 'entity',
|
|
271
|
+
}[kind] ??
|
|
272
|
+
'item',
|
|
268
273
|
// Human-facing labels (e.g. "Browse projects", "Submit a project").
|
|
269
274
|
labelSingular: cfg.labels?.singular ??
|
|
270
|
-
|
|
271
|
-
project:
|
|
272
|
-
resource:
|
|
273
|
-
entity:
|
|
274
|
-
}[kind] ??
|
|
275
|
+
{
|
|
276
|
+
project: 'project',
|
|
277
|
+
resource: 'resource',
|
|
278
|
+
entity: 'entity',
|
|
279
|
+
}[kind] ??
|
|
280
|
+
'item',
|
|
275
281
|
labelPlural: cfg.labels?.plural ??
|
|
276
|
-
|
|
277
|
-
project:
|
|
278
|
-
resource:
|
|
279
|
-
entity:
|
|
280
|
-
}[kind] ??
|
|
282
|
+
{
|
|
283
|
+
project: 'projects',
|
|
284
|
+
resource: 'resources',
|
|
285
|
+
entity: 'entities',
|
|
286
|
+
}[kind] ??
|
|
287
|
+
'items',
|
|
281
288
|
};
|
|
282
289
|
const taxonomy = {
|
|
283
|
-
categories: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir,
|
|
284
|
-
stacks: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir,
|
|
285
|
-
platforms: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir,
|
|
290
|
+
categories: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir, 'categories.yml'),
|
|
291
|
+
stacks: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir, 'stacks.yml'),
|
|
292
|
+
platforms: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir, 'platforms.yml'),
|
|
286
293
|
// Curated tag vocabulary (data/taxonomy/topics.yml). Optional —
|
|
287
294
|
// older sites without the file simply get an empty list. The
|
|
288
295
|
// browse dropdown filters its Tag facet against this list so
|
|
289
296
|
// arbitrary GitHub topics don't pollute the dropdown.
|
|
290
|
-
topics: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir,
|
|
291
|
-
distributionChannels: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir,
|
|
292
|
-
licenses: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir,
|
|
297
|
+
topics: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir, 'topics.yml'),
|
|
298
|
+
distributionChannels: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir, 'distribution-channels.yml'),
|
|
299
|
+
licenses: await loadTaxonomyFile(cwd, cfg.paths.taxonomyDir, 'licenses.yml'),
|
|
293
300
|
};
|
|
294
301
|
const siteConfigPayload = {
|
|
295
302
|
blueprint: cfg.blueprint,
|
|
@@ -297,8 +304,8 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
297
304
|
name: cfg.site.name,
|
|
298
305
|
tagline: cfg.site.tagline,
|
|
299
306
|
description: cfg.site.description ?? cfg.site.tagline,
|
|
300
|
-
siteUrl: cfg.site.url ??
|
|
301
|
-
repoUrl: cfg.site.repoUrl ??
|
|
307
|
+
siteUrl: cfg.site.url ?? 'https://example.com',
|
|
308
|
+
repoUrl: cfg.site.repoUrl ?? '',
|
|
302
309
|
logo: cfg.site.logo,
|
|
303
310
|
favicon: cfg.site.favicon,
|
|
304
311
|
locale: cfg.site.locale,
|
|
@@ -326,15 +333,13 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
326
333
|
repositoryForks: repoStats.forks ?? 0,
|
|
327
334
|
repositoryContributors: repoStats.contributors ?? 0,
|
|
328
335
|
// origin / source repo — only present when sync:repo-stats has run
|
|
329
|
-
originalRepo: repoStats.originalRepo ??
|
|
330
|
-
originalStars: repoStats.originalRepo ? repoStats.stars ?? 0 : 0,
|
|
331
|
-
originalForks: repoStats.originalRepo ? repoStats.forks ?? 0 : 0,
|
|
332
|
-
originalContributors: repoStats.originalRepo
|
|
333
|
-
? repoStats.contributors ?? 0
|
|
334
|
-
: 0,
|
|
336
|
+
originalRepo: repoStats.originalRepo ?? '',
|
|
337
|
+
originalStars: repoStats.originalRepo ? (repoStats.stars ?? 0) : 0,
|
|
338
|
+
originalForks: repoStats.originalRepo ? (repoStats.forks ?? 0) : 0,
|
|
339
|
+
originalContributors: repoStats.originalRepo ? (repoStats.contributors ?? 0) : 0,
|
|
335
340
|
},
|
|
336
341
|
};
|
|
337
|
-
await writeFile(join(outDir,
|
|
342
|
+
await writeFile(join(outDir, 'site-config.json'), JSON.stringify(siteConfigPayload, null, 2), 'utf8');
|
|
338
343
|
const generatedAt = new Date().toISOString();
|
|
339
344
|
const fullPayload = {
|
|
340
345
|
schemaVersion: 1,
|
|
@@ -351,12 +356,12 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
351
356
|
totalRecords: indexRecords.length,
|
|
352
357
|
records: indexRecords,
|
|
353
358
|
};
|
|
354
|
-
const fullPath = join(outDir,
|
|
355
|
-
const indexPath = join(outDir,
|
|
356
|
-
const aliasPath = join(outDir,
|
|
357
|
-
await writeFile(fullPath, JSON.stringify(fullPayload, null, 2),
|
|
358
|
-
await writeFile(indexPath, JSON.stringify(indexPayload, null, 2),
|
|
359
|
-
await writeFile(aliasPath, JSON.stringify(fullPayload, null, 2),
|
|
359
|
+
const fullPath = join(outDir, 'records.full.json');
|
|
360
|
+
const indexPath = join(outDir, 'records.index.json');
|
|
361
|
+
const aliasPath = join(outDir, 'records.json');
|
|
362
|
+
await writeFile(fullPath, JSON.stringify(fullPayload, null, 2), 'utf8');
|
|
363
|
+
await writeFile(indexPath, JSON.stringify(indexPayload, null, 2), 'utf8');
|
|
364
|
+
await writeFile(aliasPath, JSON.stringify(fullPayload, null, 2), 'utf8');
|
|
360
365
|
return {
|
|
361
366
|
totalRecords: out.length,
|
|
362
367
|
visibleRecords: indexRecords.length,
|
|
@@ -367,7 +372,7 @@ export async function generate(cwd = process.cwd(), config) {
|
|
|
367
372
|
};
|
|
368
373
|
}
|
|
369
374
|
function nameOf(record) {
|
|
370
|
-
if (record.kind ===
|
|
375
|
+
if (record.kind === 'resource')
|
|
371
376
|
return record.title;
|
|
372
377
|
return record.name;
|
|
373
378
|
}
|