Skip to content

Add support for a runAction in the plop API #322

@crutchcorn

Description

@crutchcorn

Currently, if I'm inside of a plop action and want to run a add or addMany, my option is really reduced to making a new generator and running the generator's generator.runActions.

It would be really nice if instead of this:

const {default: generatorDefault} = require('node-plop/lib/generator-runner');

plop.setActionType('setupAzureNPM', async (answers, config, plop) => {
  const {runGeneratorActions} = generatorDefault(plop)
  await runGeneratorActions({
    name: 'Azure NPM Setup',
      actions: [
        {
          type: 'add',
          // ...
        }
      ]
  })
});

We could have something like this:

plop.setActionType('setupAzureNPM', async (answers, config, plop) => {
  await plop.runAction({
    type: 'add',
    // ...
   })
});

To run a single action from the plop API

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions