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

Add support for a runAction in the plop API #322

Open
crutchcorn opened this issue May 21, 2020 · 3 comments
Open

Add support for a runAction in the plop API #322

crutchcorn opened this issue May 21, 2020 · 3 comments
Assignees

Comments

@crutchcorn
Copy link
Member

crutchcorn commented May 21, 2020

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

@crutchcorn crutchcorn self-assigned this May 21, 2020
@amwmedia
Copy link
Member

yeah, I would just look at PR plopjs/node-plop#58. It was put up a long time ago and I always meant to merge it, but I wanted to see if I could get the full plop API injected into the function. Anyway, it might be worth just merging it as is.

@crutchcorn
Copy link
Member Author

I think I agree with you, though. I'd rather inject the API into plopAPI itself. I have a branch where I'm working on just that. I'll see if I can clean it up this week

@crutchcorn
Copy link
Member Author

Transfering this issue to https://github.com/plopjs/plop/ since we're migrating all of node-plop to that repo as a monorepo

@crutchcorn crutchcorn transferred this issue from plopjs/node-plop Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants