Skip to content

Commit

Permalink
Merge branch 'issue-0351' into adam/experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
Adammatthiesen committed Oct 17, 2024
2 parents 95eb9e9 + 90440e8 commit cc4af7d
Show file tree
Hide file tree
Showing 253 changed files with 8,893 additions and 8,069 deletions.
10 changes: 10 additions & 0 deletions .changeset/curvy-mirrors-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@studiocms/ui": patch
---

Applied various changes and fixes to different parts of the UI libary.

- Fixed a CSS leak caused by importing css files instead of having scoped styles
- Adjusted dropdown helper API for better DX
- Adjusted modal helper API for better DX
- Various CSS fixes for different components
7 changes: 7 additions & 0 deletions .changeset/thin-hounds-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@studiocms/dashboard": patch
"@studiocms/core": patch
"studiocms": patch
---

Adjusted strings to account for Astro Studio sunsetting
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"editor.defaultFormatter": "biomejs.biome"
"editor.defaultFormatter": "biomejs.biome",
"[mdx]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
24 changes: 1 addition & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,7 @@ To see how to get started, check out the [StudioCMS README](./packages/studiocms

## Contributing

We welcome contributions from the community! Whether it's bug reports, feature requests, or code contributions, we appreciate your help in making this project better.

### Bug Reports and Feature Requests

If you encounter any bugs or have ideas for new features, please open an issue on our [GitHub repository](https://github.com/astrolicious/studiocms). When creating a new issue, please provide as much detail as possible, including steps to reproduce the issue (for bugs) and a clear description of the proposed feature.

### Code Contributions

If you'd like to contribute code to this project, please follow these steps:

1. Fork the repository and create a new branch for your contribution.
2. Make your changes and ensure that the code follows our coding conventions and style guidelines.
3. Write tests for your changes, if applicable.
4. Update the documentation, if necessary.
5. Commit your changes and push them to your forked repository.
6. Open a pull request against the main repository, providing a clear description of your changes and their purpose.

We will review your contribution as soon as possible and provide feedback or merge it into the main codebase if everything looks good.

Please note that by contributing to this project, you agree to our [Code of Conduct](https://github.com/astrolicious/.github/blob/main/.github/CODE_OF_CONDUCT.md).

Thank you for your interest in contributing to this project!
We welcome contributions from the community! Whether it's bug reports, feature requests, or code contributions, we appreciate your help in making this project better. To get started read our [Contributing Guide](https://docs.studiocms.xyz/start-here/contributing/)

## Chat with Us

Expand Down Expand Up @@ -80,7 +59,6 @@ Steps to get a running playground should be the following:
Commands to run:

- `pnpm playground:login` - Login your CLI to Astro Studio
- `pnpm playground:link` - Link to Astro Studio and Create a new DB for your CMS Installation
- `pnpm playground:push` - Creates the base tables on the remote database.
- `pnpm playground:dev` - Starts the Dev server connected to the linked database

Expand Down
5 changes: 4 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
"linter": {
"enabled": true,
"rules": {
"recommended": true
"recommended": true,
"suspicious": {
"noExplicitAny": "warn"
}
}
},
"overrides": [
Expand Down
14 changes: 8 additions & 6 deletions packages/studiocms/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import { defineStudioCMSConfig, defineStudioCMSPlugin } from '@studiocms/core/lib';
import type { CustomRenderer, Renderer, StudioCMSOptions } from '@studiocms/core/schemas';
import type { StudioCMSPluginOptions } from '@studiocms/core/types';
import integration from './integration';

/**
* # Astro Studio CMS Integration
* **StudioCMS Integration**
*
* A CMS built for Astro by the Astro Community for the Astro Community.
*
* Checkout our [GitHub Repo `@astrolicious/studiocms`](https://github.com/astrolicious/studiocms)
*
* Check out [Astro-StudioCMS.xyz](https://astro-studiocms.xyz) or the Built-in JSDocs *(Hover Docs like this)* for more information.
*
* > **Note: Astro SSR adapters that are configured for Image Optimization will automatically take full control of the Image Optimization Service. Making the `imageService` option in this integration not have any effect.**
*
* @see [GitHub Repo: 'astrolicious/studiocms'](https://github.com/astrolicious/studiocms) for more information on how to contribute to StudioCMS.
* @see [StudioCMS Docs](https://docs.studiocms.xyz) for more information on how to use StudioCMS.
*
*/
export const studioCMS = integration;

export default studioCMS;

// Config Utility
export { defineStudioCMSConfig };
export { defineStudioCMSConfig, type StudioCMSOptions };

// Plugin System
export { defineStudioCMSPlugin, type StudioCMSPluginOptions };

export type { CustomRenderer, Renderer };
9 changes: 6 additions & 3 deletions packages/studiocms_blog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ const studioCMSBlogTheme = defineTheme({
export type ATP_ThemeOptions = Parameters<typeof studioCMSBlogTheme>[0];

/**
* # StudioCMS Blog Theme(Integration)
* #### Powered by [`astro-theme-provider`](https://github.com/astrolicious/astro-theme-provider) by [Bryce Russell](https://github.com/BryceRussell)
* **StudioCMS Blog Theme(Integration)**
*
* **Powered by [`astro-theme-provider`](https://github.com/astrolicious/astro-theme-provider) by [Bryce Russell](https://github.com/BryceRussell)**
*
* This theme provides a Blog Index Page and RSS Feed for your StudioCMS Site as well as route handling for Blog Posts.
*
* @example
* ```js
* import { defineConfig } from 'astro/config';
* import db from '@astrojs/db';
* import studioCMS from 'studiocms';
Expand All @@ -41,8 +43,9 @@ export type ATP_ThemeOptions = Parameters<typeof studioCMSBlogTheme>[0];
* }),
* ],
* });
* ```
*/
export function studioCMSBlog(options: ATP_ThemeOptions) {
export function studioCMSBlog(options?: ATP_ThemeOptions) {
let slug: string;

if (typeof options?.pages?.['/blog'] === 'string') {
Expand Down
2 changes: 1 addition & 1 deletion packages/studiocms_core/src/components/Avatar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const { isLoggedIn, dbUser: userProfile } = Astro.locals;
))
}
{ enabled === false && (
<a href="#" aria-disabled="true" title="Please Edit your Database through your Studio Dashboard">
<a href="#" aria-disabled="true" title="Please Edit your database through your provider's dashboard">
<img
src={profileImg.src}
alt="Authentication Disabled"
Expand Down
2 changes: 1 addition & 1 deletion packages/studiocms_core/src/lib/defineStudioCMSConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { StudioCMSOptions } from '../schemas';
* @example
* ```js
* // studiocms.config.mjs
* import { defineStudioCMSConfig } from '@astrolicious/studiocms';
* import { defineStudioCMSConfig } from 'studiocms';
*
* export default defineStudioCMSConfig({
* dbStartPage: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/studiocms_core/src/schemas/config/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { unocssConfigSchema } from './unocss';
export const dashboardConfigSchema = z
.object({
/**
* OPTIONAL - This allows the user to enable or disable the Astro Studio CMS Dashboard but still provide all the helper's and utilities to those who are customizing their setup, doing so will disable the dashboard and you will need to manage your content via the Astro Studio Dashboard at http://studio.astro.build
* OPTIONAL - This allows the user to enable or disable the Astro StudioCMS dashboard but still provide all the helper's and utilities to those who are customizing their setup, doing so will disable the dashboard and you will need to manage your content via your database
*
* @default true
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/studiocms_core/src/schemas/config/developer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const developerConfigSchema = z
/**
* Enable Testing and Demo Mode
*
* This will enable the testing and demo mode for the Astro Studio CMS Dashboard, this will allow you to test the dashboard without having to authenticate. This is useful for testing and demo purposes as it will allow you to see how the dashboard works and looks but disable any changes to the database.
* This will enable the testing and demo mode for the Astro StudioCMS dashboard, this will allow you to test the dashboard without having to authenticate. This is useful for testing and demo purposes as it will allow you to see how the dashboard works and looks but disable any changes to the database.
*
* @default false
*/
Expand Down
16 changes: 13 additions & 3 deletions packages/studiocms_core/src/schemas/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@ import { dashboardConfigSchema } from './dashboard';
import { DefaultFrontEndConfigSchema } from './defaultFrontend';
import { imageServiceSchema } from './imageService';
import { includedIntegrationsSchema } from './integrations';
import { type StudioCMSRendererConfig, StudioCMSRendererConfigSchema } from './rendererConfig';
import {
type CustomRenderer,
type Renderer,
type StudioCMSRendererConfig,
StudioCMSRendererConfigSchema,
} from './rendererConfig';

//
// Exported Schemas for use in other internal packages
//
export { StudioCMSRendererConfigSchema, type StudioCMSRendererConfig };
export {
StudioCMSRendererConfigSchema,
type StudioCMSRendererConfig,
type CustomRenderer,
type Renderer,
};
export { dashboardConfigSchema, DefaultFrontEndConfigSchema, imageServiceSchema, overridesSchema };

//
Expand Down Expand Up @@ -64,4 +74,4 @@ export const StudioCMSOptionsSchema = z
.optional()
.default({});

export type StudioCMSOptions = z.infer<typeof StudioCMSOptionsSchema>;
export type StudioCMSOptions = typeof StudioCMSOptionsSchema._input;
14 changes: 14 additions & 0 deletions packages/studiocms_core/src/schemas/config/rendererConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ import { mdxConfigSchema } from './mdx';
export type Renderer = (content: string) => Promise<string>;
export type { markdocRenderer };

/**
* Custom Renderer Type
* @description A custom renderer that can be used in StudioCMS
* @property {string} name - The name of the renderer
* @property {Renderer} renderer - The renderer function
* @example
* ```ts
* const customRenderer: CustomRenderer = {
* name: 'custom',
* renderer: async (content: string) => {
* return content;
* },
* };
*/
export type CustomRenderer = {
name: string;
renderer: Renderer;
Expand Down
8 changes: 4 additions & 4 deletions packages/studiocms_core/src/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export const CoreStrings = {
};

export const DbErrors = {
AstroConfigOutput: "Astro Studio CMS is only supported in 'Output: server' SSR mode.",
AstroConfigOutput: "Astro StudioCMS is only supported in 'Output: server' SSR mode.",
AstroConfigSiteURL:
"Astro Studio CMS requires a 'site' configuration in your Astro Config. This can be your domain ( 'https://example.com' ) or localhost ( 'http://localhost:4321' - localhost should only be used during development and should not be used in production).",
"Astro StudioCMS requires a 'site' configuration in your Astro Config. This can be your domain ( 'https://example.com' ) or localhost ( 'http://localhost:4321' - localhost should only be used during development and should not be used in production).",
DbStartPage:
'Start Page is Enabled. This will be the only page available until you initialize your database and disable the config option forcing this page to be displayed. To get started, visit http://localhost:4321/start/ in your browser to initialize your database. And Setup your installation.',
astroDbMissingMessage: 'Astro DB Integration not found in Astro Config',
Expand Down Expand Up @@ -39,10 +39,10 @@ export const DashboardStrings = {
Setup: 'Setting up StudioCMS Dashboard...',
AddIntegrations: 'Adding Dashboard Integrations...',
TestAndDemo:
'Testing and Demo Mode is Enabled, Authentication will not be required to access dashboard pages. But you will only be able to edit the database from the Astro Studio Dashboard, https://studio.astro.build/',
'Testing and Demo Mode is Enabled, Authentication will not be required to access dashboard pages. But you will only be able to edit the database directly',
AuthEnabled: 'Auth is Enabled, Setting Up...',
AuthDisabled:
'Auth is Disabled by the User Configuration. You will only be able to edit the database from the Astro Studio Dashboard, https://studio.astro.build/',
'Auth is Disabled by the User Configuration. You will only be able to edit the database directly',
AuthRoutes: 'Setting up Auth Routes...',
DashboardEnabled: 'Dashboard is Enabled.',
DashboardDisabled:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if (permissionLevel !== 'admin') {

<div class="py-2">
<span>
Note: To delete admins you can do this from your Astro Studio Dashboard.
Note: To delete admins you can do this from your database.
</span>
</div>

Expand Down
5 changes: 5 additions & 0 deletions packages/studiocms_devapps/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import integration from './integration';

/**
* **StudioCMS DevApps**
*
* A Collection of useful tools available during dev mode in Astro.
*/
export const devApps = integration;

export default devApps;
3 changes: 3 additions & 0 deletions packages/studiocms_devapps/src/schema/appsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { z } from 'astro/zod';

export const AppsConfigSchema = z
.object({
/**
* libSQLViewer App Config
*/
libSQLViewer: z
.object({
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/studiocms_devapps/src/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const optionsSchema = z
*/
endpointPath: z.string().optional().default('/_studiocms-devapps'),
/**
* Verbose mode
* Verbose loggin mode
* @default false
*/
verbose: z.boolean().optional().default(false),
Expand Down
2 changes: 1 addition & 1 deletion packages/studiocms_robotstxt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export interface PolicyOptions {
* [ Optional ] Indicates to the robot that the page URL contains parameters (like UTM tags) that should be ignored when indexing it.
*
* @example
* ```hash
* ```bash
* # for URLs like:
* www.example2.com/index.php?page=1&sid=2564126ebdec301c607e5df
* www.example2.com/index.php?page=1&sid=974017dcd170d6c4a5d76ae
Expand Down
Loading

0 comments on commit cc4af7d

Please sign in to comment.