Skip to content
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

Generate projects from templates #19

Open
ryelle opened this issue May 4, 2022 · 4 comments
Open

Generate projects from templates #19

ryelle opened this issue May 4, 2022 · 4 comments

Comments

@ryelle
Copy link
Contributor

ryelle commented May 4, 2022

Right now the templates directory is pretty empty, but I added a branch with a child-theme template. It uses the mustache template syntax that @wordpress/create-block uses, so it would be nice to add a CLI command that could generate a project from the template like create-block does.

Maybe wporg-repo-tools becomes something you install globally, so that you can run $ repo-tools/generate child-theme and it prompts you for all the required values, then generates a child-theme in your current directory? Or something like that :)

@coreymckrill
Copy link
Contributor

It's pretty lightweight as dependencies go, so installing it globally and requiring it in composer.json (for the configs, at least) seems fine. I like the idea of having a CLI command for generating a new project 👍

@ryelle ryelle self-assigned this Jun 16, 2022
@ryelle
Copy link
Contributor Author

ryelle commented Jun 16, 2022

It looks like we can use @wordpress/create-block with a custom template directory --template or with some other custom config. Worth experimenting so we maybe don't need to rewrite a template-generator.

@ryelle
Copy link
Contributor Author

ryelle commented Jun 21, 2022

I think it would be good to create templates for the following (❗ are priorities IMO)

  • ❗ A new child theme
  • ❗ A new block plugin
  • A new entire env repo (at least the skeleton with directories set up for adding themes, plugins, etc)
  • A new regular plugin, maybe?
  • A block inside wporg-mu-plugins/mu-plugins/blocks, which might be tricky given how it's currently set up

I think we want the script to generate the files & package.json, but whether it should also do a composer.json & wporg-repo-tools depends on where it's going, so maybe let that be optional.

Unfortunately, create-block can only be used to create block-plugins, it doesn't handle other kinds of projects and we can't customize the prompts.

@ryelle
Copy link
Contributor Author

ryelle commented Jun 29, 2022

So here's where we kind-of stand on this. There isn't one single tool suggestion, and I'm not sure if that's really a bad thing.

  • ✔️ A new child theme — the PHP script in Add a basic child theme template #20. Spins up a simple 3-file theme. No build process, could probably add PostCSS step if we wanted. Could also add a JS step (if we want to bundle blocks, open question).
  • ✔️ A new block plugin — @wordpress/create-block with the default template. @wordpress/scripts build process.
  • ✔️ A mu-plugins block — @wordpress/create-block with the template in Add a basic block template for mu-plugins blocks #21. No build process because the parent project should have one.
  • 🔴 A new env repo —nothing yet.
  • ❓ A new regular plugin — I'm not sure what would be a good template.

@ryelle ryelle removed their assignment Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants