Skip to content

Commit d1b2165

Browse files
authored
Merge pull request #27 from louisescher/fix/site-usage-options
2 parents 88c1d39 + 3370479 commit d1b2165

34 files changed

+352
-320
lines changed

.changeset/config.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{
2-
"$schema": "../node_modules/@changesets/config/schema.json",
3-
"changelog": ["@changesets/changelog-github", { "repo": "louisescher/astro-webrings" }],
4-
"ignore": ["web"],
5-
"commit": false,
6-
"fixed": [],
7-
"linked": [],
8-
"access": "public",
9-
"baseBranch": "master",
10-
"updateInternalDependencies": "patch"
11-
}
1+
{
2+
"$schema": "../node_modules/@changesets/config/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "louisescher/astro-webrings" }],
4+
"ignore": ["web"],
5+
"commit": false,
6+
"fixed": [],
7+
"linked": [],
8+
"access": "public",
9+
"baseBranch": "master",
10+
"updateInternalDependencies": "patch"
11+
}

biome.json

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
{
2-
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3-
"vcs": {
4-
"enabled": true,
5-
"clientKind": "git",
6-
"useIgnoreFile": true,
7-
"defaultBranch": "main"
8-
},
9-
"files": {
10-
"ignoreUnknown": true,
11-
"includes": ["**", "!**/.astro", "!**/package.json", "!**/dist"]
12-
},
13-
"formatter": {
14-
"lineWidth": 100,
15-
"lineEnding": "lf"
16-
},
17-
"javascript": {
18-
"formatter": {
19-
"quoteStyle": "single",
20-
"trailingCommas": "es5"
21-
}
22-
},
23-
"json": {
24-
"formatter": {
25-
"indentStyle": "space"
26-
}
27-
},
28-
"assist": { "actions": { "source": { "organizeImports": "off" } } },
29-
"linter": {
30-
"enabled": true,
31-
"rules": {
32-
"recommended": true,
33-
"suspicious": {
34-
"noExplicitAny": "warn",
35-
"noImplicitAnyLet": "info",
36-
"noAssignInExpressions": "off"
37-
},
38-
"style": {
39-
"noNonNullAssertion": "off",
40-
"noParameterAssign": "off",
41-
"useSingleVarDeclarator": "info",
42-
"noDescendingSpecificity": "off"
43-
},
44-
"complexity": {
45-
"noForEach": "off",
46-
"noImportantStyles": "off"
47-
}
48-
}
49-
},
50-
"overrides": [
51-
{
52-
"includes": ["**/*.astro"],
53-
"linter": {
54-
"rules": {
55-
"correctness": {
56-
"noUnusedImports": "off",
57-
"noUnusedVariables": "off"
58-
},
59-
"style": {
60-
"useConst": "off",
61-
"useImportType": "off"
62-
}
63-
}
64-
}
65-
}
66-
]
67-
}
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true,
7+
"defaultBranch": "main"
8+
},
9+
"files": {
10+
"ignoreUnknown": true,
11+
"includes": ["**", "!**/.astro", "!**/package.json", "!**/dist"]
12+
},
13+
"formatter": {
14+
"lineWidth": 100,
15+
"lineEnding": "lf"
16+
},
17+
"javascript": {
18+
"formatter": {
19+
"quoteStyle": "single",
20+
"trailingCommas": "es5"
21+
}
22+
},
23+
"json": {
24+
"formatter": {
25+
"indentStyle": "space"
26+
}
27+
},
28+
"assist": { "actions": { "source": { "organizeImports": "off" } } },
29+
"linter": {
30+
"enabled": true,
31+
"rules": {
32+
"recommended": true,
33+
"suspicious": {
34+
"noExplicitAny": "warn",
35+
"noImplicitAnyLet": "info",
36+
"noAssignInExpressions": "off"
37+
},
38+
"style": {
39+
"noNonNullAssertion": "off",
40+
"noParameterAssign": "off",
41+
"useSingleVarDeclarator": "info",
42+
"noDescendingSpecificity": "off"
43+
},
44+
"complexity": {
45+
"noForEach": "off",
46+
"noImportantStyles": "off"
47+
}
48+
}
49+
},
50+
"overrides": [
51+
{
52+
"includes": ["**/*.astro"],
53+
"linter": {
54+
"rules": {
55+
"correctness": {
56+
"noUnusedImports": "off",
57+
"noUnusedVariables": "off"
58+
},
59+
"style": {
60+
"useConst": "off",
61+
"useImportType": "off"
62+
}
63+
}
64+
}
65+
}
66+
]
67+
}

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
"ci:prepublish": "pnpm build",
1717
"ci:install": "pnpm install --frozen-lockfile",
1818
"ci:version": "pnpm changeset version",
19-
"ci:publish": "pnpm changeset publish"
19+
"ci:publish": "pnpm changeset publish",
20+
"lint": "biome lint",
21+
"lint:fix": "biome lint --write",
22+
"format": "biome format",
23+
"format:fix": "biome format --write"
2024
},
2125
"devDependencies": {
2226
"@changesets/changelog-github": "0.5.1",
Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
export type BadgeName = (
2-
'friends-of-houston'
3-
| 'built-with-astro'
4-
)
5-
6-
export type BadgeData = {
7-
name: string;
8-
static: string;
9-
animated?: string;
10-
}
11-
12-
export const badges: Record<BadgeName, BadgeData> = {
13-
'friends-of-houston': {
14-
name: 'Friends of Houston',
15-
static: 'friends-of-houston.webp',
16-
animated: 'friends-of-houston.gif'
17-
},
18-
'built-with-astro': {
19-
name: "Built with Astro",
20-
static: 'built-with-astro.webp'
21-
}
22-
}
1+
export type BadgeName = 'friends-of-houston' | 'built-with-astro';
2+
3+
export type BadgeData = {
4+
name: string;
5+
static: string;
6+
animated?: string;
7+
};
8+
9+
export const badges: Record<BadgeName, BadgeData> = {
10+
'friends-of-houston': {
11+
name: 'Friends of Houston',
12+
static: 'friends-of-houston.webp',
13+
animated: 'friends-of-houston.gif',
14+
},
15+
'built-with-astro': {
16+
name: 'Built with Astro',
17+
static: 'built-with-astro.webp',
18+
},
19+
};

packages/astro-webrings/src/components/Badge.astro

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
import { Image } from "astro:assets";
3-
import type { HTMLAttributes } from "astro/types";
4-
import { badges } from "../badges.js";
2+
import { Image } from 'astro:assets';
3+
import type { HTMLAttributes } from 'astro/types';
4+
import { badges } from '../badges.js';
55
66
interface Props extends HTMLAttributes<'a'> {
77
site: string;
@@ -12,7 +12,9 @@ interface Props extends HTMLAttributes<'a'> {
1212
1313
const { site, ring, animated = false, imageOverride, ...props } = Astro.props;
1414
15-
const images = import.meta.glob<{ default: ImageMetadata }>('../images/*.{png,jpg,jpeg,webp,gif}', { eager: true });
15+
const images = import.meta.glob<{ default: ImageMetadata }>('../images/*.{png,jpg,jpeg,webp,gif}', {
16+
eager: true,
17+
});
1618
const imageKeys = Object.keys(images);
1719
1820
const badge = badges[ring];
@@ -28,7 +30,7 @@ if (!badgeImageName) throw new Error(unknownImageError);
2830
const badgeImageKey = imageKeys.find((key) => key.endsWith(badgeImageName));
2931
if (!badgeImageKey) throw new Error(unknownImageError);
3032
---
31-
{/* Weird ormatting here is needed so no spaces are shown between multiple images. */}
33+
{/* Weird formatting here is needed so no spaces are shown between multiple images. */}
3234
<a
3335
{...props}
3436
href={`https://astro-webrings.lou.gg/next?site=${site}&ring=${ring}`}
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
{
2-
"$schema": "https://json.schemastore.org/tsconfig",
3-
"include": ["src"],
4-
"exclude": ["./dist"],
5-
"compilerOptions": {
6-
"outDir": "./dist",
7-
"rootDir": "./src",
8-
"declaration": true,
9-
"emitDeclarationOnly": true,
10-
"strict": true,
11-
"moduleResolution": "bundler",
12-
"target": "ESNext",
13-
"module": "ESNext",
14-
"esModuleInterop": true,
15-
"skipLibCheck": true,
16-
"verbatimModuleSyntax": true,
17-
"stripInternal": true
18-
}
19-
}
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"include": ["src"],
4+
"exclude": ["./dist"],
5+
"compilerOptions": {
6+
"outDir": "./dist",
7+
"rootDir": "./src",
8+
"declaration": true,
9+
"emitDeclarationOnly": true,
10+
"strict": true,
11+
"moduleResolution": "bundler",
12+
"target": "ESNext",
13+
"module": "ESNext",
14+
"esModuleInterop": true,
15+
"skipLibCheck": true,
16+
"verbatimModuleSyntax": true,
17+
"stripInternal": true
18+
}
19+
}

packages/web/astro.config.mjs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
// @ts-check
22
import { defineConfig, fontProviders } from 'astro/config';
33

4-
import node from "@astrojs/node";
4+
import node from '@astrojs/node';
55

66
// https://astro.build/config
77
export default defineConfig({
8-
site: "https://astro-webrings.lou.gg",
8+
site: 'https://astro-webrings.lou.gg',
99

10-
experimental: {
11-
fonts: [{
12-
cssVariable: "--font-inter",
13-
name: "Inter",
14-
provider: fontProviders.google(),
15-
fallbacks: ["Helvetica", "sans-serif"],
16-
display: "swap",
17-
subsets: ["latin"],
18-
weights: [400, 700]
19-
}]
10+
experimental: {
11+
fonts: [
12+
{
13+
cssVariable: '--font-inter',
14+
name: 'Inter',
15+
provider: fontProviders.google(),
16+
fallbacks: ['Helvetica', 'sans-serif'],
17+
display: 'swap',
18+
subsets: ['latin'],
19+
weights: [400, 700],
20+
},
21+
],
2022
},
2123

22-
adapter: node({
23-
mode: "standalone"
24-
})
24+
adapter: node({
25+
mode: 'standalone',
26+
}),
2527
});

packages/web/src/content.config.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,38 @@ import { defineCollection, z } from 'astro:content';
22
import { glob, file } from 'astro/loaders';
33

44
export const webringSchema = z.object({
5-
name: z.string().min(1, { message: "Site name has to be at least one character long!" }),
6-
id: z.string().min(1, { message: "Site slug has to be at least one character long!" }).refine((slug) => {
7-
const slugMatcher = /[a-z0-9-_.]/;
5+
name: z.string().min(1, { message: 'Site name has to be at least one character long!' }),
6+
id: z
7+
.string()
8+
.min(1, { message: 'Site slug has to be at least one character long!' })
9+
.refine((slug) => {
10+
const slugMatcher = /[a-z0-9-_.]/;
811

9-
if (slugMatcher.test(slug)) return true;
12+
if (slugMatcher.test(slug)) return true;
1013

11-
return "Slug must be in all lowercase and include only numbers, letters from a-z, hyphens, dots and underscores.";
12-
}),
13-
url: z.string().url({ message: "Site url must be valid" })
14+
return 'Slug must be in all lowercase and include only numbers, letters from a-z, hyphens, dots and underscores.';
15+
}),
16+
url: z.string().url({ message: 'Site url must be valid' }),
1417
});
1518

1619
const webring_friendsOfHouston = defineCollection({
17-
loader: glob({ pattern: "*.json", base: "./src/content/rings/friends-of-houston" }),
18-
schema: webringSchema
20+
loader: glob({ pattern: '*.json', base: './src/content/rings/friends-of-houston' }),
21+
schema: webringSchema,
1922
});
2023

2124
const webring_builtWithAstro = defineCollection({
22-
loader: glob({ pattern: "*.json", base: "./src/content/rings/built-with-astro" }),
23-
schema: webringSchema
25+
loader: glob({ pattern: '*.json', base: './src/content/rings/built-with-astro' }),
26+
schema: webringSchema,
2427
});
2528

2629
const webrings = defineCollection({
27-
loader: file("src/content/rings/rings.json"),
30+
loader: file('src/content/rings/rings.json'),
2831
schema: z.object({
29-
collection: z.string().min(1, { message: "Webring collection name needs to be at least one character long!" }),
30-
slug: z.string().min(1, { message: "Webring slug needs to be at least one character long!" }),
31-
})
32+
collection: z
33+
.string()
34+
.min(1, { message: 'Webring collection name needs to be at least one character long!' }),
35+
slug: z.string().min(1, { message: 'Webring slug needs to be at least one character long!' }),
36+
}),
3237
});
3338

3439
export const collections = {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "Dominic Brauer",
3-
"id": "dominicbrauer.dev",
4-
"url": "https://dominicbrauer.dev"
2+
"name": "Dominic Brauer",
3+
"id": "dominicbrauer.dev",
4+
"url": "https://dominicbrauer.dev"
55
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "eunoia",
3-
"id": "eunoia-sayitditto",
4-
"url": "https://eunoia.sayitditto.net"
2+
"name": "eunoia",
3+
"id": "eunoia-sayitditto",
4+
"url": "https://eunoia.sayitditto.net"
55
}

0 commit comments

Comments
 (0)