FreeAllMedia / stimpak

An easy-to-use system for defining, discovering, and re-using code, text, and workflow patterns
http://stimpak.io
MIT License
8 stars 1 forks source link

Feature Request: create/run sub-generators #30

Closed warang580 closed 8 years ago

warang580 commented 8 years ago

I was reading Yeoman documentation and I saw this :

Generators scaffolding complex frameworks are likely to provide additional generators to scaffold smaller parts of a project. These generators are usually referred to as sub-generators, and are accessed as generator:sub-generator.

Take generator-angular as an example. Once the full angular app has been generated, other features can be added. To add a new controller to the project, run the controller sub-generator:

$ yo angular:controller MyNewController

Is it possible in Stimpak to make and run "sub-generators" ? Or something that would behave in a similar manner ?

dcrockwell commented 8 years ago

Combine Generators

You can .use() any other stimpak generator in your own generator, and it will seamlessly integrate all of it's features with your own:

import StimpakNpm from "stimpak-npm";
import StimpakTestDriven from "stimpak-test-driven";

export default class MyGenerator {
    setup(stimpak) {
        stimpak.use(
            StimpakNpm,
            StimpakTestDriven
        )
        .then(this.showAnswers);
    }

    showAnswers(stimpak) {
        stimpak.answers(); // All answers from stimpak-npm and stimpak-test-driven
    }
}
dcrockwell commented 8 years ago

You can also combine generators on-the-fly via the cli:

$ npm install stimpak-npm stimpak-test-driven -g --production

...

$ stimpak npm test-driven
dcrockwell commented 8 years ago

Let me know if this is the same as what you were thinking

dcrockwell commented 8 years ago

This has the latest docs: https://github.com/FreeAllMedia/stimpak/tree/feature/readme

dcrockwell commented 8 years ago

I'm currently working on: https://github.com/FreeAllMedia/stimpak/blob/feature/readme/GENERATORS.md

So if there's anything I can elaborate on in this guide, please let me know.

dcrockwell commented 8 years ago

Re-open if this is still an issue.