collective / gatsby-starter-plone

Gatsby starter for Plone
https://collective.github.io/gatsby-starter-plone/
MIT License
4 stars 3 forks source link

Refactor into gatsby-theme-plone #22

Closed datakurre closed 5 years ago

datakurre commented 5 years ago

@ajayns Any change you have been able to look into how Gatsby themes work?

For me they look like exactly like these starter packages, but intended to be used as such, optionally with some configuration options.

I wonder, if it would be possible to refactor gatsby-starter-plone so that it could be both used as a starter package, but also released as gatsby-theme-plone?

The most obvious issue would be that before GatsbyJS has graphql schema "snapshots" , the "theme" would not build until the target site has content with the required types. But maybe that could be handled with theme options? (User would be able to define included types as options and then the build would only require those types.)

This would also make a great GSOC topic, but unfortunately I can only mentor one and for myself I would priorize the preview issue.

iFlameing commented 5 years ago

@datakurre I started working on this issue. thanks

ajayns commented 5 years ago

I've looked through what it is over the top but I don't know enough to point towards the changes required for porting gatsby-starter-plone to gatsby-theme-plone or if it's something that could be really beneficial to us.

@iFlameing Thanks for starting up on the issue, I'd recommend reading up on Themes and since they're pretty new you might encounter issues whose solution might not be documented yet, but thankfully Gatsby has a great community.

I'll try to take some time into comparing and hopefully come up with the steps that'd be required to port

iFlameing commented 5 years ago

@datakurre @ajayns I created a repo for gatsby-plone-theme. when I am executing command gatsby-develop in site folder all things works fine but got this error can you look into it.please!. screenshot from 2019-02-18 20-45-58

datakurre commented 5 years ago

So does that component/file exist?

If not, maybe these lines in gatsby-node.js generate path wrong

      createPage({
        path: node._path,
        component: path.resolve('./src/templates/default.js'),
      });
iFlameing commented 5 years ago

@datakurre yes the component path is wrong it should reference the gatsby-theme-plone src but right now it is referencing the site src. can you help me how I can reference the correct folder in gatsby-node.js.

iFlameing commented 5 years ago

currently, I changed the component path to "../packages/gatsby-plone-theme/src/templates/default.js" and now it is working fine. What should I do now?

iFlameing commented 5 years ago

@datakurre I don't want to disturb you. But I am really stuck at this point. can you tell me what should be my next step?

datakurre commented 5 years ago

https://stackoverflow.com/questions/32705219/nodejs-accessing-file-with-relative-path#32707530

iFlameing commented 5 years ago

@datakurre thanks for help! I successfully compiled all the files and all things work fine. what should I do now?

datakurre commented 5 years ago

@ajayns What do you think should be the relation of gatsby-starter-plone and gatsby-theme-plone? I’d guess gatsby-starter-plone is the one you customize and gatsby-theme-plone is the one you could use OOTB in a minimal gatsby project, but it feels bad to maintain two almost similar packages.

iFlameing commented 5 years ago

@datakurre I refactor the code gatsby-starter-plone into gatsby-theme-plone and also made a simple working website. You can see both of them in the respective url. https://github.com/iFlameing/gatsby-theme-plone https://github.com/iFlameing/gatsby-theme-plone-Example-website

datakurre commented 5 years ago

@iFlameing Thank you. Because we don’t know yet, how to avoid duplicating code between gatsby-starter and gatsby-theme, we better not to and we could have your theme as such. Would you like to pass its (gatsby-theme-plone) ownership to GitHub user “collective”? That way your original version would live aside gatsby-starter-plone and gatsby-source-plone under github.com/collective.

iFlameing commented 5 years ago

@datakurre when I am transferring the gatsby-theme-plone repo to collective it is giving me an error

You don’t have the permission to create repositories on collective

datakurre commented 5 years ago

Ok. Could you give me enough right to the repo so that I could do it? On 25 Feb 2019, 16.04 +0200, Alok Kumar notifications@github.com, wrote:

@datakurre when I am transferring the gatsby-theme-plone repo to collective it is giving me an error You don’t have the permission to create repositories on collective — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

iFlameing commented 5 years ago

@datakurre I added you as collaborators in gatsby-theme-plone. https://github.com/iFlameing/gatsby-theme-plone/invitations

datakurre commented 5 years ago

That does not seem to be enough to move it. Sure we could fork it,  it then GitHub UI might propose future pull requests to go to your original version instead of collective version :/ (And you may not want to join to “collective” yet,  because it is 95% Python :) On 25 Feb 2019, 19.01 +0200, Alok Kumar notifications@github.com, wrote:

@datakurre I added you as collaborators in gatsby-theme-plone. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

iFlameing commented 5 years ago

@datakurre Then what should I do so that it is possible for you to transfer the repo to the collective :). (And I didn't create any python project yet but I know python not very advanced but basic).

iFlameing commented 5 years ago

I can join collective, I love python but I didn't spend so much time with it but looking forward in this summer to learn some advanced concept.

iFlameing commented 5 years ago

can you assign me another issue because this is now completed?

datakurre commented 5 years ago

@iFlameing Ok. Please, file an "Please, add me to the Collective" issue here https://github.com/collective/Collective/issues/ Organization membership should give you permission to create new repositories there and therefore allow you to transfer plone-theme-gatsby there.

I'll add an issue for the theme.

datakurre commented 5 years ago

I'll close this, once we have collective link for the repo :)

datakurre commented 5 years ago

@ajayns @tisto FYI. @iFlameing has done PoC of Gatsby Theme from gatsby-starter-plone.

https://collective.github.io/gatsby-theme-plone/

https://github.com/collective/gatsby-theme-plone/

it includes an example project using the theme

https://github.com/collective/gatsby-theme-plone/tree/master/tests/gatsby-plone-site

Interesting feature I was not aware of: it is trivial to override theme provided components in the site project itself: https://github.com/collective/gatsby-theme-plone/blob/master/tests/gatsby-plone-site/src/gatsby-theme-plone/components/NewsItem.js

ajayns commented 5 years ago

Wow this is amazing! Sorry I haven't been able to add much to this, been quite caught up.