Core: extension skeleton, generator overhaul

Created on 5 Apr 2016  路  12Comments  路  Source: flarum/core

Related to:
https://discuss.flarum.org/d/2435-now-in-beta-5-how-to-build-extension

The code:
https://github.com/flarum/core/blob/master/src/Console/Command/GenerateExtensionCommand.php#L54

  • Supresses any errors when mkdir fails, thus failing all over without any indication what went wrong. Mkdir returns a boolean based on the state of running it, also it might be wise to simply use the file adapter anyway?
  • The command uses the depreciated extensions directory. Even if you want to create development packages there, it might cause too much confusion.
  • Wouldn't it be better if the command used studio instead?
needs-discussion typbug

All 12 comments

Seems this is legacy code and needs an overhaul.. :) Reference to flarum.json also exists for instance.

Renamed this issue to reflect the work that is necessary to complete it. Seems like the PR by @sijad is stalled due to some feedback necessary from both Toby and @franzliedke. @franzliedke can you jump onto the PR and formulate a list of required changes to get it done?

I think I wrote this somewhere else (in one of the Gitter chats)... I think we should remove the extension generator altogether from b6 and not have this block b6 release. We can get a fixed version into a later release.

Ok, let's move this to stable for now and discuss how to solve this in the future. @jordanjay29 please summarise some of the options.

Just a suggestion to use a bash script instead of PHP. Our extension devs are usually savvy enough to run a command line script, let them execute an config.sh or something, enter in their custom path values and vendor/package names, and let the script fix all the files. Seems like this would be more useful and reliable than a PHP method.

Doesn't matter to me when it gets done, the extension generator is a nice idea but not necessarily a must-have for beta 6.

I'm agree with jordanjay29,
I personally prefer a bash command or cloning a repository or even a yeoman generator.

I am fully against using any other language for this. Instead I think it should be possible to easily create a commandline generator using PHP. Something like muse could help kickstart this. I think the team has sufficient experience to easily get something like this up as a separate package.

@franzliedke or @sijad can either of you drop the generator command for now? I'll create a separate ticket for this #1045 .

Further discussion in this issue is about how to implement a new skeleton generator, thank you!

For the future: Writing this in Bash or any other language does not help much, as it does not fix the underlying problem, which is how to make Composer load the generated work-in-progress extension. A tool like my Studio does something like this, but I don't think it should be required for something like this.

Generating the code for an extension - in my opinion - should not be a responsibility of the Flarum package at all. If we are going to maintain such a generator, it should probably be a commandline tool, the same way Studio or Composer is. We can even have such a tool create a clean checkout from an existing skeleton repo, have it automatically replace some variables, ask for a new git remote and do the first commit on behalf of the user. Stuff like that would, most likely, kickstart any new dev.

I am fine with that as well. That would probably mean that I will build a minimal skeleton functionality into Studio.

The generator is no longer part of Flarum; there are community solutions and other, far more advanced tools, so I am closing this for lack of concrete action steps.

Was this page helpful?
0 / 5 - 0 ratings