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

feat(collections): Source collections from category tree #871

Merged
merged 12 commits into from
Jul 30, 2021

Conversation

tlgimenes
Copy link
Contributor

@tlgimenes tlgimenes commented Jul 28, 2021

What's the purpose of this pull request?

This PR is the first iteration after this discussion #825 .
This PR makes StoreCollection to be sourced by @vtex/gatsby-source-vtex for Brands/Categories. Also, this exports the PLP contentType from the CMS and adds first class support to the catalog in the CMS plugin.

How it works

@vtex/gatsby-source-vtex has gained a new parameter. This parameter is called: sourceCollections. When this param is set, the plugin will list all categories/brands and create a corresponding StoreCollection for each.

@vtex/gatsby-plugin-cms now exports a new contentType called PLP. When sourcing data, if gatsby-plugin-cms encounters an instance PLP, it will get the corresponding StoreCollection and add this PLP as a foreign key of StoreCollection and add the corresponding SearchParams.

In the end, the store will have the following schema:
image

Future Work

As you can see, this is only a partial implementation of what's described on #825 and requires more PRs to fully implement the RFC. I intend to do more PRs later to finish implementing the other use cases discussed on #825 and incremental builds. I didn't do all in one single PR because this would create a HUGE PR.

How to test it

The sole intent of this PR is to create new data to the Gatsby's data layer and nothing should change in any store having this version. Make sure this is the case for:
https://github.com/vtex-sites/storecomponents.store/pull/1060
https://github.com/vtex-sites/btglobal.store/pull/729
https://github.com/vtex-sites/marinbrasil.store/pull/572

@netlify
Copy link

netlify bot commented Jul 28, 2021

✔️ Deploy Preview for storeui ready!

🔨 Explore the source changes: e0b1a54

🔍 Inspect the deploy log: https://app.netlify.com/sites/storeui/deploys/6103fde028a18400072b6035

😎 Browse the preview: https://deploy-preview-871--storeui.netlify.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 28, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e0b1a54:

Sandbox Source
Store UI Typescript Configuration

@tlgimenes tlgimenes added this to the Gatsby Incremental Builds milestone Jul 29, 2021
@tlgimenes tlgimenes marked this pull request as ready for review July 29, 2021 15:21
@tlgimenes tlgimenes requested a review from a team as a code owner July 29, 2021 15:21
packages/gatsby-plugin-cms/README.md Outdated Show resolved Hide resolved
packages/gatsby-plugin-cms/README.md Outdated Show resolved Hide resolved
packages/gatsby-plugin-cms/README.md Outdated Show resolved Hide resolved
packages/gatsby-plugin-cms/README.md Outdated Show resolved Hide resolved
packages/gatsby-plugin-cms/README.md Outdated Show resolved Hide resolved
@tlgimenes tlgimenes force-pushed the chore/cms-collections branch from ee9b278 to 3763e15 Compare July 29, 2021 17:40
@tlgimenes tlgimenes force-pushed the chore/cms-collections branch from 3d20afa to 0ebc2dc Compare July 29, 2021 17:46
Co-authored-by: Larícia Mota <lmmc2@cin.ufpe.br>
packages/gatsby-plugin-cms/README.md Outdated Show resolved Hide resolved
packages/gatsby-plugin-cms/README.md Outdated Show resolved Hide resolved
packages/gatsby-plugin-cms/README.md Outdated Show resolved Hide resolved
packages/gatsby-plugin-cms/README.md Outdated Show resolved Hide resolved
packages/gatsby-plugin-cms/src/gatsby-node.ts Outdated Show resolved Hide resolved
tlgimenes and others added 2 commits July 30, 2021 10:21
Co-authored-by: Igor Brasileiro <brasileiro456@gmail.com>
@tlgimenes tlgimenes merged commit e4ca79a into master Jul 30, 2021
@tlgimenes tlgimenes deleted the chore/cms-collections branch July 30, 2021 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants