mediacurrent/theme_generator_8

Evaluating Generator Foundation - Possibly moving away from Yeoman

Closed this issue · 1 comments

The current setup in the Theme Generator uses Yeoman for putting together the final theme. This issue is to discuss the possibility of replacing Yeoman with another technology option.

Challenges With Yeoman

Yeoman is a powerful scaffolding tool that can be used to create deep, complex sites and structures. There are a lot of features and capabilities within the tool that are not being utilized because they're outside of the needs of the Theme Generator. The software is not something that is commonly used or known within Mediacurrent which results in a significant knowledge gap when maintaining the generator. There are significant breaking updates to Yeoman that should be implemented, but would require a much deeper knowledge of the package to be able to implement.

Functional Needs of the Theme Generator

To my knowledge, the process for running the Theme Generator results in the following flow:

  1. Initiate the generator run command
  2. npm install is run on generator-required packages
  3. Choose a name for the generated theme
  4. Choose a description for the theme
  5. Choose which optional components will be installed
  6. The directory structure is created
  7. The appropriate files/folders are inserted into their locations based on what was selected
  8. Import statements and theme required files are renamed based on theme machine name
  9. npm install is run on theme-required packages
  10. Generator files are cleaned up as needed

What Does Yeoman Provide?

In the list of what happens listed above, many of the actions happening are fairly straightforward:

  • files are moved into a location
  • npm install is run
  • directories are created.

It would appear that only a few actual things are happening that Yeoman provides outside of what could be accomplished from simply cloning a repository:

  • Choosing the components that will be installed so only the ones desired are added
  • Replacing placeholder text/names with the machine name of the theme
  • Automatically running npm install

Alternatives

As of now I haven't had time to research alternatives specifically. However, the functionality of replacing placeholder text and renaming the files are both possible with simple task runners such as Gulp, which is already in use throughout the organization. Having to run npm install as a part of the process doesn't seem like a significant request of whoever is running the generator.

Requirements

Any replacement solution would need to, at minimum:

  • provide the file and folder structure consistent with what's needed for a drupal theme
  • allow the user to set the theme name and have the theme files (theme.libraries.yml, theme.info.yml, etc) named appropriately
  • use the set name to set the import naming so that the twig files import as expected into each other using the structure of `{{ attach_library('theme/accordion') }}

Hey @rlahoda thanks for providing context on this. At this time I think we should keep things as they are. In addition to creating the theme Yeoman also provides the ability to create new components which not only creates the respective directory and files, but it also creates Drupal libraries and attach them to the components.

I don't thing the current workflow is perfect but since we have no immediate need to replace it nor we have another solution to replace it with, we can close this issue and keep an eye to see if something better emerges in the future. I appreciate the initiative on trying to improve our current workflow.