Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge @comet/admin-theme into @comet/admin #3479

Merged
merged 9 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .changeset/lazy-pears-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
"@comet/admin-theme": major
"@comet/admin": major
---

Remove the `@comet/admin-theme` package and move all of its exports into `@comet/admin`

This includes the following values and functions: `breakpointsOptions`, `breakpointValues`, `createCometTheme`, `createTypographyOptions`, `errorPalette`, `greyPalette`, `infoPalette`, `paletteOptions`, `primaryPalette`, `shadows`, `successPalette`, `warningPalette`.

**Migrating your project**

1. Remove the `@comet/admin-theme` dependency from your project

2. Change all imports from `@comet/admin-theme` to `@comet/admin`

```diff
-import { createCometTheme } from "@comet/admin-theme";
+import { createCometTheme } from "@comet/admin";

const theme = createCometTheme();
```

3. Remove the no longer required type overrides that were previously required for the custom `Typography` variants, typically located in `admin/src/vendors.d.ts`

```diff
-/// <reference types="@comet/admin-theme" />
```
1 change: 0 additions & 1 deletion demo/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"@comet/admin": "workspace:*",
"@comet/admin-date-time": "workspace:*",
"@comet/admin-icons": "workspace:*",
"@comet/admin-theme": "workspace:*",
"@comet/cms-admin": "workspace:*",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
Expand Down
2 changes: 1 addition & 1 deletion demo/admin/src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { createCometTheme } from "@comet/admin-theme";
import { createCometTheme } from "@comet/admin";

export const theme = createCometTheme();
1 change: 0 additions & 1 deletion demo/admin/src/vendors.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="vite/client" />
/// <reference types="@comet/admin-theme" />

/* eslint-disable @typescript-eslint/no-explicit-any */
declare module "*.svg" {
Expand Down
12 changes: 2 additions & 10 deletions demo/admin/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const adminPackagesHotReloadPlugin: Plugin = {
this.addWatchFile("../../packages/admin/admin-icons/src");
this.addWatchFile("../../packages/admin/admin-react-select/src");
this.addWatchFile("../../packages/admin/admin-rte/src");
this.addWatchFile("../../packages/admin/admin-theme/src");
this.addWatchFile("../../packages/admin/blocks-admin/src");
this.addWatchFile("../../packages/admin/cms-admin/src");
},
Expand Down Expand Up @@ -91,14 +90,7 @@ export default defineConfig(({ mode }) => {
global: "globalThis",
},
},
include: [
"@comet/admin",
"@comet/admin-rte",
"@comet/admin-date-time",
"@comet/admin-icons",
"@comet/admin-theme",
"@comet/cms-admin",
],
include: ["@comet/admin", "@comet/admin-rte", "@comet/admin-date-time", "@comet/admin-icons", "@comet/cms-admin"],
},
resolve: {
alias: {
Expand All @@ -109,4 +101,4 @@ export default defineConfig(({ mode }) => {
outDir: "build",
},
};
});
});
15 changes: 4 additions & 11 deletions dev-pm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const packageFolderMapping = {
"@comet/admin-date-time": "packages/admin/admin-date-time",
"@comet/admin-icons": "packages/admin/admin-icons",
"@comet/admin-rte": "packages/admin/admin-rte",
"@comet/admin-theme": "packages/admin/admin-theme",
"@comet/cms-admin": "packages/admin/cms-admin",
"@comet/cms-api": "packages/api/cms-api",
"@comet/cms-site": "packages/site/cms-site",
Expand Down Expand Up @@ -45,31 +44,25 @@ module.exports = {
script: "pnpm --filter @comet/admin-rte run start",
group: ["comet-admin"],
},
{
name: "comet-admin-theme",
script: "pnpm --filter @comet/admin-theme run start",
group: ["comet-admin"],
waitOn: waitOnPackages("@comet/admin-icons", "@comet/admin-rte", "@comet/admin", "@comet/admin-color-picker"),
},

// group cms-admin
{
name: "cms-admin",
script: "pnpm --filter @comet/cms-admin run start",
group: ["cms-admin", "cms"],
waitOn: waitOnPackages("@comet/admin", "@comet/admin-icons", "@comet/admin-rte", "@comet/admin-theme"),
waitOn: waitOnPackages("@comet/admin", "@comet/admin-icons", "@comet/admin-rte"),
},
{
name: "cms-admin-codegen-graphql-types",
script: "pnpm --filter @comet/cms-admin run generate-graphql-types:watch",
group: ["cms-admin", "cms"],
waitOn: waitOnPackages("@comet/admin", "@comet/admin-icons", "@comet/admin-rte", "@comet/admin-theme"),
waitOn: waitOnPackages("@comet/admin", "@comet/admin-icons", "@comet/admin-rte"),
},
{
name: "cms-admin-codegen-block-types",
script: "pnpm --filter @comet/cms-admin run generate-block-types:watch",
group: ["cms-admin", "cms"],
waitOn: waitOnPackages("@comet/admin", "@comet/admin-icons", "@comet/admin-rte", "@comet/admin-theme"),
waitOn: waitOnPackages("@comet/admin", "@comet/admin-icons", "@comet/admin-rte"),
},

//group cms-api
Expand Down Expand Up @@ -107,7 +100,7 @@ module.exports = {
script: "pnpm --filter comet-demo-admin run start",
group: ["demo-admin", "demo"],
waitOn: [
...waitOnPackages("@comet/admin", "@comet/admin-icons", "@comet/admin-rte", "@comet/admin-theme", "@comet/cms-admin"),
...waitOnPackages("@comet/admin", "@comet/admin-icons", "@comet/admin-rte", "@comet/cms-admin"),
"tcp:$API_PORT",
],
},
Expand Down
12 changes: 1 addition & 11 deletions docs/docs/5-admin-components/components/Typography.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@ Use the [Typography](https://mui.com/material-ui/react-typography/) component pr

## Custom variants

`@comet/admin-theme` defines two custom `Typography` variants:
The theme from `@comet/admin` defines two custom `Typography` variants:

- `list`
- `listItem`

You can use them to display lists in continuous text:

<Story path="Typography" />

### TypeScript

You must tell TypeScript to include the type overrides defined in `@comet/admin-theme`.
Otherwise, you will get a type error when trying to use the custom variants.
You can do that by adding the following snippet to your `src/vendors.d.ts` file:

```ts
/// <reference types="@comet/admin-theme" />
```
1 change: 0 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"@comet/admin-date-time": "workspace:*",
"@comet/admin-icons": "workspace:*",
"@comet/admin-rte": "workspace:*",
"@comet/admin-theme": "workspace:*",
"@docusaurus/core": "^3.7.0",
"@docusaurus/preset-classic": "^3.7.0",
"@docusaurus/theme-common": "^3.7.0",
Expand Down
6 changes: 3 additions & 3 deletions docs/src/components/Story.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createCometTheme } from "@comet/admin-theme";
import BrowserOnly from "@docusaurus/BrowserOnly";
import CodeBlock from "@theme/CodeBlock";
import type { Props as PlaygroundProps } from "@theme/Playground";
Expand All @@ -16,7 +15,6 @@ const importStory = async (name: string) => {
};

export const Story = ({ path, ...props }: StoryProps) => {
const theme = createCometTheme();
const [code, setCode] = useState("");

useEffect(() => {
Expand All @@ -29,7 +27,9 @@ export const Story = ({ path, ...props }: StoryProps) => {
// https://docusaurus.io/docs/docusaurus-core/#browseronly

// eslint-disable-next-line @typescript-eslint/no-require-imports
const { MuiThemeProvider } = require("@comet/admin");
const { createCometTheme, MuiThemeProvider } = require("@comet/admin");

const theme = createCometTheme();

return (
<IntlProvider locale="en">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ContentOverflow, MuiThemeProvider } from "@comet/admin";
import { createCometTheme } from "@comet/admin-theme";
import { ContentOverflow, createCometTheme, MuiThemeProvider } from "@comet/admin";
import { Typography } from "@mui/material";

function Story() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ContentOverflow, MuiThemeProvider } from "@comet/admin";
import { ContentOverflow, createCometTheme, MuiThemeProvider } from "@comet/admin";
import { Preview } from "@comet/admin-icons";
import { createCometTheme } from "@comet/admin-theme";
import { Typography } from "@mui/material";

function Story() {
Expand Down
6 changes: 0 additions & 6 deletions docs/src/theme/ReactLiveScope/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ if (ExecutionEnvironment.canUseDOM) {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const cometAdminColorPickerImports = require("@comet/admin-color-picker");
// eslint-disable-next-line @typescript-eslint/no-require-imports
const cometAdminThemeImports = require("@comet/admin-theme");
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { Card, CardContent, FormControlLabel, Grid, Chip, IconButton, Typography, Box } = require("@mui/material");
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { Form } = require("react-final-form");
Expand Down Expand Up @@ -84,10 +82,6 @@ if (ExecutionEnvironment.canUseDOM) {
name: "@comet/admin-color-picker",
imports: cometAdminColorPickerImports,
},
{
name: "@comet/admin-theme",
imports: cometAdminThemeImports,
},
{
name: "@mui/material",
imports: { Card, CardContent, FormControlLabel, Grid, Chip, IconButton, Typography, Box },
Expand Down
4 changes: 0 additions & 4 deletions knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
"project": ["./src/**/*.{ts,tsx}"],
"ignoreDependencies": ["jest-junit", "@mui/x-data-grid-pro"]
},
"packages/admin/admin-theme": {
"entry": ["./src/index.ts"],
"project": ["./src/**/*.{ts,tsx}"]
},
"packages/admin/admin-color-picker": {
"entry": ["./src/index.ts"],
"project": ["./src/**/*.{ts,tsx}"]
Expand Down
3 changes: 0 additions & 3 deletions packages/admin/admin-theme/.babelrc.json

This file was deleted.

1 change: 0 additions & 1 deletion packages/admin/admin-theme/.npmignore

This file was deleted.

1 change: 0 additions & 1 deletion packages/admin/admin-theme/.prettierignore

This file was deleted.

Loading
Loading