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

[codemod request] Static CMS v3 Upgrade Codemods #551

Open
mohab-sameh opened this issue Dec 20, 2023 · 0 comments
Open

[codemod request] Static CMS v3 Upgrade Codemods #551

mohab-sameh opened this issue Dec 20, 2023 · 0 comments
Labels
codemod request Request new codemod good first issue Good for newcomers

Comments

@mohab-sameh
Copy link
Contributor

mohab-sameh commented Dec 20, 2023

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

@mohab-sameh mohab-sameh added good first issue Good for newcomers codemod request Request new codemod labels Dec 20, 2023
@mohab-sameh mohab-sameh changed the title [codemod request] Static CMS v3 Upgrade Codemods [INT-2352] [codemod request] Static CMS v3 Upgrade Codemods Dec 20, 2023
@mohab-sameh mohab-sameh changed the title [INT-2352] [codemod request] Static CMS v3 Upgrade Codemods [codemod request] Static CMS v3 Upgrade Codemods Dec 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
codemod request Request new codemod good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant