plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
426 stars 574 forks source link

create-react-app like functionality #72

Closed nileshgulia1 closed 5 years ago

nileshgulia1 commented 6 years ago

(See full discussion here.) plone-react should have create-react-app like functionality i.e using a package boilerplate inside project and extend it to zero configuration.The theme should be pastanaga which may used as a boilerplate theme so that user can initialise a plone project with zero configuration.It also covers #68 so that a create -plone -app will also be a PWA. This was listed under GSOC projects list for plone foundation. I would love to work on it. @tisto

nileshgulia1 commented 6 years ago

Here's the approach I have decided to follow so far:

  1. Trigger create-react-app to create a new app with a provided app name.
    1. Configure, download and install a list of additional packages.(Here power of webpack and other tools may be needed).
    2. Replace the default template files with new files as needed.(May be pastanaga theme will be in use here).
nileshgulia1 commented 6 years ago

@tisto This is the small snippet I have implemented so far for executing CRA command for a given app name

let appName = process.argv[2] //it  will pull the provided app name out of the parameters of our shell command.
let appDirectory = `${process.cwd()}/${appName}` //store the path to the directory that CRA is going to create.

const run = async () => {
  let success = await createReactApp()
  if(!success){
    console.log('Something went wrong while trying to create a new React app using create-react-app'.red)
    return false;
  }

  console.log("All done")
}
run()
const createReactApp = () => {
  return new Promise(resolve=>{
    if(appName){ //If appname provided then execute CRA command
      shell.exec(`create-react-app ${appName}`, () => {
        console.log("Created react app")
        resolve(true)
      })

    }else{
      console.log("\nNo app name was provided.")
      console.log("\nProvide an app name in the following format: ")
      console.log("\ncreate-react-app ", "app-name\n")
        resolve(false)
    }
  })
}
nileshgulia1 commented 6 years ago

@tisto Can we use fork of react-scripts instead of ejecting the whole app so that we can have only those configurations which we need without loosing all configs?

tisto commented 6 years ago

@nileshgulia1 yes. I guess that is the idea. Our fork of react-scripts should contain the "library parts" of plone-react, the webpack config, the server side rendering, etc.. What do you think @robgietema?

nileshgulia1 commented 6 years ago

@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. Quick Proof of concept : https://github.com/nileshgulia1/App-generator-CRA

nileshgulia1 commented 6 years ago

https://github.com/facebook/create-react-app/issues/682 @sneridagh @robgietema We can use --scripts version and specify our own scripts , What do you think ?

sneridagh commented 6 years ago

@nileshgulia1 yes, I think it's the official way to go I guess. Next week we will meet in a sprint in Bonn and we will discuss all this there. We'll keep you posted!

robgietema commented 6 years ago

I'm not sure the --scripts version will do the job for us, since it will only overwrite the scripts which are available in create-react-app and you won't be able to add other ones we currently use (like yarn prettier, yarn lint etc).

nileshgulia1 commented 6 years ago

@robgietema @tisto Don't we create our own custom-react-scripts like this one https://medium.com/@kitze/configure-create-react-app-without-ejecting-d8450e96196a ?

nileshgulia1 commented 6 years ago

@tisto @sneridagh May be we can make plone-react a base package and install it as an dependency in our app generator and use pastanaga as template scripts. I need your thoughts about this for writing a strong proposal.

tisto commented 6 years ago

@nileshgulia1 we looked into this today at our sprint in Bonn. We could schedule a hangout tomorrow to discuss this if you are up to it. Any other student who is interested in the create-react-app functionality is also welcome to join.

nileshgulia1 commented 6 years ago

@tisto That's great I"ll join you guys tomorrow :)

tisto commented 6 years ago

@nileshgulia1 what time would you prefer? We will start tomorrow morning at 9 am CET. In which time zone are you?

nileshgulia1 commented 6 years ago

@tisto I am in IST (UTC +5:30) , 9 am CET means 1:30 pm here , that's fine I can join you :)

tisto commented 6 years ago

@nileshgulia1 ok, then let's do it at 11 am CET? That gives us a bit of time in the morning to work on other stuff...

nileshgulia1 commented 6 years ago

@tisto can we please keep 9 am or 10 am CET? as I have exams to attend in university . We can schedule it after 1 pm CET also if you like?

tisto commented 6 years ago

Sure. 10 am is fine.

Von meinem iPhone gesendet

Am 14.03.2018 um 04:09 schrieb Nilesh notifications@github.com:

@tisto can we please keep 9 am or 10 am CET? as I have exams to attend in university .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

tisto commented 6 years ago

@nileshgulia1 please join our sprint hangout:

https://hangouts.google.com/hangouts/_/kitconcept.com/plonereactsprint2018

ajayns commented 6 years ago

@tisto This hangout would be just regarding the create-react-app functionality?

tisto commented 6 years ago

@ajayns yes

tisto commented 6 years ago

@ajayns if you are interested into working on plone-react itself, we might be able to do another hangout today.

ajayns commented 6 years ago

@tisto Sure! That sounds great! Do let me know the when you're planning to do the hangout.

tisto commented 6 years ago

@ajayns are you available for a quick chat on IRC? Join the #sprint channel on freenote and ping me (tisto).

nileshgulia1 commented 6 years ago

@tisto Is there any way I can contact(chat) with you guys about technical details of the project and proposal besides this thread?

tisto commented 6 years ago

@nileshgulia1 sure. either IRC (freenode #sprint or #plone) or the plone slack channel. You can also email me (tisto@plone.org).

ajayns commented 6 years ago

@tisto Sorry I was afk a while back. I've joined the chat.

tulikavijay commented 6 years ago

if there is another hangout or chat session do let me know, i had my exams this month so i was inactive for a while.

ajayns commented 6 years ago

@tulikavijay Of course will let you know. Right now though, plone-react is up and running and they're eager to move forward with it, so @tisto has outlined a possible project proposal idea for plone-react here: https://github.com/plone/plone-react/issues/115

robgietema commented 5 years ago

Merged to master.