diff --git a/packages/astro-ghostcms/package.json b/packages/astro-ghostcms/package.json index 7c74ea7e..e1834af9 100644 --- a/packages/astro-ghostcms/package.json +++ b/packages/astro-ghostcms/package.json @@ -38,7 +38,9 @@ }, "files": [ "src", - "index.ts" + "CHANGELOG.md", + "LICENSE", + "README.md" ], "exports": { ".": "./src/index.ts", diff --git a/packages/astro-ghostcms/src/api/ghostAPI.ts b/packages/astro-ghostcms/src/api/ghostAPI.ts index 0d031775..a0803513 100644 --- a/packages/astro-ghostcms/src/api/ghostAPI.ts +++ b/packages/astro-ghostcms/src/api/ghostAPI.ts @@ -4,18 +4,22 @@ import type { Page, Post } from "../schemas/api"; // LOAD ENVIRONMENT VARIABLES import { loadEnv } from "vite"; -import config from "virtual:@matthiesenxyz/astro-ghostcms/config"; - -const CONF_URL = config.ghostURL; - -const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv( +const { + CONTENT_API_KEY, + CONTENT_API_URL +} = loadEnv( "all", process.cwd(), "CONTENT_", ); -const ghostApiKey = CONTENT_API_KEY; -const ghostUrl = CONF_URL ? CONF_URL : CONTENT_API_URL; +// LOAD CONFIG +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 api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version); diff --git a/packages/astro-ghostcms/src/astro-ghostcms.ts b/packages/astro-ghostcms/src/astro-ghostcms.ts index e310ff4c..5f2888e7 100644 --- a/packages/astro-ghostcms/src/astro-ghostcms.ts +++ b/packages/astro-ghostcms/src/astro-ghostcms.ts @@ -75,7 +75,7 @@ export default defineIntegration({ if ( !options.disableThemeProvider ) { addIntegration( ghostThemeProvider({ - theme: options.ThemeProvider.theme, + theme: options.ThemeProvider?.theme, verbose }) ) @@ -164,7 +164,6 @@ export default defineIntegration({ "astro:server:start": async ({ logger }) => { 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 verbose = options.fullConsoleLogs; // Start the DEV server GhostLogger.info(c.bold(c.magenta('Running Astro-GhostCMS in Deveopment mode 🚀'))) diff --git a/packages/astro-ghostcms/tsconfig.json b/packages/astro-ghostcms/tsconfig.json new file mode 100644 index 00000000..0ce5c9fc --- /dev/null +++ b/packages/astro-ghostcms/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "astro/tsconfigs/strictest", + "compilerOptions": { + "jsx": "preserve" + } + } \ No newline at end of file diff --git a/packages/astro-ghostcms/virtual.d.ts b/packages/astro-ghostcms/virtual.d.ts new file mode 100644 index 00000000..6695d996 --- /dev/null +++ b/packages/astro-ghostcms/virtual.d.ts @@ -0,0 +1,4 @@ +declare module "virtual:@matthiesenxyz/astro-ghostcms/config" { + const Config: import("./src/schemas/userconfig").GhostUserConfig; + export default Config; +} \ No newline at end of file