Skip to content

Commit

Permalink
Astro v5 upgrade (#394)
Browse files Browse the repository at this point in the history
* Start of upgrade to v5 for Astro... so far we have a config bug

* Refactor StudioCMS integration hooks and installation workflow

* Refactor StudioCMS integration URL in astro.config.mts

* Refactor StudioCMS integration URL in astro.config.mts

* Refactor response headers in badFormDataEntry function

* Refactor StudioCMS integration URL and add security configuration

* test

* Refactor link generation in TestIsland component

* Refactor TestIsland component to include data-astro-rerun attribute

* Refactor TestIsland component to remove data-astro-rerun attribute

* Refactor TestIsland component to include data-astro-reload attribute in link generation

* test

* Refactor TestIsland component to remove data-astro-reload attribute in link generation

* Refactor TestIsland component to include data-astro-reload attribute in link generation

* Refactor SingleSidebar component to remove console.log statements and optimize event listeners

* Refactor Layout component to include dynamic sidebar rendering based on the sidebar prop

* move 404 to dashboard

* test

* Refactor 404 page to make the "Go back" button full width

* Refactor 404 page to include error message and make "Go back" button full width

* Refactor 404 page to improve error message and button styling

* Refactor 404 page to move inject404Route to dashboardConfig

* Refactor 404 page to move inject404Route to dashboardConfig

* Refactor 404 page to remove data-theme attribute from html tag

* Update docs to use new starlight loaders and verify they are working

* Refactor StudioCMS to export StudioCMSPlugin type

* Refactor typedocHelpers to fix file path in getFilePathToPackage function

* refactor and cleanup

* Refactor StudioCMS renderer to use Astro Remark renderer

* Refactor StudioCMS renderer to use Astro Remark renderer and export StudioCMSPlugin type

* Refactor StudioCMS UI package catalog to mark it as released

* Refactor contributors.config.ts to include 'withstudiocms/ui' repository in the contributor list

* Refactor contributors.config.ts to include 'withstudiocms/ui' repository in the contributor list

* Refactor environment-variables.mdx and gallery.mdx files

* Refactor StudioCMS configuration files

* Refactor StudioCMS configuration files

* Refactor StudioCMS configuration files and remove unused strings module

* Update docs/src/content/docs/start-here/gallery.mdx

Co-authored-by: Jacob Jenkins <[email protected]>

---------

Co-authored-by: Jacob Jenkins <[email protected]>
  • Loading branch information
Adammatthiesen and jdtjenkins authored Dec 15, 2024
1 parent 73b1094 commit 0805c10
Show file tree
Hide file tree
Showing 94 changed files with 1,577 additions and 3,965 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"prototools",
"robotstxt",
"studiocms",
"twoslash",
"withstudiocms"
]
}
20 changes: 1 addition & 19 deletions docs/astro.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ export const locales = {

export default defineConfig({
site,
experimental: {
directRenderScript: true,
},
image: {
remotePatterns: [{ protocol: 'https' }],
},
Expand Down Expand Up @@ -73,7 +70,7 @@ export default defineConfig({
'./src/styles/starlight.css',
],
editLink: {
baseUrl: 'https://github.com/withstudiocms/studiocms/tree/main/www/docs',
baseUrl: 'https://github.com/withstudiocms/studiocms/tree/main/docs',
},
head: [
// {
Expand Down Expand Up @@ -143,21 +140,6 @@ export default defineConfig({
autogenerate: { directory: 'customizing/studiocms-renderers' },
collapsed: true,
},
{
label: '@studiocms/ui',
badge: { text: 'New', variant: 'success' },
items: [
{ label: 'Getting Started', link: 'customizing/studiocms-ui/' },
{
label: 'Components',
autogenerate: {
directory: 'customizing/studiocms-ui/components',
collapsed: true,
},
},
],
collapsed: true,
},
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/PackageCatalog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const packages = (await getCollection('package-catalog'))

<p>{description}</p>

<ReadMore>{Astro.locals.t('package-catalog.readmore.start')} <a {href}> {Astro.locals.t('package-catalog.readmore.end')}</a></ReadMore>
<ReadMore>{Astro.locals.t('package-catalog.readmore.start')} <a {href}> {Astro.locals.t('package-catalog.readmore.end')}{(href.startsWith('https://') || href.startsWith('http://')) && ''}</a></ReadMore>

<>{ index < packages.length - 1 && <hr /> }</>
))
Expand Down
65 changes: 65 additions & 0 deletions docs/src/content.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { defineCollection, reference, z } from 'astro:content';
import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';
import { glob } from 'astro/loaders';

const packageCatalogSchema = z.object({
name: z.string(),
description: z.string(),
docsLink: z.string(),
githubURL: z.string(),
catalog: z
.union([z.literal('studiocms'), z.literal('community')])
.optional()
.default('studiocms'),
isPlugin: z.boolean().optional().default(false),
publiclyUsable: z.boolean().optional().default(false),
released: z.boolean().optional().default(true),
});

const baseSchema = z.object({
type: z.literal('base').optional().default('base'),
i18nReady: z.boolean().optional().default(false),
});

const integrationSchema = baseSchema.extend({
type: z.literal('integration'),
catalogEntry: reference('package-catalog'),
});

const redirectSchema = baseSchema.extend({
type: z.literal('redirect'),
redirect: z.string(),
});

export const collections = {
docs: defineCollection({
loader: docsLoader(),
schema: docsSchema({ extend: z.union([baseSchema, integrationSchema, redirectSchema]) }),
}),
i18n: defineCollection({
loader: i18nLoader(),
schema: i18nSchema({
extend: z.object({
'site-title.labels.docs': z.string().optional(),
'site-title.labels.main-site': z.string().optional(),
'site-title.labels.live-demo': z.string().optional(),
'sponsors.sponsoredby': z.string().optional(),
'package-catalog.readmore.start': z.string().optional(),
'package-catalog.readmore.end': z.string().optional(),
'integration-labels.changelog': z.string().optional(),
'contributors.core-packages': z.string().optional(),
'contributors.ui-library': z.string().optional(),
'contributors.devapps': z.string().optional(),
'contributors.plugins': z.string().optional(),
'contributors.documentation': z.string().optional(),
'contributors.website': z.string().optional(),
'contributors.bots': z.string().optional(),
}),
}),
}),
'package-catalog': defineCollection({
loader: glob({ pattern: '*.json', base: 'src/content/package-catalog' }),
schema: packageCatalogSchema,
}),
};
67 changes: 0 additions & 67 deletions docs/src/content/config.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,14 @@ import { defineStudioCMSConfig } from 'studiocms';
// ---cut---
export default defineStudioCMSConfig({
includedIntegrations: {
useAstroRobots: true,
astroRobotsConfig: {},
useInoxSitemap: true,
robotsTXT: true,
},
})
```

### `useAstroRobots`
### `robotsTXT`

- **Type:** `boolean | undefined`
- **Type:** `boolean` | `RobotsConfig{}` | `undefined`
- **Default:** `true`

Allows the user to enable/disable the use of the StudioCMS Custom `astro-robots-txt` Integration.

### `astroRobotsConfig`

- **Type:** `RobotsConfig{} | undefined{}`

Allows you to modify the default behaviour of the this Integration. For more information on this Integration please visit the [Astro Robots Integration](https://www.npmjs.com/package/astro-robots).

### `useInoxSitemap`

#### TEMPORARILY DISABLED

If you would like to still use the Inox-tools Sitemap Plugin, you can manually add it to your project's Integrations.

- **Type:** `boolean | undefined`
- **Default:** `true`

Allows the user to enable/disable the use of the Inox-tools Sitemap Plugin. For more information on this Integration please visit the [Inox-tools Sitemap Integration](https://inox-tools.vercel.app/sitemap-ext).
Allows the user to enable/disable the use of the StudioCMS Custom `astro-robots-txt` Integration. For more information on this Integration please visit the [Astro Robots Integration](https://www.npmjs.com/package/astro-robots).
17 changes: 4 additions & 13 deletions docs/src/content/docs/config-reference/renderer-config/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import ReadMore from '~/components/ReadMore.astro';

The Markdown Content Renderer to use for rendering pages within StudioCMS

- **Type:** `'marked'` | `'markdoc'` | `'astro'` | `'mdx'` | `CustomRenderer`
- **Default:** `'marked'`
- **Type:** `'astro'` | `'markdoc'` | `'mdx'` | `CustomRenderer`
- **Default:** `'astro'`

`renderer` determines how Markdown content should be rendered in `studioCMS`. This is used to setup your content data. The default value is `marked` but you can also use `markdoc` or `astro` which uses Astro's built-in Remark processor.
`renderer` determines how Markdown content should be rendered in `studioCMS`. This is used to setup your content data. The default value is `astro` which uses the Astro built-in markdown processor but you can also use `markdoc`, `mdx` or define a Custom Renderer.

### Usage

Expand All @@ -24,22 +24,13 @@ import { defineStudioCMSConfig } from 'studiocms';
// ---cut---
export default defineStudioCMSConfig({
rendererConfig: {
renderer: 'marked',
markedConfig: {},
renderer: 'astro',
markdocConfig: {},
mdxConfig: {},
},
})
```

## `markedConfig`

`markedConfig` is an object that is used to determine how content should be rendered in the `studioCMS`. This is used to setup your content data.

### Usage

<ReadMore>[See `markedConfig` for full options](/config-reference/marked-config)</ReadMore>

## `markdocConfig`

<ReadMore>`markdocConfig` is an object that is used to determine how content should be rendered in `studiocms` while using the MarkDoc renderer.</ReadMore>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This property has the following options:

### `renderType`

- **Type:** `'html' | 'react-static' | markdocRenderer`
- **Type:** `'html' | 'react-static' | MarkdocRenderer`

The MarkDoc content renderer type to use for rendering pages and posts can be `html`, `react-static` or a custom markdocRenderer.

Expand Down
Loading

0 comments on commit 0805c10

Please sign in to comment.