pluginpal / strapi-plugin-config-sync

:recycle: CLI & GUI for continuous migration of config data across environments
https://www.pluginpal.io/plugin/config-sync
MIT License
255 stars 37 forks source link

Feat: Import/export for types with populated components #93

Closed PhilippPaoli closed 1 year ago

PhilippPaoli commented 1 year ago

What does it do?

Change Strapi Query Engine Api to Strapi entityService Api. Add parameter "populate" to plugin config.

Why is it needed?

Export and import types with populated components.

How to test it?

Use this example config:

export default ({ env }) => ({
  "config-sync": {
    enabled: true,
    config: {
      customTypes: [
        {
          configName: "accordion",
          queryString: "api::accordion.accordion",
          uid: "accordionUid",
          populate: [
            "populate.testA.firstLevel",
            "populate.testA.secondLevel",
            "populate.testB,firstLevel",
          ],
        },
      ],
      importOnBootstrap: false,
    },
  },
});

Related issue(s)/PR(s)

https://github.com/boazpoolman/strapi-plugin-config-sync/issues/73

boazpoolman commented 1 year ago

I'll try and test this asap

PhilippPaoli commented 1 year ago

This PullRequest is not about a relation between two Single/Collection Types. I want to make sure that Single/CollectionTypes that have components are saved up to the specified level.

Example:

There is a component link: image

This component is added in a SingleType to provide multiple links (repeatable): image

The content of the SingleType looks like: image

The API of the SingleType then looks like: image

With the customization from this PullRequest, we can extend the backup to the lower levels (populate): image

Without this adjustment you get only the first level: image

The plugin config for populate components looks like: image

PhilippPaoli commented 1 year ago

Thanks @boazpoolman for the comment.

I took your suggestions and described the new property "components" under "Custom Types" a little bit. Probably it would be great to document "relations" as well. Additionally the EsLint warning is fixed.

boazpoolman commented 1 year ago

Tested the PR and everything seems to work. Made some small adjustments, but nothing game changing.

Sadly this PR seems to break the integration tests, but I can't figure out why. Will have to do some further investigation.

The failed pipeline https://github.com/boazpoolman/strapi-plugin-config-sync/actions/runs/6098423438/job/16548241406?pr=93

PhilippPaoli commented 1 year ago

@boazpoolman

Seems to be working. What’s blocking? Anything I can do to support or do to resolve a issue. Though looking at the log at … I do not see what is going wrong.

boazpoolman commented 1 year ago

Hi @PhilippPaoli,

Last time I checked I couldn't find out why the integration tests were failing. I have confirmed that they do work on the master branch, and something in your PR seems to have broken them. I will do some further investigation soon.

PhilippPaoli commented 1 year ago

Hi @boazpoolman,

Could it be that it is still due to version 1.1.2? I have tested the changes in the pull request with version 1.1.3, so far the integration test is completed successfully.

Maybe a rebase could be helpful

image

boazpoolman commented 1 year ago

I've rebased your PR, though sadly the integration tests are still failing. See here the output https://github.com/boazpoolman/strapi-plugin-config-sync/actions/runs/6467296746/job/17557081644?pr=93

I've also made a commit on the master branch and that resulted in a successfull tests run. See the successfull pipeline here https://github.com/boazpoolman/strapi-plugin-config-sync/actions/runs/6467436741

That means something in this PR is causing this issue. We just have to do some debugging to see what that is. Probably just one by one reverting all your changes and as soon as the tests start working again we will have pinpointed the exact changed that caused the issue.

PhilippPaoli commented 1 year ago

Hi @boazpoolman,

the integration test should now run successfully.

PhilippPaoli commented 1 year ago

Hi @boazpoolman,

thanks for merging :)