-
Notifications
You must be signed in to change notification settings - Fork 279
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
Set dest
dynamically within a monorepo (workspace) environment
#395
Comments
If you have a plopfile at the root of the project, couldn't you just prompt for the destination package and then use that value in your add actions? I'm not sure why this would require a code change. It seems like it's already supported. |
Plop also has a concept of loading external plop files. Those won't have the |
A generator that is imported from a source you don't control is not likely to respect your project structure. You could import actions from an external plopfile and configure them to work within your project structure. That's what I would expect most people to do when it comes to external imports that they don't control (import helpers, actions, etc). |
Yes, and that's precisely why I think setting I can point any generator at any directory, as long as the generator is not too opinionated. |
I think this would require a shift in thinking when it comes to generators. When you're writing a generator for plop currently, you are thinking about project structure and where this file belongs. What I think you're proposing is that a generator would no longer expect to control the full path, but a subpath. So in a project with a structure that puts components into a common folder like |
Not necessarily. This is one way to do this. But it is certainly not the only way. Plop already has the So the only difference I am proposing is that It could be solved by some API that precedes any generator, e.g.: plop.setGlobalPrompts({
type: 'input',
name: 'dest',
message: 'Dest?'
}); |
I have a monorepo (workspace), with multiple packages.
The same layout as
plop
repo:When running
plop
from the root of the workspace (./
), I'd like the present a choice (list) of packages to target, as the base destination.Once the user selects a package, this selection becomes the
dest
for the rest of the plop run.Then each action would only need to define
path
relative to the package root.I think the solution should/can be split up in two problems:
dest
value programmatically. There's already agetDestBasePath
, so a matching pairsetDestBasePath
would suffice, I am guessing.The text was updated successfully, but these errors were encountered: