-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a Field Module template repo #422
Comments
Yes! Reminder that I had started something a while back over here: https://github.com/mstenta/farm_client_module_template That mainly included a GitHub Action for running Now that we've decided Field Modules will only target farmOS 2.x, we can refresh on where we left off with the template ideas. It will simplify it greatly if we don't need to include files for farmOS 1.x support as well. |
And I had documented some of our next step decisions in the issue queue of that project: https://github.com/mstenta/farm_client_module_template/issues |
I'm also curious to take a look at the https://www.drush.org/commands/10.x/generate/ Do I recall you mentioning a similar option that |
Oh also I want to bring our attention to this discussion in the TL;DR: we may find that we need to use GitHub for packaging, but also mirror repos on drupal.org so that translatable strings can be found for localize.drupal.org... (Sorry maybe not directly relevant to this issue, but didn't want to lose track...) |
Sort of? There's no standard npm script for doing it. Really what I was thinking was just creating a Node CLI tool that could be run and would scaffold the project, probably by prompting some questions then interpolating the template with things like the module name, etc. I had in mind something like I think it really depends on what we're trying to generate, and how much interpolation is required. I'd prefer to use a Node tool, b/c that's what I and other JS devs will be used to, but if it's way easier with Drush, then we should probably start with that. |
Makes sense! I've never used Drush Generate myself - I think it provides similar potential, but I agree that JS devs are more likely to be the target audience. Let's find a time to do another live sketch session where we mock up the required directory structure, without the D7 stuff we were including before... A template repo is a simple first step and can provide a start to a CLI tool in the future, perhaps. |
Kind of a similar concept, I've created a repository demonstrating how to embed a Vue.js app as a farmOS contrib module; https://github.com/symbioquine/farmOS_vue_page_demo |
Oh nice! This could also be relevant to the idea we've discussed of using Field Kit's Vue component library in farmOS itself (farmOS/farmOS#239). I'll definitely have to revisit this and dig deeper into what you've done here. |
I'm looking at options for a separate build process for #446 and came across a few options that could make it quite feasible, even easy, to write a Node CLI tool for scaffolding a Field Module project: |
A few more resources... I looked up command line frameworks, and seems like there 3 popular options:
Commander is definitely at the top of the heap, but yargs is also pretty well established. oclif (Open CLI Framework) is the hot new thing, made by Salesforce, which seems to have a lot of fans. I also rewatched the Fireship CLI tutorial, which had some other good libraries to recommend:
Top among those is inquirer, which I'll definitely want for getting the name and other package info for the template. |
Maybe not strictly related to the template repo, but I found this Vite plugin that might be useful for bundling modules: |
Another great example of a similar templating tool is I don't think I even need to worry about using a tool like Rollup's |
I was just looking into this in another context the other day. Another option is described here: https://rclayton.silvrback.com/templatizing-github-template-repos |
Oh, I like that, @symbioquine, nice find! I've come to the conclusion that it's probably best to avoid using GH Template Repos entirely for this, because (as that post's author pointed out) they don't really provide a whole lot of utility other than deleting the npx create-field-module field-module-compost # then answer some Q's via CLI
cd field-module-compost/
npm start # opens dev server at localhost:8080 |
Seems like a good idea to settle on a structure for this with the first sprint of module development. It would be good to revisit directory structure when we do this, too, since we only need to support farmOS 2.x.
The text was updated successfully, but these errors were encountered: