pnpm monorepo migration complete
This commit is contained in:
parent
aa794e4443
commit
c6ec669b36
|
@ -0,0 +1,11 @@
|
||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "npm" # See documentation for possible values
|
||||||
|
directory: "/" # Location of package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
|
@ -1,24 +1 @@
|
||||||
# build output
|
node_modules
|
||||||
dist
|
|
||||||
.vercel
|
|
||||||
# generated types
|
|
||||||
.astro/
|
|
||||||
# dependencies
|
|
||||||
node_modules/
|
|
||||||
.snowpack/
|
|
||||||
|
|
||||||
# logs
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
|
|
||||||
# environment variables
|
|
||||||
.env
|
|
||||||
.env.production
|
|
||||||
|
|
||||||
# macOS-specific files
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# editor
|
|
||||||
.idea
|
|
||||||
package-lock.json
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"editor.defaultFormatter": "biomejs.biome"
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
- [ ] Update all `TODO:`
|
||||||
|
- [ ] Update all `package-name` occurences
|
||||||
|
- [ ] Add a LICENSE.md at the root
|
||||||
|
- [ ] Have gh cli installed
|
||||||
|
- [ ] Work on the integration logic
|
||||||
|
- [ ] Work on docs
|
||||||
|
- [ ] JSDoc
|
||||||
|
- [ ] Package README
|
||||||
|
- [ ] Format/lint (`pnpm lint:fix`)
|
||||||
|
- [ ] Setup GitHub repository
|
||||||
|
- [ ] Release (see below)
|
||||||
|
- [ ] Share!
|
||||||
|
|
||||||
|
To create a release:
|
||||||
|
- [ ] `pnpm run changeset`
|
||||||
|
- [ ] Commit and push
|
||||||
|
- [ ] `pnpm release`
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://biomejs.dev/schemas/1.5.2/schema.json",
|
||||||
|
"organizeImports": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"linter": {
|
||||||
|
"enabled": true,
|
||||||
|
"rules": {
|
||||||
|
"recommended": true,
|
||||||
|
"suspicious": {
|
||||||
|
"noExplicitAny": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": {
|
||||||
|
"ignore": ["dist", ".astro"]
|
||||||
|
}
|
||||||
|
}
|
84
package.json
84
package.json
|
@ -1,79 +1,17 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/astro-ghostcms",
|
"name": "root",
|
||||||
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
|
"private": true,
|
||||||
"version": "2.1.8",
|
"packageManager": "pnpm@8.14.1",
|
||||||
"author": "MatthiesenXYZ (https://matthiesen.xyz)",
|
"engines": {
|
||||||
"type": "module",
|
"node": ">=18.19.0"
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/MatthiesenXYZ/astro-ghostcms.git"
|
|
||||||
},
|
},
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/MatthiesenXYZ/astro-ghostcms/issues",
|
|
||||||
"email": "issues@astro-ghostcms.xyz"
|
|
||||||
},
|
|
||||||
"homepage": "https://astro-ghostcms.xyz/",
|
|
||||||
"exports": {
|
|
||||||
".": "./index.ts",
|
|
||||||
"./api": "./src/api/index.ts",
|
|
||||||
"./index.astro": "./src/theme/routes/index.astro",
|
|
||||||
"./404.astro": "./src/theme/routes/404.astro",
|
|
||||||
"./[slug].astro": "./src/theme/routes/[slug].astro",
|
|
||||||
"./tags.astro": "./src/theme/routes/tags.astro",
|
|
||||||
"./authors.astro": "./src/theme/routes/authors.astro",
|
|
||||||
"./tag/[slug].astro": "./src/theme/routes/tag/[slug].astro",
|
|
||||||
"./author/[slug].astro": "./src/theme/routes/author/[slug].astro",
|
|
||||||
"./archives/[...page].astro": "./src/theme/routes/archives/[...page].astro",
|
|
||||||
"./rss.xml.js": "./src/theme/routes/rss.xml.js"
|
|
||||||
},
|
|
||||||
"main": "index.ts",
|
|
||||||
"types": "src/api/tryghost-content-api.d.ts",
|
|
||||||
"files": [
|
|
||||||
"src",
|
|
||||||
"index.ts"
|
|
||||||
],
|
|
||||||
"keywords": [
|
|
||||||
"astro-component",
|
|
||||||
"astro-integration",
|
|
||||||
"withastro",
|
|
||||||
"astro",
|
|
||||||
"blog",
|
|
||||||
"content",
|
|
||||||
"integration",
|
|
||||||
"ghost",
|
|
||||||
"ghostcms",
|
|
||||||
"ghostcms-theme",
|
|
||||||
"ghost-theme",
|
|
||||||
"astro-theme"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev",
|
"playground:dev": "pnpm --filter playground dev",
|
||||||
"build": "astro build",
|
"lint": "biome check .",
|
||||||
"typecheck": "astro check && tsc --noEmit",
|
"lint:fix": "biome check --apply ."
|
||||||
"preview": "astro preview",
|
|
||||||
"format": "prettier --write .",
|
|
||||||
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint ."
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"devDependencies": {
|
||||||
"@astrojs/check": "^0.3.4",
|
"@biomejs/biome": "1.5.2",
|
||||||
"@astrojs/rss": "^4.0.2",
|
"@changesets/cli": "^2.27.1"
|
||||||
"@astrojs/sitemap": "^3.0.5",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
||||||
"@typescript-eslint/parser": "^6.19.0",
|
|
||||||
"astro": "^4.2.1",
|
|
||||||
"astro-font": "^0.0.72",
|
|
||||||
"astro-robots-txt": "^1.0.0",
|
|
||||||
"axios": "^1.6.5",
|
|
||||||
"eslint": "^8.56.0",
|
|
||||||
"eslint-config-prettier": "^9.1.0",
|
|
||||||
"eslint-plugin-astro": "^0.29.1",
|
|
||||||
"prettier": "^3.2.4",
|
|
||||||
"prettier-plugin-astro": "^0.12.3",
|
|
||||||
"sass": "^1.70.0",
|
|
||||||
"tiny-invariant": "^1.3.1",
|
|
||||||
"typescript": "^5.3.3",
|
|
||||||
"vite": "^4.5.2",
|
|
||||||
"zod-validation-error": "^3.0.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
<img src="https://ghostdemo.matthiesen.xyz/content/images/size/w50/2024/01/logo-1.png" width="64px" />
|
||||||
|
|
||||||
|
# Welcome to Astro-GhostCMS
|
||||||
|
|
||||||
|
*Ghost is a trademark of [The Ghost Foundation](https://ghost.org/trademark/). This project is not directly related to or provided by The Ghost Foundation and is intended to help create a easier method to utilize their provided JavaScript tools to link a Headless GhostCMS install in to your Astro project.*
|
||||||
|
|
||||||
|
- [Live Demo](https://demo.astro-ghostcms.xyz/) of the Astro-GhostCMS integration in action!
|
||||||
|
- [Live Demo - Unlighthouse Test](https://test.demo.astro-ghostcms.xyz) for a Automatically updated Lighthouse test from every deploy!
|
||||||
|
- [Live Demo's Repo](https://github.com/MatthiesenXYZ/astro-ghostcms-demo) for an example of how the setup looks.
|
||||||
|
- [Ghost.org](https://ghost.org) Get your own Ghost[^1] Install
|
||||||
|
|
||||||
|
*Need help but don't have Github? Email us at [issues@astro-ghostcms.xyz](mailto:issues@astroghostcms.xyz) to create an issue here on github!*
|
||||||
|
|
||||||
|
Astro minimum Version: **Astro v4.0**
|
||||||
|
|
||||||
|
This Integration is 2 parts. Firstly, there is the API portion that uses the `@tryghost/content-api`[^1] to create the link between astro and GhostCMS. From there we move to the Second Part, which is a theme pre-programmed to pull ALL of its data from GhostCMS[^1] iteself instead of storing any data locally outside of Build.
|
||||||
|
|
||||||
|
- *This package contains a independent copy of the tryghost content-api.js[^1] that is used to establish the connection so this package dose not depend on `@tryghost/content-api` package.[^1]*
|
||||||
|
- If you are looking for a more Customizable option please check [astro-ghostcms-basetheme](https://github.com/MatthiesenXYZ/astro-ghostcms-basetheme)
|
||||||
|
- This project is not setup for SSR in Integration mode. As such is will most likely not function properly in that mode. You will need to build your own project around the API or customize the *basetheme* linked above.
|
||||||
|
|
||||||
|
## Astro Integration Mode
|
||||||
|
|
||||||
|
In this mode, the addon will not be just an API, but will be a full Route takeover, there is plans to add more themes in time, but for now there is only the base Casper theme based on Ghost's main Theme.
|
||||||
|
|
||||||
|
### Astro Add Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# For fresh Install
|
||||||
|
npm create astro@latest
|
||||||
|
# Create Empty Install with standard typescript
|
||||||
|
# Then Delete entire `pages` folder under `/src/`
|
||||||
|
npx astro add @matthiesenxyz/astro-ghostcms
|
||||||
|
```
|
||||||
|
#### Dont forget to set your environment Variables!
|
||||||
|
|
||||||
|
You must also create 2 environment variables in a `.env` file with the following:
|
||||||
|
|
||||||
|
```env
|
||||||
|
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
|
||||||
|
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
|
||||||
|
```
|
||||||
|
## Manual Installation
|
||||||
|
|
||||||
|
```
|
||||||
|
npm i @matthiesenxyz/astro-ghostcms
|
||||||
|
```
|
||||||
|
|
||||||
|
Then set your astro.config.ts to look like this:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { defineConfig } from "astro/config";
|
||||||
|
import sitemap from "@astrojs/sitemap"; //optional but recommended
|
||||||
|
import GhostCMS from '@matthiesenxyz/astro-ghostcms';
|
||||||
|
|
||||||
|
// https://astro.build/config
|
||||||
|
export default defineConfig({
|
||||||
|
site: "https://YOUR-DOMAIN-HERE.com"
|
||||||
|
integrations: [sitemap(), GhostCMS()],
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Dont forget to set your environment Variables!
|
||||||
|
|
||||||
|
You must also create 2 environment variables in a `.env` file with the following:
|
||||||
|
|
||||||
|
```env
|
||||||
|
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
|
||||||
|
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
|
||||||
|
```
|
||||||
|
|
||||||
|
**When you deploy your install dont forget to set the above ENVIRONMENT VARIABLES!**
|
||||||
|
|
||||||
|
#### Created Routes
|
||||||
|
|
||||||
|
The routes are the same as a standard Ghost Blog so you can migrate to Astro easily.
|
||||||
|
|
||||||
|
| Route | Content |
|
||||||
|
| --------------------- | ----------------------------------------- |
|
||||||
|
| `/` | Homepage with recents/features Blog Posts |
|
||||||
|
| `/404` | 404 Page |
|
||||||
|
| `/[slug]` | Post or Page |
|
||||||
|
| `/author/[slug]` | Author page with related posts |
|
||||||
|
| `/authors` | All the authors |
|
||||||
|
| `/tag[slug]` | Tag page with related posts |
|
||||||
|
| `/tags` | All the tags |
|
||||||
|
| `/archives/[...page]` | All the posts, paginated |
|
||||||
|
| `/rss.xml` | All the posts, in a FEED |
|
||||||
|
|
||||||
|
|
||||||
|
## Manual Function Mode (DIY MODE)
|
||||||
|
|
||||||
|
In this mode the integration will not deploy routes at all. you will have to build your own website to utilize the exported functions listed below.
|
||||||
|
|
||||||
|
```
|
||||||
|
npm i @matthiesenxyz/astro-ghostcms
|
||||||
|
```
|
||||||
|
|
||||||
|
You must also create 2 environment variables in a `.env` file with the following:
|
||||||
|
|
||||||
|
```env
|
||||||
|
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
|
||||||
|
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
|
||||||
|
```
|
||||||
|
|
||||||
|
**When you deploy your install dont forget to set the above ENVIRONMENT VARIABLES!**
|
||||||
|
|
||||||
|
For more information and to see the docs please check our website: [Astro-GhostCMS.xyz](https://astro-ghostcms.xyz)
|
||||||
|
|
||||||
|
# Foot Notes & Credits
|
||||||
|
|
||||||
|
[^1]: Ghost.org, Ghost.io, Ghost are all trademarks of [The Ghost Foundation](https://ghost.org/). This project is Open Source and not directly related to or provided by The Ghost Foundation and is intended to help create a easier method to utilize their provided JavaScript tools to link a Headless GhostCMS install in to your Astro project.
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import type { AstroIntegration } from "astro";
|
import type { AstroIntegration } from "astro";
|
||||||
import type { SafeParseError, SafeParseSuccess } from "astro/zod";
|
import type { SafeParseError, SafeParseSuccess } from "astro/zod";
|
||||||
import { UserConfigSchema, type UserConfig } from "./src/utils/UserConfigSchema";
|
import { UserConfigSchema, type UserConfig } from "./src/schemas";
|
||||||
import { ghostSitemap, ghostRobots } from "./src/integrations";
|
import { ghostSitemap, ghostRobots } from "./src/integrations";
|
||||||
import { loadEnv } from 'vite';
|
import { loadEnv } from 'vite';
|
||||||
import { fromZodError } from "zod-validation-error";
|
import { fromZodError } from "zod-validation-error";
|
||||||
import { viteGhostCMS } from "./src/utils/virtual-imports";
|
import { viteGhostCMS } from "./src/virtual";
|
||||||
|
|
||||||
/** INTERNAL CONSTANTS */
|
/** INTERNAL CONSTANTS */
|
||||||
const IC = {
|
const IC = {
|
||||||
|
@ -17,9 +17,9 @@ const IC = {
|
||||||
/** SET ENV GRABBER PREFIXES */
|
/** SET ENV GRABBER PREFIXES */
|
||||||
PREFIXES: 'CONTENT_API',
|
PREFIXES: 'CONTENT_API',
|
||||||
/** INTERNAL STRING */
|
/** INTERNAL STRING */
|
||||||
KEY_MISSING:"CONTENT_API_KEY Missing from .env",
|
KEY_MISSING:"CONTENT_API_KEY Missing from .env/environment variables",
|
||||||
/** INTERNAL STRING */
|
/** INTERNAL STRING */
|
||||||
URL_MISSING:"CONTENT_API_URL Missing from .env",
|
URL_MISSING:"CONTENT_API_URL Missing from .env/environment variables",
|
||||||
/** INTERNAL STRING */
|
/** INTERNAL STRING */
|
||||||
IT:"Injecting Theme: ",
|
IT:"Injecting Theme: ",
|
||||||
/** INTERNAL STRING */
|
/** INTERNAL STRING */
|
||||||
|
@ -104,7 +104,7 @@ export default function GhostCMS(options: UserConfig): AstroIntegration {
|
||||||
|
|
||||||
injectRoute({
|
injectRoute({
|
||||||
pattern: '/404',
|
pattern: '/404',
|
||||||
entrypoint: `${entry}/404.astro`
|
entrypoint: `${IC.PKG}/404.astro`
|
||||||
});
|
});
|
||||||
|
|
||||||
injectRoute({
|
injectRoute({
|
|
@ -0,0 +1,90 @@
|
||||||
|
{
|
||||||
|
"name": "@matthiesenxyz/astro-ghostcms",
|
||||||
|
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
|
||||||
|
"version": "2.1.8",
|
||||||
|
"homepage": "https://astro-ghostcms.xyz/",
|
||||||
|
"type": "module",
|
||||||
|
"license": "MIT",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"sideEffects": false,
|
||||||
|
"author": {
|
||||||
|
"email": "adam@matthiesen.xyz",
|
||||||
|
"name": "Adam Matthiesen - MatthiesenXYZ",
|
||||||
|
"url": "https://matthiesen.xyz"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"astro-component",
|
||||||
|
"astro-integration",
|
||||||
|
"withastro",
|
||||||
|
"astro",
|
||||||
|
"blog",
|
||||||
|
"content",
|
||||||
|
"integration",
|
||||||
|
"ghost",
|
||||||
|
"ghostcms",
|
||||||
|
"ghostcms-theme",
|
||||||
|
"ghost-theme",
|
||||||
|
"astro-theme"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/MatthiesenXYZ/astro-ghostcms.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/MatthiesenXYZ/astro-ghostcms/issues",
|
||||||
|
"email": "issues@astro-ghostcms.xyz"
|
||||||
|
},
|
||||||
|
"main": "index.ts",
|
||||||
|
"types": "src/api/tryghost-content-api.d.ts",
|
||||||
|
"files": [
|
||||||
|
"src",
|
||||||
|
"index.ts"
|
||||||
|
],
|
||||||
|
"exports": {
|
||||||
|
".": "./index.ts",
|
||||||
|
"./api": "./src/api/index.ts",
|
||||||
|
"./404.astro": "./src/default-routes/404/404.astro",
|
||||||
|
"./rss.xml.js": "./src/default-routes/rss.xml.js",
|
||||||
|
"./index.astro": "./src/theme/routes/index.astro",
|
||||||
|
"./[slug].astro": "./src/theme/routes/[slug].astro",
|
||||||
|
"./tags.astro": "./src/theme/routes/tags.astro",
|
||||||
|
"./authors.astro": "./src/theme/routes/authors.astro",
|
||||||
|
"./tag/[slug].astro": "./src/theme/routes/tag/[slug].astro",
|
||||||
|
"./author/[slug].astro": "./src/theme/routes/author/[slug].astro",
|
||||||
|
"./archives/[...page].astro": "./src/theme/routes/archives/[...page].astro"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"dev": "astro dev",
|
||||||
|
"build": "astro build",
|
||||||
|
"typecheck": "astro check && tsc --noEmit",
|
||||||
|
"preview": "astro preview",
|
||||||
|
"format": "prettier --write .",
|
||||||
|
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint ."
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"astro": "^4.2.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@astrojs/check": "^0.3.4",
|
||||||
|
"@astrojs/rss": "^4.0.2",
|
||||||
|
"@astrojs/sitemap": "^3.0.5",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
||||||
|
"@typescript-eslint/parser": "^6.19.0",
|
||||||
|
"@types/node": "^20.11.5",
|
||||||
|
"astro-font": "^0.0.72",
|
||||||
|
"astro-robots-txt": "^1.0.0",
|
||||||
|
"axios": "^1.6.5",
|
||||||
|
"eslint": "^8.56.0",
|
||||||
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
"eslint-plugin-astro": "^0.29.1",
|
||||||
|
"prettier": "^3.2.4",
|
||||||
|
"prettier-plugin-astro": "^0.12.3",
|
||||||
|
"sass": "^1.70.0",
|
||||||
|
"tiny-invariant": "^1.3.1",
|
||||||
|
"typescript": "^5.3.3",
|
||||||
|
"vite": "^4.5.2",
|
||||||
|
"zod-validation-error": "^3.0.0"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
import '../styles/404.css'
|
import './404.css';
|
||||||
---
|
---
|
||||||
|
|
||||||
<html lang="en">
|
<html lang="en">
|
|
@ -58,7 +58,6 @@
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
vertical-align: middle;
|
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
margin-top: 25px;
|
margin-top: 25px;
|
|
@ -1,5 +1,5 @@
|
||||||
import rss from "@astrojs/rss";
|
import rss from "@astrojs/rss";
|
||||||
import { getGhostPosts, getGhostSettings } from '../../api';
|
import { getGhostPosts, getGhostSettings } from '../api';
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
|
|
||||||
export async function GET(context) {
|
export async function GET(context) {
|
|
@ -1,5 +1,5 @@
|
||||||
import robotsTxt, { type RobotsTxtOptions } from "astro-robots-txt";
|
import robotsTxt, { type RobotsTxtOptions } from "astro-robots-txt";
|
||||||
import { UserConfig } from "../utils/UserConfigSchema";
|
import type { UserConfig } from "../schemas";
|
||||||
|
|
||||||
export function getRobotsTxtConfig(opts: UserConfig): RobotsTxtOptions {
|
export function getRobotsTxtConfig(opts: UserConfig): RobotsTxtOptions {
|
||||||
const { robotstxt } = opts;
|
const { robotstxt } = opts;
|
|
@ -1,5 +1,5 @@
|
||||||
import sitemap, { type SitemapOptions } from '@astrojs/sitemap';
|
import sitemap, { type SitemapOptions } from '@astrojs/sitemap';
|
||||||
import { UserConfig } from '../utils/UserConfigSchema';
|
import type { UserConfig } from '../schemas';
|
||||||
|
|
||||||
export function getSitemapConfig(opts: UserConfig): SitemapOptions {
|
export function getSitemapConfig(opts: UserConfig): SitemapOptions {
|
||||||
const { sitemap } = opts
|
const { sitemap } = opts
|
|
@ -1,5 +1,6 @@
|
||||||
import { z } from 'astro/zod';
|
import { z } from 'astro/zod';
|
||||||
import * as S from './schemas';
|
import { SitemapSchema } from './sitemap';
|
||||||
|
import { RobotsTxtSchema } from './robots';
|
||||||
|
|
||||||
export const UserConfigSchema = z.object({
|
export const UserConfigSchema = z.object({
|
||||||
/** OPTIONAL - Disable Route Injector
|
/** OPTIONAL - Disable Route Injector
|
||||||
|
@ -15,13 +16,13 @@ export const UserConfigSchema = z.object({
|
||||||
* Options shown are the availble options
|
* Options shown are the availble options
|
||||||
* REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap
|
* REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap
|
||||||
*/
|
*/
|
||||||
sitemap: S.SitemapSchema.optional(),
|
sitemap: SitemapSchema.optional(),
|
||||||
/** OPTIONAL - astro-robots-txt
|
/** OPTIONAL - astro-robots-txt
|
||||||
* This option allows the user to configure the included integration
|
* This option allows the user to configure the included integration
|
||||||
* Options shown are the availble options
|
* Options shown are the availble options
|
||||||
* REFERENCE https://www.npmjs.com/package/astro-robots-txt#configuration
|
* REFERENCE https://www.npmjs.com/package/astro-robots-txt#configuration
|
||||||
*/
|
*/
|
||||||
robotstxt: S.RobotsTxtSchema.optional(),
|
robotstxt: RobotsTxtSchema.optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** USER CONFIGURATION SCHEMA */
|
/** USER CONFIGURATION SCHEMA */
|
|
@ -0,0 +1,37 @@
|
||||||
|
import { z } from "astro/zod";
|
||||||
|
|
||||||
|
const RobotsPolicySchema = z.object({
|
||||||
|
/** You must provide a name of the automatic client (search engine crawler).
|
||||||
|
* Wildcards are allowed.
|
||||||
|
*/
|
||||||
|
userAgent: z.string(),
|
||||||
|
/** Allowed paths for crawling */
|
||||||
|
allow: z.string().optional(),
|
||||||
|
/** Disallowed paths for crawling */
|
||||||
|
disallow: z.string().optional(),
|
||||||
|
/** Indicates that the page's URL contains parameters that should be ignored during crawling.
|
||||||
|
* Maximum string length is limited to 500.
|
||||||
|
*/
|
||||||
|
cleanParam: z.string().optional(),
|
||||||
|
/** Minimum interval (in secs) for the crawler to wait after loading one page, before starting other */
|
||||||
|
crawlDelay: z.number().optional()
|
||||||
|
})
|
||||||
|
|
||||||
|
export const RobotsTxtSchema = z.object({
|
||||||
|
/** EXAMPLE1 host: true - automatically resolve using the site option from Astro config
|
||||||
|
* EXAMPLE2 host: 'example.com'
|
||||||
|
*/
|
||||||
|
host: z.string().optional(),
|
||||||
|
/** EXAMPLE1 sitemap: "https://example.com/sitemap-0.xml"
|
||||||
|
* EXAMPLE2 sitemap: ['https://example.com/sitemap-0.xml','https://example.com/sitemap-1.xml']
|
||||||
|
* EXAMPLE3 sitemap: false - If you want to get the robots.txt file without the Sitemap: ... entry, set the sitemap parameter to false.
|
||||||
|
*/
|
||||||
|
sitemap: z.string().optional(),
|
||||||
|
/** astrojs/sitemap and astro-sitemap integrations have the sitemap-index.xml as their primary output. That is why the default value of sitemapBaseFileName is set to sitemap-index.
|
||||||
|
* EXAMPLE sitemapBaseFileName: 'custom-sitemap'
|
||||||
|
*/
|
||||||
|
sitemapBaseFileName: z.string().optional(),
|
||||||
|
/** SET POLICY RULES */
|
||||||
|
policy: RobotsPolicySchema.array().optional(),
|
||||||
|
})
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { z } from "astro/zod";
|
||||||
|
|
||||||
|
export const SitemapSchema = z.object({
|
||||||
|
/** EXAMPLE: ['https://example-1.com', 'https://example-2.com]
|
||||||
|
* REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap/#custompages
|
||||||
|
*/
|
||||||
|
customPages: z.string().array().optional(),
|
||||||
|
/** EXAMPLE: 10000
|
||||||
|
* REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap/#entrylimit
|
||||||
|
*/
|
||||||
|
entryLimit: z.number().optional()
|
||||||
|
})
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
import type { Settings } from "../../api";
|
import type { Settings } from "../../api";
|
||||||
import { AstroFont } from "astro-font";
|
import { AstroFont } from "astro-font";
|
||||||
import ViewTransitions from "astro/components/ViewTransitions.astro";
|
|
||||||
import MainLayout from "../components/MainLayout.astro";
|
import MainLayout from "../components/MainLayout.astro";
|
||||||
|
import { ViewTransitions } from "astro:transitions";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
content?: {
|
content?: {
|
||||||
title: string|undefined;
|
title: string|undefined;
|
|
@ -1,8 +1,7 @@
|
||||||
import type { AstroConfig, ViteUserConfig } from 'astro'
|
import type { AstroConfig, ViteUserConfig } from 'astro'
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
import type { UserConfig } from '../schemas';
|
||||||
import { UserConfig } from './UserConfigSchema'
|
|
||||||
|
|
||||||
function resolveVirtualModuleId<T extends string>(id: T): `\0${T}` {
|
function resolveVirtualModuleId<T extends string>(id: T): `\0${T}` {
|
||||||
return `\0${id}`
|
return `\0${id}`
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"extends": "astro/tsconfigs/strict",
|
||||||
|
"compilerOptions": {
|
||||||
|
"jsx": "preserve"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
# build output
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# generated types
|
||||||
|
.astro/
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# logs
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# environment variables
|
||||||
|
.env
|
||||||
|
.env.production
|
||||||
|
|
||||||
|
# macOS-specific files
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"recommendations": ["astro-build.astro-vscode"],
|
||||||
|
"unwantedRecommendations": []
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"command": "./node_modules/.bin/astro dev",
|
||||||
|
"name": "Development server",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node-terminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Matthiesen XYZ
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Astro-GhostCMS playground
|
||||||
|
|
||||||
|
This is the Dev Environment for this package
|
||||||
|
|
||||||
|
### For more information Check our website
|
||||||
|
|
||||||
|
[Astro-GhostCMS.xyz](https://astro-ghostcms.xyz)
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { defineConfig } from "astro/config";
|
||||||
|
import ghostcms from "@matthiesenxyz/astro-ghostcms";
|
||||||
|
|
||||||
|
// https://astro.build/config
|
||||||
|
export default defineConfig({
|
||||||
|
site: "https://demo.astro-ghostcms.xyz/",
|
||||||
|
integrations: [ghostcms()],
|
||||||
|
});
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "playground",
|
||||||
|
"type": "module",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "astro dev",
|
||||||
|
"start": "astro dev",
|
||||||
|
"build": "astro check && astro build",
|
||||||
|
"preview": "astro preview",
|
||||||
|
"astro": "astro"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"astro": "^4.2.1",
|
||||||
|
"@matthiesenxyz/astro-ghostcms": "workspace:*"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@astrojs/check": "^0.4.1",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
|
||||||
|
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
|
||||||
|
<style>
|
||||||
|
path { fill: #000; }
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
path { fill: #FFF; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 749 B |
|
@ -0,0 +1,9 @@
|
||||||
|
/// <reference types="astro/client" />
|
||||||
|
interface ImportMetaEnv {
|
||||||
|
readonly CONTENT_API_KEY: string
|
||||||
|
readonly CONTENT_API_URL: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ImportMeta {
|
||||||
|
readonly env: ImportMetaEnv;
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"extends": "astro/tsconfigs/strict",
|
||||||
|
"exclude": ["dist"]
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,4 @@
|
||||||
|
packages:
|
||||||
|
- package
|
||||||
|
- "packages/*"
|
||||||
|
- "playground"
|
|
@ -1,47 +0,0 @@
|
||||||
import { z } from 'astro/zod';
|
|
||||||
|
|
||||||
export const SitemapSchema = z.object({
|
|
||||||
/** EXAMPLE: ['https://example-1.com', 'https://example-2.com]
|
|
||||||
* REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap/#custompages
|
|
||||||
*/
|
|
||||||
customPages: z.string().array().optional(),
|
|
||||||
/** EXAMPLE: 10000
|
|
||||||
* REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap/#entrylimit
|
|
||||||
*/
|
|
||||||
entryLimit: z.number().optional()
|
|
||||||
})
|
|
||||||
|
|
||||||
const RobotsPolicySchema = z.object({
|
|
||||||
/** You must provide a name of the automatic client (search engine crawler).
|
|
||||||
* Wildcards are allowed.
|
|
||||||
*/
|
|
||||||
userAgent: z.string(),
|
|
||||||
/** Allowed paths for crawling */
|
|
||||||
allow: z.string().optional(),
|
|
||||||
/** Disallowed paths for crawling */
|
|
||||||
disallow: z.string().optional(),
|
|
||||||
/** Indicates that the page's URL contains parameters that should be ignored during crawling.
|
|
||||||
* Maximum string length is limited to 500.
|
|
||||||
*/
|
|
||||||
cleanParam: z.string().optional(),
|
|
||||||
/** Minimum interval (in secs) for the crawler to wait after loading one page, before starting other */
|
|
||||||
crawlDelay: z.number().optional()
|
|
||||||
})
|
|
||||||
|
|
||||||
export const RobotsTxtSchema = z.object({
|
|
||||||
/** EXAMPLE1 host: true - automatically resolve using the site option from Astro config
|
|
||||||
* EXAMPLE2 host: 'example.com'
|
|
||||||
*/
|
|
||||||
host: z.string().optional(),
|
|
||||||
/** EXAMPLE1 sitemap: "https://example.com/sitemap-0.xml"
|
|
||||||
* EXAMPLE2 sitemap: ['https://example.com/sitemap-0.xml','https://example.com/sitemap-1.xml']
|
|
||||||
* EXAMPLE3 sitemap: false - If you want to get the robots.txt file without the Sitemap: ... entry, set the sitemap parameter to false.
|
|
||||||
*/
|
|
||||||
sitemap: z.string().optional(),
|
|
||||||
/** astrojs/sitemap and astro-sitemap integrations have the sitemap-index.xml as their primary output. That is why the default value of sitemapBaseFileName is set to sitemap-index.
|
|
||||||
* EXAMPLE sitemapBaseFileName: 'custom-sitemap'
|
|
||||||
*/
|
|
||||||
sitemapBaseFileName: z.string().optional(),
|
|
||||||
/** SET POLICY RULES */
|
|
||||||
policy: RobotsPolicySchema.array().optional(),
|
|
||||||
})
|
|
Loading…
Reference in New Issue