Skip to content

Commit

Permalink
Merge pull request #1998 from vivid-planet/merge-next-into-feature-me…
Browse files Browse the repository at this point in the history
…nu-rework

Merge `next` into `feature/menu-rework`
  • Loading branch information
johnnyomair authored Apr 25, 2024
2 parents dc8bb6a + acfeecd commit 75ab6aa
Show file tree
Hide file tree
Showing 1,560 changed files with 35,037 additions and 14,207 deletions.
5 changes: 5 additions & 0 deletions .changeset/atlantic-scallop-fisherman
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/cms-api": patch
---

API Generator: Disable input generation if `create` and `update` are set to `false` in the decorator
16 changes: 16 additions & 0 deletions .changeset/beige-chefs-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@comet/eslint-config": major
---

Enforce PascalCase for enums

Changing the casing of an existing enum can be problematic, e.g., if the enum values are persisted in the database.
In such cases, the rule can be disabled like so

```diff
+ /* eslint-disable @typescript-eslint/naming-convention */
export enum ExampleEnum {
attr1 = "attr1",
}
+ /* eslint-enable @typescript-eslint/naming-convention */
```
7 changes: 7 additions & 0 deletions .changeset/brave-carpets-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin": major
---

Add `@comet/admin-theme` as a peer dependency

`@comet/admin` now uses the custom `Typography` variants `list` and `listItem` defined in `@comet/admin-theme`.
5 changes: 5 additions & 0 deletions .changeset/brave-kiwis-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": minor
---

Add `StackToolbar`, a variant of `Toolbar` component that hides itself in a nested stack
57 changes: 57 additions & 0 deletions .changeset/bright-dolls-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
"@comet/cms-api": major
---

Remove CDN config from DAM

It was a bad idea to introduce this in the first place, because `@comet/cms-api` should not be opinionated about how the CDN works.

Modern applications require all traffic to be routed through a CDN. Cloudflare offers a tunnel, which made the origin-check obsolete, so we introduced a flag to disable the origin check.

Also changes the behavior of the `FilesService::createFileUrl()`-method which now expects an options-object as second argument.

## How to migrate (only required if CDN is used):

Remove the following env vars from the API

```
DAM_CDN_ENABLED=
DAM_CDN_DOMAIN=
DAM_CDN_ORIGIN_HEADER=
DAM_DISABLE_CDN_ORIGIN_HEADER_CHECK=false
```

If you want to enable the origin check:

1. Set the following env vars for the API

```
CDN_ORIGIN_CHECK_SECRET="Use value from DAM_CDN_ORIGIN_HEADER to avoid downtime"
```

_environment-variables.ts_

```
@IsOptional()
@IsString()
CDN_ORIGIN_CHECK_SECRET: string;
```

_config.ts_

```
cdn: {
originCheckSecret: envVars.CDN_ORIGIN_CHECK_SECRET,
},
```

2. Add CdnGuard

```
// if CDN is enabled, make sure all traffic is either coming from the CDN or internal sources
if (config.cdn.originCheckSecret) {
app.useGlobalGuards(new CdnGuard({ headerName: "x-cdn-origin-check", headerValue: config.cdn.originCheckSecret }));
}
```

3. DNS changes might be required. `api.example.com` should point to CDN, CDN should point to internal API domain
7 changes: 7 additions & 0 deletions .changeset/brown-kids-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin": major
---

Create a subroute by default in `SaveBoundary`

The default path is `./save`, you can change it using the `subRoutePath` prop.
6 changes: 6 additions & 0 deletions .changeset/calm-plums-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@comet/cms-admin": major
"@comet/cms-api": major
---

Change language field in User and CurrentUser to locale
21 changes: 21 additions & 0 deletions .changeset/chilled-walls-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"@comet/eslint-config": major
---

Add the rule `@typescript-eslint/prefer-enum-initializers` to require enum initializers

```ts
//
enum ExampleEnum {
One = "One",
Two = "Two"
}
```

```ts
//
enum ExampleEnum {
One,
Two
}
```
5 changes: 5 additions & 0 deletions .changeset/clever-clocks-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin-color-picker": major
---

Replace the `componentsProps` prop with `slotProps` in `ColorPicker` and remove the `ColorPickerComponentsProps` type
8 changes: 8 additions & 0 deletions .changeset/cold-humans-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/cms-admin": major
---

Add `@comet/admin-theme` as a peer dependency

`@comet/cms-admin` now uses the custom `Typography` variants `list` and `listItem` defined in `@comet/admin-theme`.

2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["comet-admin-stories", "comet-demo-api", "comet-demo-admin", "comet-demo-site", "comet-docs"],
"ignore": ["comet-storybook", "comet-demo-api", "comet-demo-admin", "comet-demo-site", "comet-docs"],
"snapshot": {
"useCalculatedVersion": true
}
Expand Down
5 changes: 5 additions & 0 deletions .changeset/cool-kiwis-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin-theme": major
---

Rework theme of MUI's `Chip` to match the updated Comet CI
8 changes: 8 additions & 0 deletions .changeset/curvy-moles-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/admin-theme": major
---

Rework `typographyOptions`

- Replace `typographyOptions` with `createTypographyOptions()` to enable using the theme's breakpoints for media queries
- Add new styles for `button` variant
8 changes: 8 additions & 0 deletions .changeset/cyan-drinks-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/admin": major
---

Change theming method of `Menu`

- Rename `permanent` class-key to `permanentDrawer` and `temporary` class-key to `temporaryDrawer`
- Replace the `permanentDrawerProps` and `temporaryDrawerProps` props with `slotProps`
7 changes: 7 additions & 0 deletions .changeset/cyan-ladybugs-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/cms-api": minor
---

API Generator: Add `list` option to `@CrudGenerator()` to allow disabling the list query

Related DTO classes will still be generated as they might be useful for application code.
6 changes: 6 additions & 0 deletions .changeset/early-news-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@comet/cms-admin": major
"@comet/cms-api": major
---

CRUD Generator: Remove `lastUpdatedAt` argument from update mutations
21 changes: 21 additions & 0 deletions .changeset/eighty-owls-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"@comet/admin-theme": major
---

Rework colors

- Rename `bluePalette` to `primaryPalette`
- Rename `neutrals` to `greyPalette`
- Remove `greenPalette`
- Remove `secondary` from `paletteOptions`
- Change colors in all palettes
- Change `text` colors
- Add `highlight` colors `purple`, `green`, `orange`, `yellow` and `red` to palette

Hint: To use the `highlight` colors without getting a type error, you must adjust the `vendors.d.ts` in your project:

```diff
+ /// <reference types="@comet/admin-theme" />

// ...
```
5 changes: 0 additions & 5 deletions .changeset/fair-clouds-poke.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/fast-pens-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/cms-site": minor
---

Deprecate `InternalLinkBlock` component, instead there should be a copy of this component in the application for flexibility (e.g., support for internationalized routing)
7 changes: 7 additions & 0 deletions .changeset/fluffy-oranges-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/cms-api": major
---

Make `@nestjs/platform-express` a peer dependency

Make sure that `@nestjs/platform-express` is installed in the application.
7 changes: 7 additions & 0 deletions .changeset/fluffy-sheep-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/cms-site": major
---

Bump styled-components peer dependency to v6

Follow the official [migration guide](https://styled-components.com/docs/faqs#what-do-i-need-to-do-to-migrate-to-v6) to upgrade.
59 changes: 59 additions & 0 deletions .changeset/forty-hounds-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
"@comet/blocks-api": major
"@comet/cms-api": major
---

Support "real" dependency injection in `BlockData#transformToPlain`

Previously we supported poor man's dependency injection using the `TransformDependencies` object in `transformToPlain`.
This is now replaced by a technique that allows actual dependency injection.

**Example**

```ts
class NewsLinkBlockData extends BlockData {
@BlockField({ nullable: true })
id?: string;

transformToPlain() {
// Return service that does the transformation
return NewsLinkBlockTransformerService;
}
}

type TransformResponse = {
news?: {
id: string;
slug: string;
};
};

@Injectable()
class NewsLinkBlockTransformerService implements BlockTransformerServiceInterface<NewsLinkBlockData, TransformResponse> {
// Use dependency injection here
constructor(@InjectRepository(News) private readonly repository: EntityRepository<News>) {}

async transformToPlain(block: NewsLinkBlockData, context: BlockContext) {
if (!block.id) {
return {};
}

const news = await this.repository.findOneOrFail(block.id);

return {
news: {
id: news.id,
slug: news.slug,
},
};
}
}
```

Adding this new technique results in a few breaking changes:

- Remove dynamic registration of `BlocksModule`
- Pass `moduleRef` to `BlocksTransformerMiddlewareFactory` instead of `dependencies`
- Remove `dependencies` from `BlockData#transformToPlain`

See the [migration guide](https://docs.comet-dxp.com/docs/migration/migration-from-v6-to-v7) on how to migrate.
31 changes: 31 additions & 0 deletions .changeset/fresh-buckets-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
"@comet/admin-date-time": major
---

Change `DatePicker` and `DateRangePicker` values from `Date` to `string`

This affects the `value` prop and the value returned by the `onChange` event.

The value of `DatePicker` is a string in the format `YYYY-MM-DD`.
The value of `DateRangePicker` is an object with `start` and `end` keys, each as a string in the format `YYYY-MM-DD`.

The code that handles values from these components may need to be adjusted.
This may include how the values are stored in or sent to the database.

```diff
- const [date, setDate] = useState<Date | undefined>(new Date("2024-03-10"));
+ const [date, setDate] = useState<string | undefined>("2024-03-10");
return <DatePicker value={date} onChange={setDate} />;
```

```diff
const [dateRange, setDateRange] = useState<DateRange | undefined>({
- start: new Date("2024-03-10"),
- end: new Date("2024-03-16"),
+ start: "2024-03-10",
+ end: "2024-03-16",
});
return <DateRangePicker value={dateRange} onChange={setDateRange} />;
```

The reason for this change is that when selecting a date like `2024-04-10` in a timezone ahead of UTC, it would be stored in a `Date` object as e.g. `2024-04-09T22:00:00.000Z`. When only the date is saved to the database, without the time, it would be saved as `2024-04-09`, which differs from the selected date.
7 changes: 7 additions & 0 deletions .changeset/fresh-sheep-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/cms-site": major
---

Upgrade to Next 14 and React 18

Add "use client" directive to components that currently require it (as they use styled-components or a context)
7 changes: 7 additions & 0 deletions .changeset/gentle-chefs-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin": major
---

Remove the `requiredSymbol` prop from `FieldContainer` and use MUIs native implementation

This prop was used to display a custom required symbol next to the label of the field. We now use the native implementation of the required attribute of MUI to ensure better accessibility and compatibility with screen readers.
5 changes: 5 additions & 0 deletions .changeset/gentle-pots-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin-theme": minor
---

Slightly increase the default size of dialogs
8 changes: 8 additions & 0 deletions .changeset/giant-apples-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/cms-api": major
---

API Generator: Generate better API for Many-to-one-relations with `orphanRemoval` activated where the reverse side has its own API generated

- Add `id` as argument to create mutation
- Add `id` as argument to list query
19 changes: 19 additions & 0 deletions .changeset/good-squids-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@comet/cms-site": minor
---

Store site preview scope in cookie and add `previewParams()` helper to access it

- Requires the new `SITE_PREVIEW_SECRET` environment variable that must contain a random secret (not required for local development)
- Requires a Route Handler located at `app/api/site-preview/route.ts`:

```ts
import { sitePreviewRoute } from "@comet/cms-site";
import { createGraphQLFetch } from "@src/util/graphQLClient";
import { type NextRequest } from "next/server";

export const dynamic = "force-dynamic";

export async function GET(request: NextRequest) {
return sitePreviewRoute(request, createGraphQLFetch());
}
Loading

0 comments on commit 75ab6aa

Please sign in to comment.