molecule
molecule copied to clipboard
Use postinstall script to install additional dependencies
This is just an idea I had for making dependencies a little more dynamic. We could tie into the default npm postinstall script to launch a node script powered by inquirer that asks you a series of questions about your project setup. This would work similarly to using yarn init or yarn generate (on react-boilerplate). It would also function similarly to using yarn eject from within a create-react-app project (because the inquirer script would auto-eject after postinstall runs).
we could...
- ask what styling engine you want to use: styled-components, glamorous, css-modules, inline, etc.
- ask what state manager you want to use: redux, mobx
I'm sure there's things we could add to this script, but those are the first things that came to mind (specifically the styling options, as state managers might be too complex since they'd require multiple dependencies (i.e. react-router-redux/mobx-react-router). But when selected, the script could basically run a yarn add --dev styled-components as well as inject some boilerplate styled-components styles to give the user an idea of how to implement them.
Disclaimer
I have no idea if adding dependencies via a node script is a bad idea, I can't think of any hangups that would be encountered when doing it, but that doesn't mean there aren't any. LMK your thoughts
Definitely a big fan of a setup script, @tannerlinsley also had the idea of packaging molecule like create-react-app so it's internals are abstracted away from your app.
Please abstract. I would also rather it be more deliberate. 'Create-molecule' could install 'molecule' as a dev dep. Then you can run in your scripts 'yarn molecule start' etc. the main advantage would be a place for overrides and customization. But I guarantee it would be much more maintainable and upgradeable too. As molecule builds get faster and smaller, you will gain that for free. This is all assuming a well crafted override system I guess. On Thu, May 18, 2017 at 7:38 PM Zach Sherman [email protected] wrote:
Definitely a big fan of a setup script, @tannerlinsley https://github.com/tannerlinsley also had the idea of packaging molecule like create-react-app so it's internals are abstracted away from your app.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/timberio/molecule/issues/14#issuecomment-302585695, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCbNCzGOiNPapKx9rFmzEsHilwztBks5r7PKLgaJpZM4Nf5aw .
yeah an override system is a must, one of the biggest things CRA is lacking. Almost every app I've created using CRA has forced me to eject at some point, most of the time because I need a custom webpack loader (for something as simple as svg). I'm unsure how we could make the boilerplate able to swap out libraries for things like styling though. We could of course leave that up to the individual person to require it, but that kind of takes away from the point of a boilerplate. It's nice to be able to get up and running without having to add dependencies to your project when using a boilerplate.