WordPress / wporg-repo-tools

6 stars 4 forks source link

Generate projects from templates #19

Open ryelle opened 2 years ago

ryelle commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

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 commented 2 years ago

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.