Create-react-app for Plone-react

So, the idea is to add create-react-app like functionality to plone-react.This is the new app generator that we may use for initialising plone sites just with a single command like create-plone-react app or so. We may use Pastanaga UI as a boilerplate theme.Also we can extend this by adding PWA functionality to it as CRA is a PWA itself.

Here's the basic approach I have decided to follow so far (correct me if I missed something):

  1. Trigger create-react-app to create a new app with a provided app name.
  2. Configure, download and install a list of additional packages.(Here power of webpack and other tools may come in handy).
  3. Replace the default template files with new files as needed.(May be pastanaga theme will be in use here).
    This is listed under GSOC projects list. Any feedback regarding is appreciated.

Have you reviewed Plone CLI and whether it would be better to extend that? Note that Plone CLI is Python (as opposed to Javascript) and serves a similar function for bootstrapping Plone projects.

Is it used to create plone packages? I've never used it before but sure I will try it. Can it be used with pastanaga ui?

Not yet, Pastanaga is new stuff. I'm sure it can be extended to support (whatever that means) in the future. That said, a Javascript implementation like create-react-app might make sense also.

1 Like

This looks like something proper to start with @nileshgulia1
Anyways, it'd be really helpful if we got some ideas on what technologies/packages to use and how to implement all this together as an app.

@ajayns. Create-React-App provides some convenience features, such as: a live development environment, boilerplate code, and standard dependencies pre-installed, we'll implement something like this only.Developers can initiate applications via Create-Plone-react app with confidence that the tools and configurations will allow them to take their application from development to deployment.
we"ll try to adhere to some guidelines for the project:

  1. The generator shouldn’t require create-react-app to be ejected. That way apps generated with the tool can be easily upgraded to new versions of react-scripts.
  2. The template should follow create-react-app's convention:
    create-[plone-react] [app-name] to make it feel immediately familiar to people who already use CRA.
  3. And at last it also should require zero configuration.

We'll use pastanaga ui(which I'am currently not much aware of) in reacts-scripts/templates to generate a boilerplate code(ui).
Currently I'am working with insides of CRA, How it is implemented and exploring the folders inside. When the plone-react repo actives I'll start implementing it asap.
Excited to work on it in future :slight_smile:

The idea is solid and looks good, thanks for the clarification. But my question was mostly directed at the Plone mentors to know what they had in mind so we both can be in sync and also suggest new ideas if they look promising.

The is the basic idea which probably mentors will have in mind as this is the straightforward approach(for me :blush:) . I'am making a demo app for this which is also a react-app generator implementing this approach, may be mentors may get a clarity after seeing it implemented.

Looking forward to see this app generator which you are talking about then! Do share the link and also mention if you want any assistance in implementing it!

@tkimnguyen @tisto Here's the approach I have decided to follow so far. I have tried to implement a basic app generator out of Create-react-app. It talks to plone.restapi and sends a GET request. Right now the app just replaces the CRA’s templates files with our own and adds additional packages without ejecting the initial configuration. I am struggling with when to use eject feature of CRA and when not to use it. Can anyone help me clearing the doubt please?
Quick Proof of concept : https://github.com/nileshgulia1/App-generator-CRA

1 Like

@tisto @tkimnguyen How about creating a fork of react-scripts with simple babel/webpack modifications that can toggle extra features and using flags like --scripts version on the cli?Again it will not eject the whole app.

1 Like

@nileshgulia1 can we please move the discussion to https://github.com/plone/plone-react/issues/72? Some of the core developers do not follow community.plone.org...

1 Like

Sure.

@datakurre I have drafted a proposal for create-react-app for plone-react. Can you please review it and provide me feedback?