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: integrate with VTEX headless CMS #104
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Preview is readyThis pull request generated a Preview👀 Preview: https://sfj-bc92bb2--gatsby.preview.vtex.app |
Lighthouse ReportsHere are the Lighthouse reports of this Pull Request📝 Based on commit bc92bb2
|
a225840
to
e546006
Compare
a20ac44
to
ccb772f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! And the tests worked fine!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I liked the strategy, however, I don't see us using the same strategy on Next.JS or similar. I'd rather go with a strategy we don't use the gatsby-plugin-cms
and useStaticQuery
. Also, I found it weird to have components specific for cms com components/cms
I'm leaning towards having a first class integration between CMS and the starter on the pages
folder so that it's easy to remove by changing the pages
folder
@@ -1,5 +1,5 @@ | |||
import { lazy, Suspense } from 'react' | |||
import Alert from 'src/components/common/Alert' | |||
import Alert from 'src/components/cms/common/Alert' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird. We have a CMS component affecting non CMS pages, since Layout.tsx is being imported on gatsby-browser.tsx
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Gimenes' points. Will we be doing this in future iterations of this feature?
I believe we can close this one in favor of #172. |
What's the purpose of this pull request?
This PR adds CMS capabilities to
gatsby.store
. It addresses mostly parts of the CMS Spike. This PR:gatsby.store
withstoreframework
vtex store;The script to remove all cms related code is not done but will be tackled later.
How does it work?
Firstly, I followed the cms tutorial to integrate
gatsby.store
with storeframework, then I followed the structure already created at storeframework.store to render things using CMS data.Regarding code architecture
Since we want to easily remove CMS-related code from the repo, I've added CMS components and pages in the same structure already used for non-cms stuff. i.e:
pages/index.tsx
pages/cms/index.tsx
components/common/Alert
components/cms/common/Alert
This way, it'd be easy to create a script that removes all cms-related code and overwrites it properly.
How to test it?
Open the preview link. The global alert should be working with the message defined at the CMS. Which says:
Alert from master
. The link should send to/office
.You should also want to visit
/cms
and see if it's everything fine.References
https://www.faststore.dev/tutorials/cms-overview
https://github.com/vtex-sites/storeframework.store
Checklist
You may erase this after checking them all ;)
Changelog
CHANGELOG.md
at the beginning of its due section. The latest version should comes first.CHANGELOG.md
. E.g., New items in thepull_request_template.md
(#12)PR Description
Breaking change
,Enhancement
,Bug
orChore
.ComponentName
component.useWindowDimensions
hook.Documentation