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

Makes `actions` accept a function #1

Merged
merged 3 commits into from Nov 28, 2015

Conversation

Projects
None yet
2 participants
@nicoespeon
Collaborator

nicoespeon commented Nov 26, 2015

Hi there!

First of all: thanks a lot for this handy tool. It's easy to setup, configure and use. It's super-flexible compared to the custom Yeoman generator we used before — no need to publish a new version and ensure everyone is up-to-date. That's awesome ;-)

In our main project we quickly ran into a use case: when we create a new module it can have a collection+model or just a model, it may need a single item view or a collection view or a composite view…

The current way to do it would be either:

  • to create one generator per scenario, which would quickly scale into a monster
  • to create a module, then to create a collection, then to create a model…

That would be nice if plop asks us if we want a model or a collection+model right during module creation, and produces everything needed as once.

Hence, I simply made actions accept an array or a function that returns an array. If you provide a function, you've got prompts response in parameters. This way you can adapt actions regarding the answers.

This was the best solution I found to keep it simple. I've updated the README accordingly to explain this + made a usage example.

Passing by, this PR includes:

  • ignoring example/folder/ so it doesn't bother us in git when testing
  • a little typo correction

Let me know if something is wrong or missing.
Cheers!

@amwmedia

This comment has been minimized.

Owner

amwmedia commented Nov 27, 2015

Hi, thanks for taking the time to contribute. i'm so glad that others are finding plop to be as useful as I have. I'll review your PR soon and probably pull it in. I think the idea of having actions take an array or function is great! It adds a lot of flexibility without complicating the API. 👍

amwmedia added a commit that referenced this pull request Nov 28, 2015

Merge pull request #1 from metidia/dynamic-actions-with-data
Makes `actions` accept either an array or a function that returns an array

@amwmedia amwmedia merged commit b7f2190 into amwmedia:master Nov 28, 2015

@nicoespeon

This comment has been minimized.

Collaborator

nicoespeon commented Nov 30, 2015

👍 Thanks a lot =)

Did you plan to create a new release that will include this change anytime soon also?

@amwmedia

This comment has been minimized.

Owner

amwmedia commented Nov 30, 2015

Yes, very soon. I'm just finishing up a little work I've been meaning to do, then I'll do another release and update NPM.

@nicoespeon

This comment has been minimized.

Collaborator

nicoespeon commented Nov 30, 2015

Sweet! That's good to know 😃

@amwmedia

This comment has been minimized.

Owner

amwmedia commented Dec 1, 2015

released and published to npm with v1.1.0 :-)

@amwmedia

This comment has been minimized.

Owner

amwmedia commented Dec 1, 2015

let me know if you experience any issues with this release. I don't anticipate any, but I still need to add tests (on my hit list)

@nicoespeon

This comment has been minimized.

Collaborator

nicoespeon commented Dec 1, 2015

No problem, thanks for the release ;-) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment