code cleanup and fixes

This commit is contained in:
Adam Matthiesen 2024-03-03 08:43:44 -08:00
parent 2901524b8a
commit 3192714355
5 changed files with 25 additions and 10 deletions

View File

@ -38,7 +38,9 @@
}, },
"files": [ "files": [
"src", "src",
"index.ts" "CHANGELOG.md",
"LICENSE",
"README.md"
], ],
"exports": { "exports": {
".": "./src/index.ts", ".": "./src/index.ts",

View File

@ -4,18 +4,22 @@ import type { Page, Post } from "../schemas/api";
// LOAD ENVIRONMENT VARIABLES // LOAD ENVIRONMENT VARIABLES
import { loadEnv } from "vite"; import { loadEnv } from "vite";
import config from "virtual:@matthiesenxyz/astro-ghostcms/config"; const {
CONTENT_API_KEY,
const CONF_URL = config.ghostURL; CONTENT_API_URL
} = loadEnv(
const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
"all", "all",
process.cwd(), process.cwd(),
"CONTENT_", "CONTENT_",
); );
const ghostApiKey = CONTENT_API_KEY; // LOAD CONFIG
const ghostUrl = CONF_URL ? CONF_URL : CONTENT_API_URL; import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const CONF_URL = config.ghostURL;
// SETUP GHOST API
const ghostApiKey = CONTENT_API_KEY || "";
const ghostUrl = CONF_URL || CONTENT_API_URL || "";
const version = "v5.0"; const version = "v5.0";
const api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version); const api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version);

View File

@ -75,7 +75,7 @@ export default defineIntegration({
if ( !options.disableThemeProvider ) { if ( !options.disableThemeProvider ) {
addIntegration( addIntegration(
ghostThemeProvider({ ghostThemeProvider({
theme: options.ThemeProvider.theme, theme: options.ThemeProvider?.theme,
verbose verbose
}) })
) )
@ -164,7 +164,6 @@ export default defineIntegration({
"astro:server:start": async ({ logger }) => { "astro:server:start": async ({ logger }) => {
const GhostLogger = logger.fork(`${c.bold(c.blue('👻 Astro-GhostCMS'))}${c.gray("/")}${c.bold(c.green('DEV'))}`); const GhostLogger = logger.fork(`${c.bold(c.blue('👻 Astro-GhostCMS'))}${c.gray("/")}${c.bold(c.green('DEV'))}`);
const GhostUpdateLogger = logger.fork(`${c.bold(c.blue('👻 Astro-GhostCMS'))}${c.gray("/")}${c.bold(c.green('VERSION CHECK'))}`); const GhostUpdateLogger = logger.fork(`${c.bold(c.blue('👻 Astro-GhostCMS'))}${c.gray("/")}${c.bold(c.green('VERSION CHECK'))}`);
const verbose = options.fullConsoleLogs;
// Start the DEV server // Start the DEV server
GhostLogger.info(c.bold(c.magenta('Running Astro-GhostCMS in Deveopment mode 🚀'))) GhostLogger.info(c.bold(c.magenta('Running Astro-GhostCMS in Deveopment mode 🚀')))

View File

@ -0,0 +1,6 @@
{
"extends": "astro/tsconfigs/strictest",
"compilerOptions": {
"jsx": "preserve"
}
}

4
packages/astro-ghostcms/virtual.d.ts vendored Normal file
View File

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