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

Boilerplate tempate(s?) idea #256

Open
artfulrobot opened this issue Jul 29, 2022 · 0 comments
Open

Boilerplate tempate(s?) idea #256

artfulrobot opened this issue Jul 29, 2022 · 0 comments

Comments

@artfulrobot
Copy link

(Sorry, I'm in an ideas mood today after returning from Exeter sprint yesterday!)

Several civix jobs are boilerplate creating jobs. May we add to those via hooks implemented in extensions, for example?

Use case:

I'm seeing a lot of interest recently about Inlay. Creating a new inlay is pretty simple - I was able to demo it in 15 mins. But there is some boilerplate.

It struck me that if I could implement civix generate:inlay "Name of Inlay type" [OptionalShorterCodeName] it would be good for onboarding devs. Running that command would:

  • call civix generate:angular-module
  • call civix generate:angular-page x y
  • edit the ang/* files to insert some boilerplate tweaks.
  • create a Civi\Inlay\NameOfType.php class
  • somehow implement the required hook (currently I do this in hook_container, but I'd like to use HookInterface on the \Civi\Inlay\NameOfType class instead once I get it to work.
  • report the files created.
  • run a flush

I could see two options for implementation

  1. I just do a PR here to ask to add this command to civix. You might feel that you don't want a pure-core tool polluted with pesky extensions' dirty work!
  2. civix supports plugins, scans installed extensions to find classes implementing Civix\Plugin or such.
  3. (a non-option): don't implement this with civix; just provide a cli/create-inlay.php script in the Inlay extension that does the work. This feels like duplicating logic though.
  4. (another non-option): don't implement this with civix; just provide typical boilerplate code in the Inlay extension, e.g. under boilerplate/ and then give devs clear instructions.

I'm not sure how generic a requirement this is; perhaps inlay is a special case. Obviously this is not a high priority issue.

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

1 participant