Skip to content

Commit

Permalink
Refactor import paths for consistency and update documentation descri…
Browse files Browse the repository at this point in the history
…ptions
  • Loading branch information
Adammatthiesen committed Feb 20, 2025
1 parent 08545d6 commit 2d714c3
Show file tree
Hide file tree
Showing 38 changed files with 442 additions and 327 deletions.
116 changes: 116 additions & 0 deletions archive/docs/how-it-works/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
i18nReady: true
title: "How it works"
description: "Learn how StudioCMS helps you manage and deliver your content by exploring a comprehensive breakdown of it's fundamental components."
sidebar:
order: 1
badge:
text: "Updated"
variant: "success"
---

# Introduction

StudioCMS is a powerful CMS built for Astro that allows you to manage and serve your content using [Astro DB](https://docs.astro.build/en/guides/astro-db/). It's designed to be easy-to-use and flexible enough to handle any type of content.

Extending StudioCMS is easy too! You can create your own plugins to add new features to StudioCMS.

## How does it work?

StudioCMS is divided into multiple parts:

- **studiocms**: The primary integration that hooks into your Astro project and provides the ability to interact with Astro DB (through the `@astrojs/db` integration).
- **@studiocms/core**: The core integration that provides the foundation for StudioCMS. It provides the database configurations, and adds various features including virtual imports, logging, etc.
- **@studiocms/auth**: An integration that provides authentication configuration options for the StudioCMS Dashboard.
- **@studiocms/assets**: An integration that provides the assets for the StudioCMS Dashboard.
- **@studiocms/frontend**: An integration that provides the frontend layouts and components for the StudioCMS ecosystem.
- **@studiocms/renderers**: An integration that provides the renderers for the StudioCMS ecosystem.
- **@studiocms/dashboard**: The primary web interface for managing your StudioCMS project. It provides a user-friendly interface for creating, editing, and deleting content.
- **@studiocms/imagehandler**: An integration that provides a `<CustomImage />` component to handle remote images and optimize them for your project in an SSR environment.
- **@studiocms/robotstxt**: An integration that automates the creation of a `robots.txt` file for your StudioCMS project.
- **@studiocms/betaresources**: An integration that provides resources for the StudioCMS beta.

## Breakdown

### StudioCMS: Core

StudioCMS Core is an Astro Integration which provides a comprehensive CMS solution out-of-the-box. This integration registers StudioCMS as the first plugin, sets up database configurations, watches for configuration changes, and adds various features including virtual imports, logging, and default frontend routes.

#### Features

- **@astrojs/db**: StudioCMS Core uses the `@astrojs/db` integration to connect to a libSQL database.
- **Virtual Imports**: StudioCMS Core adds several [virtual modules](https://vitejs.dev/guide/api-plugin#virtual-modules-convention) packed with features that give you full control over your dynamic content.
- **Logging**: StudioCMS Core logs all changes to Astro Studio. This can be enabled in your config file.
- **Default Frontend Routes**: The StudioCMS Core integration adds default frontend routes to your Astro project to allow for easy access to the StudioCMS dashboard.
- **Plugin System**: You can extend StudioCMS using plugins to add additional functionality.

#### Core Virtual Modules

:::tip
Modules prefixed with `virtual:` are virtual modules that are primarily used internally by StudioCMS, but can be used by developers to access StudioCMS data. To access these modules with proper typings, see the [project development `.d.ts` file](https://github.com/withstudiocms/studiocms/blob/main/packages/studiocms_core/virtuals.d.ts) for an example of how to configure your project to sense these types.

Modules without the `virtual:` prefix have full typings defined and injected into your project's `.astro/` directory automatically, and can be accessed directly without any extra configuration.
:::

- **`virtual:studiocms/config`**: Provides the resolved configuration for the StudioCMS integration ecosystem.
- **`virtual:studiocms/version`**: Provides the current version of the StudioCMS integration ecosystem.
- **`virtual:studiocms/pluginSystem`**: Provides the plugin system interfaces during runtime for StudioCMS.
- **`studiocms:components`**: Provides the front-end exported components for StudioCMS.
- **`studiocms:helpers`**: Provides the front-end exported helper functions for StudioCMS.
- **`studiocms:helpers/contentHelper`**: Provides the exported content helper functions for StudioCMS.
- **`studiocms:helpers/headDefaults`**: Provides the exported head defaults for StudioCMS.
- **`studiocms:helpers/routemap`**: Provides the exported route map for StudioCMS.
- **`studiocms:i18n`**: Provides the i18n utilities for StudioCMS.

### StudioCMS: Auth

The StudioCMS Auth integration provides authentication configuration options for the StudioCMS Dashboard. This integration is used to determine how users can authenticate with the StudioCMS Dashboard.

#### Features
- **`@oslojs`**: The StudioCMS Auth integration uses the `@oslojs` utilities to handle local authentication options such as username and password.
- **`arctic`**: The StudioCMS Auth integration uses the `arctic` library to handle OAuth authentication options such as GitHub.
- **`three`**: The StudioCMS Auth integration uses the ThreeJS library to create a 3D logo animation for the login and # pages.
- **`@studiocms/ui`**: The StudioCMS Auth integration uses the `@studiocms/ui` library to provide UI components for the login and # pages.

#### Auth Virtual Modules

- **`studiocms:auth/lib/encryption`**: Provides encryption functions for the StudioCMS Auth integration.
- **`studiocms:auth/lib/password`**: Provides password functions for the StudioCMS Auth integration.
- **`studiocms:auth/lib/session`**: Provides session functions for the StudioCMS Auth integration.
- **`studiocms:auth/lib/types`**: Provides types for the StudioCMS Auth integration.
- **`studiocms:auth/lib/user`**: Provides user functions for the StudioCMS Auth integration.
- **`studiocms:auth/utils/authEnvCheck`**: Provides authentication environment check functions for the StudioCMS Auth integration.
- **`studiocms:auth/scripts/three`**: Provides ThreeJS scripts for the StudioCMS Auth integration.
- **`studiocms:auth/scripts/formListener`**: Provides form listener scripts for the StudioCMS Auth integration.

### StudioCMS: Dashboard

The StudioCMS Dashboard is a web interface that allows you to manage your StudioCMS project. It provides a user-friendly interface for creating, editing, and deleting content for your project. The StudioCMS Dashboard is built with [Astro](https://astro.build) and our [`@studiocms/ui](/customizing/studiocms-ui/) library.

#### Tech Stack

- **Dashboard**: The StudioCMS Dashboard provides a user-friendly interface for managing your StudioCMS project.
- **AuthConfig**: The StudioCMS Dashboard provides authentication configuration options.
- **DashboardRouteOverride**: The StudioCMS Dashboard provides a dashboard route override configuration option. Allowing you to change the default route for the StudioCMS Dashboard and API.

### StudioCMS: ImageHandler

The StudioCMS ImageHandler is an integration that provides a custom image component for your Astro project. This component is used to handle remote images and optimize them in a SSR environment.

#### Features

- **`<CustomImage />`**: The StudioCMS ImageHandler provides a custom image component for your Astro project.

#### ImageHandler Virtual Modules

- **`studiocms:imageHandler/components`**: The Virtual module that provides the exported image components for the StudioCMS ImageHandler.

### StudioCMS: Renderers

The StudioCMS Renderers integration provides the renderers for the StudioCMS ecosystem. This integration is used to determine how content should be rendered in StudioCMS.

#### Renderers Virtual Modules

- **`studiocms:renderer`**: Provides the main renderer component for the StudioCMS ecosystem.
- **`studiocms:renderer/config`**: Provides the configuration for the StudioCMS renderer.
- **`studiocms:renderer/astroMarkdownConfig`**: Provides the configuration for Astro Markdown support.
95 changes: 41 additions & 54 deletions docs/astro.config.mts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import starlight from '@astrojs/starlight';
import starlightUtils from '@lorenzo_lewis/starlight-utils';
// import starlightUtils from '@lorenzo_lewis/starlight-utils';
// import { typeDocPlugins, typeDocSideBarEntry } from './typedoc.config.ts';
import ui from '@studiocms/ui';
import { defineConfig } from 'astro/config';
import starlightImageZoom from 'starlight-image-zoom';
import getCoolifyURL from './hostUtils.ts';
import rehypePluginKit from './src/plugins/rehypePluginKit.ts';
import { typeDocPlugins, typeDocSideBarEntry } from './typedoc.config.ts';

// Define the Site URL
const site = getCoolifyURL(true) || 'https://docs.studiocms.dev/';
Expand Down Expand Up @@ -37,6 +38,7 @@ export default defineConfig({
rehypePlugins: rehypePluginKit,
},
integrations: [
ui(),
starlight({
title: 'StudioCMS',
description: 'A dedicated CMS for Astro DB. Built from the ground up by the Astro community.',
Expand Down Expand Up @@ -98,69 +100,54 @@ export default defineConfig({
],
sidebar: [
{
label: 'Learn',
label: 'Start Here',
autogenerate: { directory: 'start-here' },
},
{
label: 'Contributing Guides',
autogenerate: { directory: 'contributing' },
},
{
label: 'Understanding StudioCMS',
autogenerate: { directory: 'how-it-works' },
},
{
label: 'Package Catalog',
items: [
{
label: 'Start Here',
autogenerate: { directory: 'start-here' },
},
{
label: 'Contributing Guides',
autogenerate: { directory: 'contributing' },
},
{
label: 'Understanding StudioCMS',
autogenerate: { directory: 'how-it-works' },
label: 'Package List',
link: '/package-catalog',
badge: { text: 'New', variant: 'success' },
},
{
label: 'Package Catalog',
items: [
{
label: 'Package List',
link: '/package-catalog',
badge: { text: 'New', variant: 'success' },
},
{
label: 'StudioCMS Integrations',
autogenerate: { directory: 'package-catalog/studiocms-integrations' },
collapsed: true,
},
{
label: 'Community Integrations',
autogenerate: { directory: 'package-catalog/community-integrations' },
collapsed: true,
},
],
label: 'StudioCMS Integrations',
autogenerate: { directory: 'package-catalog/studiocms-integrations' },
collapsed: true,
},
{
label: 'Customizing StudioCMS',
items: [
{
label: '@studiocms/renderers',
autogenerate: { directory: 'customizing/studiocms-renderers' },
collapsed: true,
},
],
label: 'Community Integrations',
autogenerate: { directory: 'package-catalog/community-integrations' },
collapsed: true,
},
],
},
{
label: 'References',
items: [
{
label: 'Configuration Reference',
autogenerate: { directory: 'config-reference' },
collapsed: false,
},
typeDocSideBarEntry,
],
},
// {
// label: 'References',
// items: [
// {
// label: 'Configuration Reference',
// autogenerate: { directory: 'config-reference' },
// collapsed: false,
// },
// // typeDocSideBarEntry,
// ],
// },
],
plugins: [
starlightUtils({
multiSidebar: { switcherStyle: 'horizontalList' },
}),
...typeDocPlugins,
// starlightUtils({
// multiSidebar: { switcherStyle: 'horizontalList' },
// }),
// ...typeDocPlugins,
starlightImageZoom(),
],
}),
Expand Down
26 changes: 13 additions & 13 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,33 @@

"tsm": "2.3.0",
"@lunariajs/core": "https://pkg.pr.new/lunariajs/lunaria/@lunariajs/core@4c8b9b0",
"expressive-code-twoslash": "^0.3.0",
"expressive-code-twoslash": "^0.4.0",
"@shikijs/colorized-brackets": "^1.24.2",
"starlight-package-managers": "^0.8.0",
"@11ty/eleventy-fetch": "^5.0.1",
"starlight-package-managers": "^0.10.0",
"@11ty/eleventy-fetch": "^5.0.2",
"@lorenzo_lewis/starlight-utils": "^0.2.0",
"@types/hast": "^3.0.4",
"p-retry": "^6.2.0",
"p-retry": "^6.2.1",
"astro-embed": "^0.9.0",
"hast": "^1.0.0",
"hast-util-select": "^6.0.3",
"hast-util-select": "^6.0.4",
"rehype": "^13.0.2",
"starlight-typedoc": "^0.17.0",
"typedoc": "^0.27",
"typedoc-plugin-markdown": "^4.3.2",
"starlight-image-zoom": "^0.9.0",
"hastscript": "^9.0.0",
"starlight-typedoc": "^0.19.0",
"typedoc": "^0.27.7",
"typedoc-plugin-markdown": "^4.4.2",
"starlight-image-zoom": "^0.11.1",
"hastscript": "^9.0.1",
"hast-util-to-string": "^3.0.1",
"mdast-util-from-markdown": "^2.0.2",
"mdast-util-gfm": "^3.0.0",
"mdast-util-gfm": "^3.1.0",
"mdast-util-to-hast": "^13.2.0",
"rehype-slug": "^6.0.0",
"rehype-autolink-headings": "^7.1.0",
"rehype-external-links": "^3.0.0",
"@types/html-escaper": "^3.0.2",
"@types/html-escaper": "^3.0.4",
"html-escaper": "^3.0.3",

"@fontsource-variable/onest": "5.1.0",
"@fontsource-variable/onest": "5.1.1",
"unified": "^11.0.5"
}
}
2 changes: 1 addition & 1 deletion docs/src/components/DropdownScript.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { DropdownHelper } from '@studiocms/ui/components';
import { DropdownHelper } from 'studiocms:ui/components';

new DropdownHelper('usage-dropdown');
new DropdownHelper('align-start-dropdown');
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/ModalScript.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { ModalHelper } from '@studiocms/ui/components';
import { ModalHelper } from 'studiocms:ui/components';

new ModalHelper('usage-modal', 'usage-modal-trigger');
new ModalHelper('sizes-modal-sm', 'sm-modal-trigger');
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/ThemeHelperScript.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { ThemeHelper } from '@studiocms/ui/utils/ThemeHelper.ts';
import { ThemeHelper } from 'studiocms:ui/utils';

const themeHelper = new ThemeHelper();

Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/ToasterScript.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { toast } from '@studiocms/ui/components';
import { toast } from 'studiocms:ui/components';

document.getElementById('usage-trigger')!.addEventListener('click', () => {
toast({
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/contributing/translations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Current translation status:

Visit [our i18n dashboard](https://i18n.studiocms.dev) to help translate StudioCMS into your language. If your language is not listed, you can add it within the dashboard.

If you would prefer to contribute translations directly to the repository, the translations are stored in the [`packages/studiocms_core/src/i18n/translations`](https://github.com/withstudiocms/studiocms/tree/main/packages/studiocms_core/src/i18n/translations/) directory. You can find the English translations in the [`en-us.json`](https://github.com/withstudiocms/studiocms/blob/main/packages/studiocms_core/src/i18n/translations/en-us.json) file.
If you would prefer to contribute translations directly to the repository, the translations are stored in the [`packages/studiocms_core/src/i18n/translations`](https://github.com/withstudiocms/studiocms/tree/main/packages/studiocms/src/lib/i18n/translations/) directory. You can find the English translations in the [`en-us.json`](https://github.com/withstudiocms/studiocms/blob/main/packages/studiocms/src/lib/i18n/translations/en-us.json) file.

<ReadMore>
StudioCMS uses [Weblate](https://weblate.org) for managing translations on top of GitHub. If you are new to Weblate, you can find the [Translating using Weblate Guide](https://docs.weblate.org/en/latest/user/translating.html#) on their website.
</ReadMore>

Once the translations have been added, they will be added to the [StudioCMS i18n configuration](https://github.com/withstudiocms/studiocms/blob/main/packages/studiocms_core/src/i18n/index.ts#L8) and will be available in the next release.
Once the translations have been added, they will be added to the [StudioCMS i18n configuration](https://github.com/withstudiocms/studiocms/blob/main/packages/studiocms/src/lib/i18n/index.ts#L8) and will be available in the next release.

## Documentation

Expand Down
Loading

0 comments on commit 2d714c3

Please # to comment.