How can I display Plop generators based on choice?

I’m trying to configure Plop so that when the command is run, a sort of menu is first displayed prompting to select what group of generators you’d want to run. For example, you have generators for frontend files and generators for backend files. When you run plop, you should first be prompted with what group of generators you want to proceed with, then from that choice, the correspoding generators will be revealed to pick from.

Here’s what I have so far:

const controllerGenerator = require('./generators/server/controller');

module.exports = function (plop) {
  plop.setGenerator('menu', {
    description: 'Choose between client and server generators',
    prompts: [
      {
        type: 'list',
        name: 'workspace',
        message: 'Choose your workspace generator: ',
        choices: ['Client', 'Server'],
      },
    ],
    actions: (data) => {
      if (data.workspace === 'Client') {
        return [];
      } else if (data.workspace === 'Server') {
        return [controllerGenerator(plop)];
      }
    },
  });
};

I get this error when I run plop and select the server option

> plop

? Choose your workspace generator: Server
 - [ERROR] Cannot read properties of undefined (reading 'type')

Here is my controller generator:

module.exports = function (plop) {
  plop.setGenerator('controller', {
    description: 'generate controller',
    prompts: [
      {
        type: 'input',
        name: 'name',
        message: 'controller name: ',
      },
    ],
    actions: [
      {
        type: 'add',
        path: 'apps/server/src/controllers/{{kebabCase name}}-controller.js',
        templateFile: './templates/server/controller.js.hbs',
      },
    ],
  });
};

I’m assuming this has to do with the actions part of the controller generator, but I’m not sure as to what would make it not work. I’ve tried using the plop.load() function, but it just creates a no action error. Not sure how else to proceed to achieve my desired effect, which is that if I had selected the server option, then there would be the various server related generators displayed (ex: controller, router, etc.). Something like below:

> plop

? Choose your workspace generator:  Server

- controller generator
- router generator
...

and when you chose the specified generator (ex: controller generator), you would then be prompted to provide the details for it, like the name for example.

Is this feasible with plop?