mstenta / farm_client_module_template

Template for building a farmOS Field Module project.
GNU General Public License v2.0
0 stars 0 forks source link

Encapsulate Webpack config etc into an npm package #5

Open mstenta opened 4 years ago

mstenta commented 4 years ago

In talking this through with @jgaehring, the main drawback of #3 is that you wouldn't be able to run it locally. The alternative is to do it with an npm package that handles all the webpack stuff, including generating PHP files (#2).

mstenta commented 4 years ago

Per @jgaehring in https://github.com/jgaehring/farm_precipitation/pull/3#issuecomment-612653468:

I think a better option would be to set up an npm script that, in addition to running the Webpack build process, also runs a Node process for assembling the necessary PHP and Drupal files. We could include some custom settings in package.json, or have a separate field-module.json file, which could provide the details specific to that module, such as it's name, label, description, etc, which could get injected automatically into the boilerplate files. Ultimately, I'd love to have something like create-react-app, where we could just have a script, which we publish to npm, then when the user runs it, it asks a few questions from the terminal and spits out a fully scaffolded project, without the need to maintain a special field-module.json file, and even the Webpack details would be hidden and rolled up into a single dependency, which they could just update periodically when they needed too.

jgaehring commented 4 years ago

A good starting place for a (mostly) blank project template might be: https://github.com/jgaehring/farm_spray/tree/96b6580624fd8e1de6b8cd765c627271819f9a62

(Just saving a reference to that commit so we have it somewhere)