Chore: Upgrade to AIK
& Massive Overhaul to internal processing #78
|
@ -48,7 +48,9 @@ import starlightGhostCMS from '@matthiesenxyz/starlight-ghostcms';
|
|||
export default defineConfig({
|
||||
integrations: [
|
||||
starlight({
|
||||
plugins: [starlightGhostCMS()],
|
||||
plugins: [
|
||||
starlightGhostCMS()
|
||||
],
|
||||
title: 'My Docs',
|
||||
}),
|
||||
],
|
||||
|
|
|
@ -30,6 +30,7 @@ export default function starlightGhostCMS(
|
|||
logger,
|
||||
updateConfig: updateStarlightConfig,
|
||||
}) {
|
||||
// Update the Starlight config with the GhostCMS config
|
||||
updateStarlightConfig({
|
||||
social: {
|
||||
...starlightConfig.social,
|
||||
|
@ -57,47 +58,36 @@ export default function starlightGhostCMS(
|
|||
},
|
||||
});
|
||||
|
||||
// Add the Starlight-GhostCMS integration
|
||||
addIntegration({
|
||||
name: "@matthiesenxyz/starlight-ghostcms",
|
||||
hooks: {
|
||||
"astro:config:setup": ({ injectRoute, updateConfig }) => {
|
||||
injectRoute({
|
||||
pattern: "/blog",
|
||||
entrypoint:
|
||||
"@matthiesenxyz/starlight-ghostcms/routes/index.astro",
|
||||
prerender: true,
|
||||
});
|
||||
injectRoute({
|
||||
pattern: "/blog/[slug]",
|
||||
entrypoint:
|
||||
"@matthiesenxyz/starlight-ghostcms/routes/[slug].astro",
|
||||
prerender: true,
|
||||
});
|
||||
injectRoute({
|
||||
pattern: "/blog/about",
|
||||
entrypoint:
|
||||
"@matthiesenxyz/starlight-ghostcms/routes/about.astro",
|
||||
prerender: true,
|
||||
});
|
||||
injectRoute({
|
||||
pattern: "/blog/authors",
|
||||
entrypoint:
|
||||
"@matthiesenxyz/starlight-ghostcms/routes/authors.astro",
|
||||
});
|
||||
injectRoute({
|
||||
pattern: "/rss.xml",
|
||||
entrypoint:
|
||||
"@matthiesenxyz/starlight-ghostcms/routes/rss.xml.ts",
|
||||
});
|
||||
|
||||
updateConfig({
|
||||
vite: {
|
||||
plugins: [vitePluginStarlightGhostConfig(config)],
|
||||
},
|
||||
});
|
||||
|
||||
const makeRoute = (endpoint: string, entrypoint: string) => {
|
||||
injectRoute({
|
||||
pattern: `/${endpoint}`,
|
||||
entrypoint: `@matthiesenxyz/starlight-ghostcms/routes/${entrypoint}`,
|
||||
prerender: true,
|
||||
});
|
||||
};
|
||||
|
||||
makeRoute("blog", "index.astro");
|
||||
makeRoute("blog/[slug]", "[slug].astro");
|
||||
makeRoute("blog/about", "about.astro");
|
||||
makeRoute("blog/authors", "authors.astro");
|
||||
makeRoute("rss.xml", "rss.xml.ts");
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/starlight": "^0.19.0",
|
||||
"astro": "^4.4.0",
|
||||
"astro": "^4.4.1",
|
||||
"vitest": "^1.3.1",
|
||||
"vitest-fetch-mock": "^0.2.2"
|
||||
},
|
||||
|
@ -73,6 +73,6 @@
|
|||
},
|
||||
"peerDependencies": {
|
||||
"@astrojs/starlight": ">=0.19.0",
|
||||
"astro": ">=4.4.0"
|
||||
"astro": ">=4.4.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,12 +6,12 @@ import type { StarlightGhostConfig } from "../schemas/config.ts";
|
|||
export function vitePluginStarlightGhostConfig(
|
||||
config: StarlightGhostConfig,
|
||||
): VitePlugin {
|
||||
const moduleId = "virtual:starlight-ghost-config";
|
||||
const moduleId = 'virtual:starlight-ghostcms/config';
|
||||
const resolvedModuleId = `\0${moduleId}`;
|
||||
const moduleContent = `export default ${JSON.stringify(config)}`;
|
||||
|
||||
return {
|
||||
name: "vite-plugin-starlight-ghost-config",
|
||||
name: "vite-plugin-starlight-ghostcms-config",
|
||||
load(id) {
|
||||
return id === resolvedModuleId ? moduleContent : undefined;
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
import StarlightSidebar from '@astrojs/starlight/components/Sidebar.astro'
|
||||
import type { Props } from '@astrojs/starlight/props'
|
||||
import config from 'virtual:starlight-ghost-config'
|
||||
import config from 'virtual:starlight-ghostcms/config'
|
||||
import { isBlogPostPage, isBlogRoot } from '../utils/page'
|
||||
import { getAllPages, getAllPosts, getSluggedPage } from '../utils/api'
|
||||
import type { SidebarEntry } from './sidebartypes'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
import config from 'virtual:starlight-ghost-config'
|
||||
import config from 'virtual:starlight-ghostcms/config'
|
||||
import { Image } from "astro:assets";
|
||||
import Page from '../components/Page.astro'
|
||||
import { getPageProps } from '../utils/page'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
import config from 'virtual:starlight-ghost-config'
|
||||
import config from 'virtual:starlight-ghostcms/config'
|
||||
import Metadata from '../components/Metadata.astro'
|
||||
import Page from '../components/Page.astro'
|
||||
//import PrevNextLinks from '../components/PrevNextLinks.astro'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
import config from 'virtual:starlight-ghost-config'
|
||||
import config from 'virtual:starlight-ghostcms/config'
|
||||
import Page from '../components/Page.astro'
|
||||
//import PrevNextLinks from '../components/PrevNextLinks.astro'
|
||||
import { getAllAuthors } from '../utils/api'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
//import type { InferGetStaticPropsType } from 'astro'
|
||||
import config from 'virtual:starlight-ghost-config'
|
||||
import config from 'virtual:starlight-ghostcms/config'
|
||||
|
||||
import Page from '../components/Page.astro'
|
||||
import Posts from '../components/Posts.astro'
|
||||
|
|
|
@ -5,7 +5,7 @@ import { getAllPosts, getSettings, invariant } from "../utils/api";
|
|||
const posts = await getAllPosts();
|
||||
const settings = await getSettings();
|
||||
|
||||
import config from "virtual:starlight-ghost-config";
|
||||
import config from "virtual:starlight-ghostcms/config";
|
||||
|
||||
export async function GET({ site }: APIContext) {
|
||||
invariant(settings, "Settings is not defined");
|
||||
|
|
|
@ -3,6 +3,21 @@ import { z } from "astro/zod";
|
|||
|
||||
const configSchema = z
|
||||
.object({
|
||||
/** OPTIONAL - Either set the URL in your .env or put it here
|
||||
* @example
|
||||
* // https://astro.build/config
|
||||
* export default defineConfig({
|
||||
* integrations: [
|
||||
* starlight({
|
||||
* plugins: [
|
||||
* starlightGhost({
|
||||
* ghostURL: "https://ghostdemo.matthiesen.xyz"
|
||||
* })
|
||||
* ],
|
||||
* })
|
||||
* ],
|
||||
* }); */
|
||||
ghostURL: z.string().url("Must be a URL").optional(),
|
||||
/**
|
||||
* The number of blog posts to display per page in the blog post list.
|
||||
*/
|
||||
|
|
|
@ -3,6 +3,7 @@ import type { Page, Post } from "./schemas";
|
|||
|
||||
// LOAD ENVIRONMENT VARIABLES
|
||||
import { loadEnv } from "vite";
|
||||
//import StarlightGhostConfig from "virtual:starlight-ghostcms/config";
|
||||
|
||||
const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
|
||||
"all",
|
||||
|
@ -10,6 +11,9 @@ const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
|
|||
"CONTENT_",
|
||||
);
|
||||
|
||||
|
||||
//const ConfURL = StarlightGhostConfig.ghostURL || "";
|
||||
|
||||
// SETUP GHOST API
|
||||
const ghostApiKey = CONTENT_API_KEY || "";
|
||||
const ghostUrl = CONTENT_API_URL || "";
|
||||
|
|
|
@ -1,29 +1,3 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowUnreachableCode": false,
|
||||
"allowUnusedLabels": false,
|
||||
"esModuleInterop": true,
|
||||
"exactOptionalPropertyTypes": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"incremental": true,
|
||||
"jsx": "react-jsx",
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"verbatimModuleSyntax": true
|
||||
}
|
||||
}
|
||||
"extends": "astro/tsconfigs/strict"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
declare module "virtual:starlight-ghost-config" {
|
||||
const StarlightGhostConfig: import("./src/schemas/config").StarlightGhostConfig;
|
||||
declare module "virtual:starlight-ghostcms/config" {
|
||||
const StarlightGhostConfig: import("./src/schemas/config.ts").StarlightGhostConfig;
|
||||
|
||||
export default StarlightGhostConfig;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ export default defineConfig({
|
|||
title: "My Docs",
|
||||
plugins: [
|
||||
starlightGhostCMS({
|
||||
ghostURL: 'https://ghostdemo.matthiesen.xyz',
|
||||
title: "Demo Blog",
|
||||
rssDescription: "Starlight Playground",
|
||||
}),
|
||||
|
|
|
@ -262,10 +262,10 @@ importers:
|
|||
devDependencies:
|
||||
'@astrojs/starlight':
|
||||
specifier: ^0.19.0
|
||||
version: 0.19.0(astro@4.4.0)
|
||||
version: 0.19.0(astro@4.4.9)
|
||||
astro:
|
||||
specifier: ^4.4.0
|
||||
version: 4.4.0(typescript@5.3.3)
|
||||
specifier: ^4.4.1
|
||||
version: 4.4.9(@types/node@20.11.24)
|
||||
vitest:
|
||||
specifier: ^1.3.1
|
||||
version: 1.3.1(@vitest/ui@1.3.1)
|
||||
|
@ -453,6 +453,33 @@ packages:
|
|||
vfile: 6.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@astrojs/mdx@2.1.1(astro@4.4.9):
|
||||
resolution: {integrity: sha512-AgGFdE7HOGmoFooGvMSatkA9FiSKwyVW7ImHot/bXJ6uAbFfu6iG2ht18Cf1pT22Hda/6iSCGWusFvBv0/EnKQ==}
|
||||
engines: {node: '>=18.14.1'}
|
||||
peerDependencies:
|
||||
astro: ^4.0.0
|
||||
dependencies:
|
||||
'@astrojs/markdown-remark': 4.2.1
|
||||
'@mdx-js/mdx': 3.0.1
|
||||
acorn: 8.11.3
|
||||
astro: 4.4.9(@types/node@20.11.24)
|
||||
es-module-lexer: 1.4.1
|
||||
estree-util-visit: 2.0.0
|
||||
github-slugger: 2.0.0
|
||||
gray-matter: 4.0.3
|
||||
hast-util-to-html: 9.0.0
|
||||
kleur: 4.1.5
|
||||
rehype-raw: 7.0.0
|
||||
remark-gfm: 4.0.0
|
||||
remark-smartypants: 2.1.0
|
||||
source-map: 0.7.4
|
||||
unist-util-visit: 5.0.0
|
||||
vfile: 6.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@astrojs/prism@3.0.0:
|
||||
resolution: {integrity: sha512-g61lZupWq1bYbcBnYZqdjndShr/J3l/oFobBKPA3+qMat146zce3nz2kdO4giGbhYDt4gYdhmoBz0vZJ4sIurQ==}
|
||||
|
@ -499,6 +526,35 @@ packages:
|
|||
vfile: 6.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@astrojs/starlight@0.19.0(astro@4.4.9):
|
||||
resolution: {integrity: sha512-izNZLs99d4AAoN5eV6Ek71SVKEAs8N/GjT+n9J0Q8q1Zgtk/qcv3KzuPXBZmiAbPl/9E2+BG8f4dpdoc+F4U3g==}
|
||||
peerDependencies:
|
||||
astro: ^4.2.7
|
||||
dependencies:
|
||||
'@astrojs/mdx': 2.1.1(astro@4.4.9)
|
||||
'@astrojs/sitemap': 3.1.1
|
||||
'@pagefind/default-ui': 1.0.4
|
||||
'@types/hast': 3.0.4
|
||||
'@types/mdast': 4.0.3
|
||||
astro: 4.4.9(@types/node@20.11.24)
|
||||
astro-expressive-code: 0.32.4(astro@4.4.9)
|
||||
bcp-47: 2.1.0
|
||||
hast-util-select: 6.0.2
|
||||
hastscript: 8.0.0
|
||||
mdast-util-directive: 3.0.0
|
||||
mdast-util-to-markdown: 2.1.0
|
||||
pagefind: 1.0.4
|
||||
rehype: 13.0.1
|
||||
remark-directive: 3.0.0
|
||||
unified: 11.0.4
|
||||
unist-util-remove: 4.0.0
|
||||
unist-util-visit: 5.0.0
|
||||
vfile: 6.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@astrojs/tailwind@5.1.0(astro@4.3.7)(tailwindcss@3.4.1):
|
||||
resolution: {integrity: sha512-BJoCDKuWhU9FT2qYg+fr6Nfb3qP4ShtyjXGHKA/4mHN94z7BGcmauQK23iy+YH5qWvTnhqkd6mQPQ1yTZTe9Ig==}
|
||||
|
@ -2642,6 +2698,17 @@ packages:
|
|||
astro: 4.4.0(typescript@5.3.3)
|
||||
hast-util-to-html: 8.0.4
|
||||
remark-expressive-code: 0.32.4
|
||||
dev: false
|
||||
|
||||
/astro-expressive-code@0.32.4(astro@4.4.9):
|
||||
resolution: {integrity: sha512-/Kq8wLMz0X2gbLWGmPryqEdFV/om/GROsoLtPFqLrLCRD5CpwxXAW185BIGZKf4iYsyJim1vvcpQm5Y9hV5B1g==}
|
||||
peerDependencies:
|
||||
astro: ^3.3.0 || ^4.0.0-beta
|
||||
dependencies:
|
||||
astro: 4.4.9(@types/node@20.11.24)
|
||||
hast-util-to-html: 8.0.4
|
||||
remark-expressive-code: 0.32.4
|
||||
dev: true
|
||||
|
||||
/astro-font@0.0.77:
|
||||
resolution: {integrity: sha512-dh5TX2uxwqdFq15DF9cbRZgEdE9o8q522MP6xZYs+rnd3dexfDsIJMeEIDNVO7rkRxwJ7sphhCqTmdWvUJaiDg==}
|
||||
|
@ -2928,8 +2995,8 @@ packages:
|
|||
tsconfck: 3.0.2(typescript@5.3.3)
|
||||
unist-util-visit: 5.0.0
|
||||
vfile: 6.0.1
|
||||
vite: 5.1.4(@types/node@20.11.24)
|
||||
vitefu: 0.2.5(vite@5.1.4)
|
||||
vite: 5.1.5(@types/node@20.11.24)
|
||||
vitefu: 0.2.5(vite@5.1.5)
|
||||
which-pm: 2.1.1
|
||||
yargs-parser: 21.1.1
|
||||
zod: 3.22.4
|
||||
|
@ -2945,7 +3012,6 @@ packages:
|
|||
- supports-color
|
||||
- terser
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
/astrojs-compiler-sync@0.3.5(@astrojs/compiler@2.5.3):
|
||||
resolution: {integrity: sha512-y420rhIIJ2HHDkYeqKArBHSdJNIIGMztLH90KGIX3zjcJyt/cr9Z2wYA8CP5J1w6KE7xqMh0DAkhfjhNDpQb2Q==}
|
||||
|
@ -8009,7 +8075,17 @@ packages:
|
|||
vite:
|
||||
optional: true
|
||||
dependencies:
|
||||
vite: 5.1.4(@types/node@20.11.24)
|
||||
vite: 5.1.4(sass@1.71.0)
|
||||
|
||||
/vitefu@0.2.5(vite@5.1.5):
|
||||
resolution: {integrity: sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==}
|
||||
peerDependencies:
|
||||
vite: ^3.0.0 || ^4.0.0 || ^5.0.0
|
||||
peerDependenciesMeta:
|
||||
vite:
|
||||
optional: true
|
||||
dependencies:
|
||||
vite: 5.1.5(@types/node@20.11.24)
|
||||
|
||||
/vitest-fetch-mock@0.2.2(vitest@1.3.1):
|
||||
resolution: {integrity: sha512-XmH6QgTSjCWrqXoPREIdbj40T7i1xnGmAsTAgfckoO75W1IEHKR8hcPCQ7SO16RsdW1t85oUm6pcQRLeBgjVYQ==}
|
||||
|
|
Loading…
Reference in New Issue