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

Possible to make a Multi Level Menu / Sub Menu? #421

Open
tobiashochguertel opened this issue Mar 23, 2024 · 2 comments
Open

Possible to make a Multi Level Menu / Sub Menu? #421

tobiashochguertel opened this issue Mar 23, 2024 · 2 comments

Comments

@tobiashochguertel
Copy link

Is it possible to build a structured menu as following

- React
   | --> Component
   | --> Layout
   | --> Page
   | --> Service
   | --> hook
- TypeSpec (OpenAPI)
   | --> Interface
   | --> Model
- Spring Boot 3
   | --> RestController
   | --> Repository
   | --> ...

When I select React in the first level, that I get then a list of the different plopjs-generators which are sorted under the React menu point?

@amwmedia
Copy link
Member

have you tried inquirer tree prompt?

@tobiashochguertel
Copy link
Author

inquirer tree prompt helps, but the main question is how to call another generator from inside of a generator?

plop.setGenerator('menu', {
    description: 'Languages / Frameworks',
    prompts: [
        {
            type: 'tree',
            name: 'selection',
            message: 'What would you like to do?',
            validate: (value) => !!value,
            tree: createMenu(frameworks)
        }
    ],
    actions: async function (response) {
        console.log(JSON.stringify(response));
        return await plop.load(`./${response.selection}/generator.js`);
    }
});

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

2 participants