Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

allow to execute subactions #58

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

macrozone
Copy link
Contributor

In plop.setActionType the third parameter ("plopfileApi") has now a new function as property

runActions(actions, data)

You can pass an array of actions, so that your custom action type will invoke all these actions as part of your custom action (like "child" actions)

See the tests or linked issue for an example.

solves plopjs/plop#103

error logging is a bit hacky, but show all infos from the sub actions as well.

@amwmedia
Copy link
Member

amwmedia commented Feb 1, 2018

I love this feature! The only thing that is bugging me is that it makes the plopfileApi different in different contexts. Not sure that there's a way around this that doesn't give up functionality. I was thinking of just letting the action return an array of more actions to run, but then you can run code AFTER the sub-actions run.

Any thoughts?

@macrozone
Copy link
Contributor Author

I think its worth it. Its not the most beautiful api, but it works and solve some issues

@amwmedia
Copy link
Member

amwmedia commented Mar 5, 2018

I'm going to spend a little time with this... I think it needs to get merged in one form or another. 👍

@macrozone
Copy link
Contributor Author

i merged master back in. Hope you can take a look soon!

@macrozone
Copy link
Contributor Author

any chance to get this merged? its tested and solves some issues

@amwmedia
Copy link
Member

yeah, I will try to get it in soon. I was reviewing the code and trying to work out a solution that doesn't create a variant API inside the action. Then life got crazy :-). I'm going to revisit it this week.

@macrozone
Copy link
Contributor Author

@amwmedia any updates ;-) i know, its not the best to reinvent a new api, but its a pragmatic approach

@amwmedia
Copy link
Member

agreed, I'm trying to see if there's a way to get the full node-plop API injected into the action which would be consistent and also give this more power. I'm not 100% sure that using the node-plop API is the right approach here, but I wanted to rule it out before moving forward with a hybrid API that is 99% the same as the plop API.

@crutchcorn
Copy link
Member

We're moving the node-plop codebase into a monorepo. @macrozone if you want to re-open this PR over there, I'll be happy to re-review.

This repo will be archived in a short bit.

https://github.com/plopjs/plop/tree/master/packages/node-plop

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants