working on some new stuff, also adding the new theme to the create tool, and doing some other cleanup

This commit is contained in:
Adam Matthiesen 2024-02-03 23:10:44 -08:00
parent 29e46a00ea
commit bf65f29e3b
31 changed files with 778 additions and 192 deletions

View File

@ -11,7 +11,7 @@
},
"dependencies": {
"astro": "^4.2.8",
"@matthiesenxyz/astro-ghostcms": "3.1.6",
"@matthiesenxyz/astro-ghostcms": "3.1.8",
"@matthiesenxyz/astro-ghostcms-catppuccin": "0.0.3",
"@astrojs/tailwind": "^5.1.0",
"tailwindcss": "^3.3.5"

View File

@ -52,6 +52,9 @@
"peerDependencies": {
"astro": "^4.2.1"
},
"devDependencies": {
"@matthiesenxyz/astro-ghostcms": "workspace:*"
},
"dependencies": {
"@astrojs/tailwind": "^5.1.0",
"@catppuccin/tailwindcss": "0.1.6",

View File

@ -8,8 +8,7 @@ import { loadEnv } from 'vite';
import { fromZodError } from "zod-validation-error";
import { addVirtualImport } from "./src/utils/add-virtual-import";
export * from "./types.js"
export * from "./types.js";
/** INTERNAL CONSTANTS */
const IC = {
/** INTERNAL PACKAGE NAME */
@ -265,4 +264,4 @@ export default function GhostCMS(options: UserConfig): AstroIntegration {
}
}
}
}
}

View File

@ -43,8 +43,7 @@
".env.demo",
"index.ts",
"tsconfig.json",
"types.ts",
"virtual.d.ts"
"types.ts"
],
"exports": {
".": "./index.ts",
@ -69,7 +68,7 @@
"test:ci": "vitest run --coverage.enabled --coverage.reporter='text-summary'"
},
"peerDependencies": {
"astro": "^4.2.6"
"astro": "^4.2.8"
},
"devDependencies": {
"@astrojs/check": "^0.4.1",

View File

@ -1,4 +1,4 @@
declare module 'virtual:@matthiesenxyz/astro-ghostcms/config' {
const Config: import('./src/schemas/index').GhostUserConfig;
const Config: import('../schemas/index').GhostUserConfig;
export default Config;
}

View File

@ -28,7 +28,7 @@ const RobotsPolicySchema = z.object({
* @example sitemap: false - If you want to get the robots.txt file without the Sitemap: ... entry, set the sitemap parameter to false.
*/
sitemap: z.union([z.string(), z.string().array(), z.boolean()]).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.
/** astrojs/sitemap and astro-robots-txt 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(),

View File

@ -0,0 +1,69 @@
import type { Plugin } from "vite";
import { describe, expect, test, vi } from "vitest";
import { addVitePlugin } from "./add-vite-plugin.js";
describe("addVitePlugin", () => {
test("Should run", () => {
const updateConfig = vi.fn();
expect(() =>
addVitePlugin({
plugin: null,
updateConfig,
}),
).not.toThrow();
});
test("Should call updateConfig", () => {
const updateConfig = vi.fn();
addVitePlugin({
plugin: null,
updateConfig,
});
expect(updateConfig).toHaveBeenCalled();
});
test("Should add vite plugin", () => {
let plugin: Plugin;
const pluginName = "test-plugin";
const updateConfig = vi.fn((config) => {
plugin = config.vite.plugins[0];
});
const expectedPlugin = {
name: pluginName,
};
addVitePlugin({
plugin: expectedPlugin,
updateConfig,
});
// @ts-ignore
expect(plugin).toBeDefined();
});
test("Plugin name should match", () => {
let plugin: Plugin;
const pluginName = "test-plugin";
const updateConfig = vi.fn((config) => {
plugin = config.vite.plugins[0];
});
const expectedPlugin = {
name: pluginName,
};
addVitePlugin({
plugin: expectedPlugin,
updateConfig,
});
// @ts-ignore
expect(plugin.name).toBe(pluginName);
});
});

View File

@ -3,12 +3,7 @@ import type satori from "satori";
export type { UserConfig } from './src/schemas';
export type {
Author, AuthorsIncludeSchema, Page,
PagesIncludeSchema, Post, PostsIncludeSchema,
Settings, Tag, TagsIncludeSchema, Tier, TiersIncludeSchema
} from './src/api';
export type * from "./src/api/index.ts";
export type { ContentAPICredentials, APIVersions } from "@ts-ghost/core-api";

View File

@ -7,4 +7,4 @@ export interface Context {
args: string[];
}
export type Template = ["basic","starterkit"];
export type Template = ["basic","starterkit","catppuccin"];

View File

@ -1,6 +1,6 @@
{
"name": "@matthiesenxyz/create-astro-ghostcms",
"version": "0.0.6",
"version": "0.0.7-dev01",
"description": "Utility to quickly get started with our Integration and astro",
"type": "module",
"main": "./create-astro-ghostcms.mjs",

View File

@ -67,13 +67,14 @@ export async function main() {
const answer = await p.select({
message: `${c.cyan('Which template would you like to use?')}`,
options: [
{
value: "basic",
label: `${c.magenta('Basic')} - ${c.cyan(c.italic('Integration w/ Default Theme'))}`
{ value: "basic",
label: `${c.magenta('Basic')} - ${c.cyan(c.italic('Integration w/ Default Theme'))}`
},
{
value: "starterkit",
label: `${c.magenta('Starter Kit')} - ${c.cyan(c.italic('Integration in API-Only Mode with customizable theme'))}`
{ value: "catppuccin",
label: `${c.magenta('Catppuccin-TW')} - ${c.cyan(c.italic('Integration w/ Catppuccin TailwindCSS theme'))}`
},
{ value: "starterkit",
label: `${c.magenta('Starter Kit')} - ${c.cyan(c.italic('Integration in API-Only Mode with customizable theme'))}`
}
],
initialValue: "basic",
@ -101,6 +102,9 @@ export async function main() {
case "starterkit":
await createProject(ctx).catch(console.error);
break;
case "catppuccin":
await createProject(ctx).catch(console.error);
break;
default:
throw new Error(c.red(`Unknown template: ${template}`));
}

View File

@ -1,2 +1 @@
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48

View File

@ -0,0 +1,11 @@
# Astro-GhostCMS Project Quick Start
Thank you for using our create-astro-ghostcms utility!
If you did not opt to install dependencies please don't forget to run your preffered package manager's install command.
Make sure to modify your .env file and Astro Configs to match your Ghost, and user preferences.
For more information about all the options please check our docs @ https://astro-ghostcms.xyz
For help please submit an issue on Github: https://github.com/MatthiesenXYZ/astro-ghostcms/issues or join our Discord: https://discord.gg/u7NZqUyeAR

View File

@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.2.4",
"astro": "^4.2.8",
"@matthiesenxyz/astro-ghostcms": "^3.1.5",
"@matthiesenxyz/astro-ghostcms-theme-default": "^0.1.5"
},

View File

@ -1,3 +1,4 @@
{
"extends": "astro/tsconfigs/strict"
"extends": "astro/tsconfigs/strict",
"exclude": ["dist"]
}

View File

@ -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

View File

@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}

View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}

View File

@ -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.

View File

@ -0,0 +1,11 @@
# Astro-GhostCMS Project Quick Start
Thank you for using our create-astro-ghostcms utility!
If you did not opt to install dependencies please don't forget to run your preffered package manager's install command.
Make sure to modify your .env file and Astro Configs to match your Ghost, and user preferences.
For more information about all the options please check our docs @ https://astro-ghostcms.xyz
For help please submit an issue on Github: https://github.com/MatthiesenXYZ/astro-ghostcms/issues or join our Discord: https://discord.gg/u7NZqUyeAR

View File

@ -0,0 +1,14 @@
import { defineConfig } from "astro/config";
import ghostcms from "@matthiesenxyz/astro-ghostcms";
import tailwind from "@astrojs/tailwind";
// https://astro.build/config
export default defineConfig({
site: "https://example.xyz/",
integrations: [tailwind(),
ghostcms({
theme: "@matthiesenxyz/astro-ghostcms-catppuccin",
ghostURL: "https://ghostdemo.matthiesen.xyz",
})
],
});

View File

@ -0,0 +1,24 @@
{
"name": "{{PROJECT_NAME}}",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"astro": "^4.2.8",
"@matthiesenxyz/astro-ghostcms": "^3.1.8",
"@matthiesenxyz/astro-ghostcms-catppuccin": "^0.0.3",
"@astrojs/tailwind": "^5.1.0",
"tailwindcss": "^3.3.5"
},
"devDependencies": {
"@astrojs/check": "^0.4.1",
"typescript": "^5.3.3"
}
}

View File

@ -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

View File

@ -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;
}

View File

@ -0,0 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
presets: [require('@matthiesenxyz/astro-ghostcms-catppuccin/macchiato')]
};

View File

@ -0,0 +1,4 @@
{
"extends": "astro/tsconfigs/strict",
"exclude": ["dist"]
}

View File

@ -1,15 +1,11 @@
# Astro Starter Kit: Astro-GhostCMS Integration
# Astro-GhostCMS Project Quick Start
To get started fork or clone this repo, and use one of the following commands:
Thank you for using our create-astro-ghostcms utility!
```
npm install
If you did not opt to install dependencies please don't forget to run your preffered package manager's install command.
pnpm install
Make sure to modify your .env file and Astro Configs to match your Ghost, and user preferences.
yarn install
```
For more information about all the options please check our docs @ https://astro-ghostcms.xyz
Then make sure you set your .env variables for DEV and environment variables on your server.
Its just astro! At this point you are free to start modifying what content/what your website will do, want to make it blog features only? go ahead!
For help please submit an issue on Github: https://github.com/MatthiesenXYZ/astro-ghostcms/issues or join our Discord: https://discord.gg/u7NZqUyeAR

View File

@ -8,6 +8,7 @@ export default defineConfig({
integrations: [
// Includes GhostCMS API, @astrojs/rss, @astrojs/sitemap, and astro-robots-txt
GhostCMS({
ghostURL: 'https://ghostdemo.matthiesen.xyz',
// This Option Disables all default theme injection and allows DIY mode.
disableRouteInjection: true,
// Enable this to disable the extra console logs

View File

@ -12,7 +12,7 @@
"dependencies": {
"@astrojs/check": "^0.4.1",
"@matthiesenxyz/astro-ghostcms": "^3.1.4",
"astro": "^4.2.4",
"astro": "^4.2.8",
"typescript": "^5.3.3",
"astro-font": "^0.0.77"
},

View File

@ -1,3 +1,4 @@
{
"extends": "astro/tsconfigs/strict"
"extends": "astro/tsconfigs/strict",
"exclude": ["dist"]
}

File diff suppressed because it is too large Load Diff