Skip to content
This repository was archived by the owner on Feb 16, 2024. It is now read-only.
This repository was archived by the owner on Feb 16, 2024. It is now read-only.

[codemod request] Static CMS v3 Upgrade Codemods #551

Description

@mohab-sameh

Codemod description

This codemod(s) should help with migrating to Static CMS v3 as described in the migration guide.

Changes required:

Update Gitea backend

While still remaining in beta, the Gitea backend has been evolving. This update switches the authentication mechanism to PKCE auth and improves performance when dealing with multiple file commits.

To use Gitea with Static CMS v3, you need to update your Gitea instance to at least v1.20. You will also need to update your config to match the setup for PKCE authentication. See Gitea authentication.

Changes specified here.

Refactor CMS Events

CMS Events have undergone a significant refactor in this update, including adding a new change event. You may need to update your config as follows to continue to use them. The preSave and postSave events along with the new change event, now require a collection be provided during registration, with an optional file if you are targeting a file collection. All events now can handle async handlers as well.

Before:

CMS.registerEventListener({
  name: 'preSave',
  handler: ({ entry }) => {
    return {
      ...entry,
      data: {
        ...entry.data,
        title: 'new title',
      },
    };
  },
});

After:

CMS.registerEventListener({
  name: 'preSave',
  collection: 'posts',
  handler: ({ data: { entry } }) => {
    return {
      ...entry.data,
      title: 'new title',
    };
  },
});

More information can be found here

Other breaking changes

  • The following Widget Control component properties have been removed:

INT-2352

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions