@studiocms/devapps
Introduction
'Read the “', Introduction, '” section'A Collection of useful tools available during dev mode in Astro.
Installation
'Read the “', Installation, '” section'-
Install the package and add to your astro config using the following command:
Terminal window npx astro add @studiocms/devappsTerminal window pnpm astro add @studiocms/devappsTerminal window yarn astro add @studiocms/devapps -
Update your config file as shown under Example Config below.
-
Install the package using the following command:
Terminal window npm i @studiocms/devappsTerminal window pnpm add @studiocms/devappsTerminal window yarn add @studiocms/devapps -
Add
@studiocms/devapps
to your astro config file:astro.config.mjs import {defineConfig } from 'astro/config';function defineConfig<const TLocales extends Locales = never, const TDriver extends SessionDriverName = never>(config: AstroUserConfig<TLocales, TDriver>): AstroUserConfig<TLocales, TDriver>See the full Astro Configuration API Documentation https://astro.build/config
importdb from '@astrojs/db';function db(): AstroIntegration[]importdevApps from '@studiocms/devapps';function devApps(opts?: StudioCMSDevAppsOptions): AstroIntegrationIntegrates StudioCMS development applications with Astro.
export defaultdefineConfig({defineConfig<never, never>(config: AstroUserConfig<never, never>): AstroUserConfig<never, never>See the full Astro Configuration API Documentation https://astro.build/config
site: "https://example.com",AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never>.site?: stringintegrations: [AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never>.integrations?: (false | AstroIntegration | (false | AstroIntegration | null | undefined)[] | null | undefined)[]db(),function db(): AstroIntegration[]devApps(),function devApps(opts?: StudioCMSDevAppsOptions): AstroIntegrationIntegrates StudioCMS development applications with Astro.
],});
All tools will only be available during astro dev
and will not be available during production deployments!
Example config
'Read the “', Example config, '” section'import { function defineConfig<const TLocales extends Locales = never, const TDriver extends SessionDriverName = never>(config: AstroUserConfig<TLocales, TDriver>): AstroUserConfig<TLocales, TDriver>
See the full Astro Configuration API Documentation
https://astro.build/config
defineConfig } from 'astro/config';import function db(): AstroIntegration[]
db from '@astrojs/db';import function devApps(opts?: StudioCMSDevAppsOptions): AstroIntegration
Integrates StudioCMS development applications with Astro.
devApps from '@studiocms/devapps';
export default defineConfig<never, never>(config: AstroUserConfig<never, never>): AstroUserConfig<never, never>
See the full Astro Configuration API Documentation
https://astro.build/config
defineConfig({ AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never>.site?: string
site: "https://example.com", AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never>.integrations?: (false | AstroIntegration | (false | AstroIntegration | null | undefined)[] | null | undefined)[]
integrations: [ function db(): AstroIntegration[]
db(), // REQUIRED function devApps(opts?: StudioCMSDevAppsOptions): AstroIntegration
Integrates StudioCMS development applications with Astro.
devApps(/* See Config Options Below */), ],});
Config Options
'Read the “', Config Options, '” section'Full list of options available for the devApps
integration, with default values shown. All options are optional.
endpoint?: string | undefined
endpoint: '_studiocms-devapps',verbose?: boolean | undefined
verbose: false,appsConfig?: { wpImporter: boolean | { endpoint?: string | undefined; }; libSQLViewer?: boolean | undefined;} | undefined
appsConfig: { libSQLViewer?: boolean | undefined
libSQLViewer: true, wpImporter: boolean | { endpoint?: string | undefined;}
wpImporter: true,},
libSQL Viewer
'Read the “', libSQL Viewer, '” section'Development tool to view the SQL tables in the libSQL database in the browser. The tool rely’s on the @astrojs/db
libSQL remote database connection credentials.
Requirements
'Read the “', Requirements, '” section'The following env variables set (Also used for @astrojs/db
):
ASTRO_DB_REMOTE_URL
ASTRO_DB_APP_TOKEN
Preview Usage
'Read the “', Preview Usage, '” section'- Toolbar app (Closed)
- Toolbar app (Expanded)
Wordpress Importer
'Read the “', Wordpress Importer, '” section'Development tool to import WordPress posts and pages into the StudioCMS database.
Requirements
'Read the “', Requirements, '” section'- StudioCMS Integration
- WordPress Install
@studiocms/blog
(Optional: for importing Posts under a blog)
Preview Usage
'Read the “', Preview Usage, '” section'- Toolbar app