Skip to content

Commit 1e2e5f4

Browse files
committed
style(format): format source
1 parent e8969bc commit 1e2e5f4

File tree

9 files changed

+267
-5183
lines changed

9 files changed

+267
-5183
lines changed

package-lock.json

Lines changed: 0 additions & 4955 deletions
This file was deleted.

pnpm-lock.yaml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/astro.config.mjs

Lines changed: 169 additions & 148 deletions
Large diffs are not rendered by default.

site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"@astrojs/check": "^0.9.6",
66
"@astrojs/starlight": "^0.37.4",
77
"astro": "^5.16.16",
8+
"rehype-external-links": "^3.0.0",
89
"satori-astro": "^0.3.3",
910
"satori-html": "^0.3.2",
1011
"sharp": "^0.34.5",

site/src/components/Head.astro

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
import StarlightHead from "@astrojs/starlight/components/Head.astro";
3-
import { buildSchemas } from "../lib/schema";
2+
import StarlightHead from '@astrojs/starlight/components/Head.astro';
3+
import { buildSchemas } from '../lib/schema';
44
5-
const siteUrl = "https://jamiemason.github.io";
5+
const siteUrl = 'https://jamiemason.github.io';
66
77
// Access the page ID from Starlight's route data
8-
const pageId = Astro.locals.starlightRoute?.id || "";
8+
const pageId = Astro.locals.starlightRoute?.id || '';
99
1010
// Use dynamic OG image for docs pages, fallback to static for FAQ pages
11-
let ogImagePath = "/syncpack/social-card.jpg";
12-
if (pageId === "") {
11+
let ogImagePath = '/syncpack/social-card.jpg';
12+
if (pageId === '') {
1313
// Homepage - use index.png
14-
ogImagePath = "/syncpack/og/index.png";
15-
} else if (pageId && !pageId.startsWith("faq")) {
14+
ogImagePath = '/syncpack/og/index.png';
15+
} else if (pageId && !pageId.startsWith('faq')) {
1616
// Other docs pages
1717
ogImagePath = `/syncpack/og/${pageId}.png`;
1818
}

site/src/lib/schema.ts

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { siteConfig } from "./siteConfig";
1+
import { siteConfig } from './siteConfig';
22

33
type StarlightRouteData = any;
44

@@ -10,7 +10,7 @@ type StarlightRouteData = any;
1010
export function buildSchemas(route: StarlightRouteData) {
1111
const schemas: Record<string, any>[] = [];
1212

13-
const isHomepage = route.id === "";
13+
const isHomepage = route.id === '';
1414
const isDocPage = !isHomepage;
1515

1616
if (isHomepage) {
@@ -34,8 +34,8 @@ export function buildSchemas(route: StarlightRouteData) {
3434
*/
3535
function buildWebSiteSchema() {
3636
return {
37-
"@context": "https://schema.org",
38-
"@type": "WebSite",
37+
'@context': 'https://schema.org',
38+
'@type': 'WebSite',
3939
name: siteConfig.siteName,
4040
url: siteConfig.siteUrl,
4141
};
@@ -47,14 +47,14 @@ function buildWebSiteSchema() {
4747
*/
4848
function buildPersonSchema() {
4949
return {
50-
"@context": "https://schema.org",
51-
"@type": "Person",
50+
'@context': 'https://schema.org',
51+
'@type': 'Person',
5252
name: siteConfig.authorName,
5353
url: siteConfig.authorUrl,
5454
image: siteConfig.authorImage,
5555
sameAs: siteConfig.authorSocial,
5656
funding: {
57-
"@type": "MonetaryGrant",
57+
'@type': 'MonetaryGrant',
5858
url: siteConfig.sponsorUrl,
5959
},
6060
};
@@ -66,16 +66,16 @@ function buildPersonSchema() {
6666
*/
6767
function buildSoftwareApplicationSchema() {
6868
return {
69-
"@context": "https://schema.org",
70-
"@type": "SoftwareApplication",
69+
'@context': 'https://schema.org',
70+
'@type': 'SoftwareApplication',
7171
name: siteConfig.siteName,
7272
description: siteConfig.softwareDescription,
7373
url: siteConfig.siteUrl,
7474
image: siteConfig.logoUrl,
75-
applicationCategory: "DeveloperApplication",
76-
operatingSystem: ["Linux", "macOS", "Windows"],
75+
applicationCategory: 'DeveloperApplication',
76+
operatingSystem: ['Linux', 'macOS', 'Windows'],
7777
author: {
78-
"@type": "Person",
78+
'@type': 'Person',
7979
name: siteConfig.authorName,
8080
url: siteConfig.authorUrl,
8181
},
@@ -92,10 +92,10 @@ function buildBreadcrumbSchema(route: StarlightRouteData) {
9292
const breadcrumbs = generateBreadcrumbs(route.slug);
9393

9494
return {
95-
"@context": "https://schema.org",
96-
"@type": "BreadcrumbList",
95+
'@context': 'https://schema.org',
96+
'@type': 'BreadcrumbList',
9797
itemListElement: breadcrumbs.map((item, i) => ({
98-
"@type": "ListItem",
98+
'@type': 'ListItem',
9999
position: i + 1,
100100
name: item.name,
101101
item: `${siteConfig.siteUrl}${item.url}`,
@@ -109,36 +109,35 @@ function buildBreadcrumbSchema(route: StarlightRouteData) {
109109
*/
110110
function buildArticleSchema(route: StarlightRouteData) {
111111
const { data } = route.entry;
112-
const title = data.title || "Syncpack Documentation";
112+
const title = data.title || 'Syncpack Documentation';
113113
const description = data.description || siteConfig.description;
114114

115115
// Starlight provides lastUpdated from Git when lastUpdated: true in config
116-
const dateModified =
117-
data.lastUpdated?.toISOString() || new Date().toISOString();
116+
const dateModified = data.lastUpdated?.toISOString() || new Date().toISOString();
118117

119118
// Use the OG image for this specific page
120119
const ogImageUrl = `${siteConfig.siteUrl}/og/${route.id}.png`;
121120

122121
return {
123-
"@context": "https://schema.org",
124-
"@type": "Article",
122+
'@context': 'https://schema.org',
123+
'@type': 'Article',
125124
headline: title,
126125
description: description,
127126
datePublished: dateModified, // Use same as modified for docs
128127
dateModified: dateModified,
129128
author: {
130-
"@type": "Person",
129+
'@type': 'Person',
131130
name: siteConfig.authorName,
132131
url: siteConfig.authorUrl,
133132
},
134133
publisher: {
135-
"@type": "Person",
134+
'@type': 'Person',
136135
name: siteConfig.authorName,
137136
url: siteConfig.authorUrl,
138137
image: siteConfig.authorImage,
139138
},
140139
image: ogImageUrl,
141-
inLanguage: "en",
140+
inLanguage: 'en',
142141
};
143142
}
144143

@@ -151,12 +150,12 @@ function buildArticleSchema(route: StarlightRouteData) {
151150
* - Getting Started → /syncpack/guide/getting-started/
152151
*/
153152
function generateBreadcrumbs(slug: string) {
154-
const breadcrumbs = [{ name: "Docs", url: "/" }];
153+
const breadcrumbs = [{ name: 'Docs', url: '/' }];
155154

156-
const parts = slug.split("/").filter(Boolean);
157-
let currentPath = "";
155+
const parts = slug.split('/').filter(Boolean);
156+
let currentPath = '';
158157

159-
parts.forEach((part) => {
158+
parts.forEach(part => {
160159
currentPath += `/${part}`;
161160
breadcrumbs.push({
162161
name: titleCase(part),
@@ -174,7 +173,7 @@ function generateBreadcrumbs(slug: string) {
174173
*/
175174
function titleCase(str: string) {
176175
return str
177-
.split("-")
178-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
179-
.join(" ");
176+
.split('-')
177+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
178+
.join(' ');
180179
}

site/src/lib/siteConfig.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
* These values are used across all schema builders to ensure consistency.
55
*/
66
export const siteConfig = {
7-
siteName: "Syncpack",
8-
siteUrl: "https://jamiemason.github.io/syncpack",
9-
description: "Consistent dependency versions in large JavaScript Monorepos",
7+
siteName: 'Syncpack',
8+
siteUrl: 'https://jamiemason.github.io/syncpack',
9+
description: 'Consistent dependency versions in large JavaScript Monorepos',
1010
softwareDescription:
11-
"CLI for managing dependency versions in JavaScript monorepos. Used by AWS, Cloudflare, DataDog, Electron, Microsoft, Vercel, and others.",
12-
logoUrl: "https://jamiemason.github.io/syncpack/logo.svg",
13-
npmUrl: "https://www.npmjs.com/package/syncpack",
14-
githubUrl: "https://github.com/JamieMason/syncpack",
15-
authorName: "Jamie Mason",
16-
authorUrl: "https://github.com/JamieMason",
17-
authorImage: "https://avatars.githubusercontent.com/u/320492?v=4",
11+
'CLI for managing dependency versions in JavaScript monorepos. Used by AWS, Cloudflare, DataDog, Electron, Microsoft, Vercel, and others.',
12+
logoUrl: 'https://jamiemason.github.io/syncpack/logo.svg',
13+
npmUrl: 'https://www.npmjs.com/package/syncpack',
14+
githubUrl: 'https://github.com/JamieMason/syncpack',
15+
authorName: 'Jamie Mason',
16+
authorUrl: 'https://github.com/JamieMason',
17+
authorImage: 'https://avatars.githubusercontent.com/u/320492?v=4',
1818
authorSocial: [
19-
"https://github.com/JamieMason",
20-
"https://bsky.app/profile/foldleft.bsky.social",
21-
"http://uk.linkedin.com/in/jamiemasonleeds",
22-
"https://twitter.com/fold_left",
19+
'https://github.com/JamieMason',
20+
'https://bsky.app/profile/foldleft.bsky.social',
21+
'http://uk.linkedin.com/in/jamiemasonleeds',
22+
'https://twitter.com/fold_left',
2323
],
24-
sponsorUrl: "https://github.com/sponsors/JamieMason",
24+
sponsorUrl: 'https://github.com/sponsors/JamieMason',
2525
} as const;

site/src/pages/faq.astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
import { getCollection, render } from "astro:content";
3-
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
4-
import Question from "@components/question.astro";
2+
import { getCollection, render } from 'astro:content';
3+
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
4+
import Question from '@components/question.astro';
55
6-
const files = await getCollection("faq");
6+
const files = await getCollection('faq');
77
const faqs = await Promise.all(
8-
files.map(async (faq) => ({
8+
files.map(async faq => ({
99
Answer: (await render(faq)).Content,
1010
faq,
1111
slug: faq.id,

site/src/route-data.ts

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
1-
import { defineRouteMiddleware } from "@astrojs/starlight/route-data";
1+
import { defineRouteMiddleware } from '@astrojs/starlight/route-data';
22

33
// Build custom title with breadcrumb structure
44
function getCustomTitle(route: any): string {
5-
if (!route) return "Syncpack";
5+
if (!route) return 'Syncpack';
66

77
// Homepage special case
8-
if (route.id === "") {
9-
return "Consistent dependency versions in JavaScript Monorepos | Syncpack";
8+
if (route.id === '') {
9+
return 'Consistent dependency versions in JavaScript Monorepos | Syncpack';
1010
}
1111

1212
const pageTitle = route.entry.data.title;
1313

1414
// Special case: Status Codes overview page (reference/status-codes with slug: status)
1515
// Title is "Status Codes" so avoid duplicate
16-
if (
17-
route.id === "reference/status-codes" ||
18-
(route.slug === "status" && pageTitle === "Status Codes")
19-
) {
16+
if (route.id === 'reference/status-codes' || (route.slug === 'status' && pageTitle === 'Status Codes')) {
2017
return `${pageTitle} | Syncpack`;
2118
}
2219

2320
// Map directory to sidebar label
2421
const categoryMap: Record<string, string> = {
25-
command: "Commands",
26-
"version-groups": "Version Groups",
27-
"semver-groups": "Semver Groups",
28-
config: "Configuration File",
29-
reference: "Reference",
30-
guide: "Guides",
31-
status: "Status Codes",
22+
command: 'Commands',
23+
'version-groups': 'Version Groups',
24+
'semver-groups': 'Semver Groups',
25+
config: 'Configuration File',
26+
reference: 'Reference',
27+
guide: 'Guides',
28+
status: 'Status Codes',
3229
};
3330

34-
const parts = route.id.split("/");
31+
const parts = route.id.split('/');
3532

3633
if (parts.length >= 1) {
3734
const category = categoryMap[parts[0]];
@@ -43,13 +40,13 @@ function getCustomTitle(route: any): string {
4340
return `${pageTitle} | Syncpack`;
4441
}
4542

46-
export const onRequest = defineRouteMiddleware((context) => {
43+
export const onRequest = defineRouteMiddleware(context => {
4744
const route = context.locals.starlightRoute;
4845

4946
// Update sitemap href
50-
route.head.some((item) => {
51-
if (item.attrs?.rel === "sitemap") {
52-
item.attrs.href = "/syncpack/sitemap.xml";
47+
route.head.some(item => {
48+
if (item.attrs?.rel === 'sitemap') {
49+
item.attrs.href = '/syncpack/sitemap.xml';
5350
return true;
5451
}
5552
return false;
@@ -59,11 +56,11 @@ export const onRequest = defineRouteMiddleware((context) => {
5956
const customTitle = getCustomTitle(route);
6057

6158
// Remove existing title tag(s) from head
62-
route.head = route.head.filter((item) => item.tag !== "title");
59+
route.head = route.head.filter(item => item.tag !== 'title');
6360

6461
// Add our custom title tag
6562
route.head.push({
66-
tag: "title",
63+
tag: 'title',
6764
content: customTitle,
6865
});
6966
});

0 commit comments

Comments
 (0)