Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
pull_request:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
name: Lint, format, typecheck, build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm

- name: Install dependencies
run: npm ci

- name: Format check
run: npm run format:check

- name: Lint
run: npm run lint:ci

- name: Workspace consistency
run: npm run sherif

- name: Typecheck
run: npm run typecheck

- name: Build
run: npm run build
2 changes: 1 addition & 1 deletion astro-alt-text-toolkit/__example__/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "example",
"type": "module",
"version": "0.0.1",
"private": "true",
"type": "module",
"scripts": {
"dev": "astro dev",
"build": "astro build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const getPathToAltTextMap = (
},
altTextModules: {
[originalPath: string]: string;
}
},
) => {
const pathToAltTextMap = new Map<string, string>();
for (const [originalPath, module] of Object.entries(imageModules)) {
Expand All @@ -58,7 +58,7 @@ const getFinalSrc = async (image: typeof Astro.props.src) => {

const finalPathToAltTextMap = getPathToAltTextMap(
imageModules as any,
altTextModules as any
altTextModules as any,
);

const alt =
Expand Down
49 changes: 25 additions & 24 deletions astro-alt-text-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
{
"name": "@fujocoded/astro-alt-text-toolkit",
"version": "0.0.1",
"private": true,
"description": "",
"main": "dist/index.js",
"keywords": [
"astro",
"astro-integration",
"withastro"
],
"homepage": "https://github.com/FujoWebDev/fujocoded-plugins#readme",
"bugs": {
"url": "https://github.com/FujoWebDev/fujocoded-plugins/issues"
},
"license": "MIT",
"author": "FujoCoded LLC",
"repository": {
"type": "git",
"url": "git+https://github.com/FujoWebDev/fujocoded-plugins.git"
},
"files": [
"dist",
"LICENSE",
"README.md",
"package.json"
],
"type": "module",
"private": true,
"main": "dist/index.js",
"exports": {
".": {
"import": {
Expand All @@ -13,33 +34,13 @@
}
}
},
"files": [
"dist",
"LICENSE",
"README.md",
"package.json"
],
"scripts": {
"build": "tsdown",
"dev": "tsdown --watch",
"validate": "npx publint",
"test": "vitest"
"test": "vitest",
"typecheck": "tsc --noEmit"
},
"repository": {
"type": "git",
"url": "git+https://github.com/FujoWebDev/fujocoded-plugins.git"
},
"keywords": [
"astro",
"withastro",
"astro-integration"
],
"author": "FujoCoded LLC",
"license": "MIT",
"bugs": {
"url": "https://github.com/FujoWebDev/fujocoded-plugins/issues"
},
"homepage": "https://github.com/FujoWebDev/fujocoded-plugins#readme",
"dependencies": {},
"devDependencies": {
"tsdown": "^0.14.1"
Expand Down
6 changes: 4 additions & 2 deletions astro-alt-text-toolkit/src/_image-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ const imageService: LocalImageService<AstroConfig["image"]> = {
};

Object.entries(params).forEach(([param, key]) => {
options[key] && searchParams.append(param, options[key].toString());
if (options[key]) {
searchParams.append(param, options[key].toString());
}
});

const imageEndpoint = path.join(
import.meta.env.BASE_URL,
imageConfig.endpoint.route
imageConfig.endpoint.route,
);
return `${imageEndpoint}?${searchParams}`;
},
Expand Down
6 changes: 3 additions & 3 deletions astro-alt-text-toolkit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ const showAltTextPopup = (image: HTMLElement) => {
dialog.open = false;
}
},
{ signal }
{ signal },
);
dialog.addEventListener(
"close",
() => {
dialog.remove();
controller.abort();
},
{ signal }
{ signal },
);
};

const images = Array.from(
document.querySelectorAll<HTMLImageElement>(`img[alt]:not(img[alt=""])`)
document.querySelectorAll<HTMLImageElement>(`img[alt]:not(img[alt=""])`),
);
for (const image of images) {
addBadgeToImage(image);
Expand Down
4 changes: 2 additions & 2 deletions astro-alt-text-toolkit/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"declaration": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"types": ["./src/types.d.ts"]
"types": ["vite/client"]
},
"include": ["./src/types.d.ts"],
"include": ["./src/**/*"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion astro-ao3-loader/__examples__/works-list/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
import { defineConfig } from 'astro/config';
import { defineConfig } from "astro/config";

// https://astro.build/config
export default defineConfig({});
8 changes: 4 additions & 4 deletions astro-ao3-loader/__examples__/works-list/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "astro-5",
"type": "module",
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"astro": "^5.16.9",
"@fujocoded/astro-ao3-loader": "file:../.."
"@fujocoded/astro-ao3-loader": "file:../..",
"astro": "^5.16.9"
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- 1728802
- 1728802
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
- 41160522
- 11728554
- 12928950
- 58869805
- 58869805
43 changes: 22 additions & 21 deletions astro-ao3-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
{
"name": "@fujocoded/astro-ao3-loader",
"type": "module",
"version": "0.0.4",
"description": "Allows loading a series of AO3 works for the Astro Content Layer",
"keywords": [
"astro-loader",
"withastro"
],
"license": "MIT",
"author": "FujoCoded LLC",
"repository": {
"type": "git",
"url": "git+https://github.com/FujoWebDev/fujocoded-plugins.git"
},
"files": [
"dist",
"LICENSE",
"README.md",
"package.json"
],
"type": "module",
"module": "dist/index.mjs",
"exports": {
".": {
Expand All @@ -12,26 +28,14 @@
}
}
},
"files": [
"dist",
"LICENSE",
"README.md",
"package.json"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsdown",
"dev": "tsdown --watch src/",
"validate": "npx publint"
},
"keywords": [
"withastro",
"astro-loader"
],
"author": "FujoCoded LLC",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/FujoWebDev/fujocoded-plugins.git"
"validate": "npx publint",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@fujocoded/ao3.js": "^0.23.1",
Expand All @@ -46,8 +50,5 @@
"peerDependencies": {
"astro": "^5.0.0",
"zod": "^3.0.0 || ^4.0.0"
},
"publishConfig": {
"access": "public"
}
}
5 changes: 3 additions & 2 deletions astro-ao3-loader/src/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ const createFetcher = (logger: LoaderContext["logger"]) => {
init?: RequestInit,
): Promise<Response> => {
// We skip the queue if the response is already cached
if (RESPONSE_CACHE.has(input.toString())) {
return RESPONSE_CACHE.get(input.toString())!;
const cacheKey = JSON.stringify(input);
if (RESPONSE_CACHE.has(cacheKey)) {
return RESPONSE_CACHE.get(cacheKey)!;
}
return await queue.add(async () => await client(input, init));
};
Expand Down
4 changes: 2 additions & 2 deletions astro-ao3-loader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { parse } from "yaml";
import type { Loader, LoaderContext } from "astro/loaders";
import { z } from "zod";
import { getFetcher } from "./fetcher.ts";
import { getProgressTracker} from "./logger.ts";
import { getProgressTracker } from "./logger.ts";

/**
* Loads items of the given "type" from the specified file ("yamlPath"). This uses the "itemFetcher"
* function to fetch items from Archive of Our Own.
**/
**/
const loadItems = async <T extends { id: string | number }>(
{ store, logger }: LoaderContext,
config: {
Expand Down
3 changes: 1 addition & 2 deletions astro-ao3-loader/src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import type { LoaderContext } from "astro/loaders";

const PROGRESS_INTERVAL_MS = 15 * 1000; // 15 seconds
Expand Down Expand Up @@ -64,7 +63,7 @@ export const getProgressTracker = ({
failCount++;
log();
logger.error(
`${prefix} Failed to fetch ${itemsType.slice(0, -1)} ${id}: ${error}`,
`${prefix} Failed to fetch ${itemsType.slice(0, -1)} ${id}: ${String(error)}`,
);
},
finish: () => {
Expand Down
4 changes: 3 additions & 1 deletion astro-ao3-loader/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@
"declaration": true,
"allowImportingTsExtensions": true,
"noEmit": true
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "__examples__", "__tests__"]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "examples-atproto-static-posts",
"type": "module",
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "astro dev",
"build": "astro build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const fetchBlueskyPost = async (
uri: string,
): Promise<BlueskyPost | undefined> => {
const res = await fetch(
`https://public.api.bsky.app/xrpc/app.bsky.feed.getPosts?uris=${encodeURIComponent(
uri,
)}`,
`https://public.api.bsky.app/xrpc/app.bsky.feed.getPosts?uris=${encodeURIComponent(uri)}`,
);
if (!res.ok) return undefined;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "examples-atproto-live-events",
"type": "module",
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "astro dev --host 127.0.0.1",
"build": "astro build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const fetchBlueskyPost = async (
uri: string,
): Promise<BlueskyPost | undefined> => {
const res = await fetch(
`https://public.api.bsky.app/xrpc/app.bsky.feed.getPosts?uris=${encodeURIComponent(
uri,
)}`,
`https://public.api.bsky.app/xrpc/app.bsky.feed.getPosts?uris=${encodeURIComponent(uri)}`,
);
if (!res.ok) return undefined;

Expand Down
Loading