Comments (7)
@bsr203 you might want to take a look at inquierer-directory by @nicksrandall. it doesn't do exactly this, but it's a very nice way to pick a specific directory
from plop.
Hey Kent, interesting idea. What is the use case where you believe this would be especially useful? In every case I've come across so far, I've found it better to build the generator so that everything it needs to execute comes from the questions asked. That way the developer doesn't need to know whether or not the CWD is important for THIS generator vs another one.
This would technically be pretty simple to do through a helper though. If you used the code you wrote above as a helper function you could declare it once at the top and reuse it in all of your paths and templates...
{
type: 'add',
path: '{{pwd name}}.js'
// ...etc
}
If there's enough value in a helper like this, it could easily be built into the baked in helpers.
from plop.
I like the helper idea. I understand what you mean by allowing the user to provide everything that's needed for the generator. Is there a way with the prompts to provide default values? In that scenario, I could prompt the user for the path they'd like but have it default to the current working directory. I think I'd be happy with that solution if it's possible :-)
from plop.
Looks like that's possible. I'll close this for now. Thanks! https://www.npmjs.com/package/inquirer#question
from plop.
hi @kentcdodds I too like to have this behavior and is there any of your public repo contains this implementation? else, can you please share the snippets to enable this?
from plop.
Unfortunately no, and I no longer have access to that repo. But @TheMcMurder does. Maybe he'd be willing to share a code snippet.
from plop.
thanks @kentcdodds for quick response
from plop.
Related Issues (20)
- feat: make it possible to disable the progress spinner HOT 1
- Loaded plopfiles do not respect the `--force` flag HOT 6
- Plop 4 Planning HOT 6
- Set `dest` dynamically within a monorepo (workspace) environment HOT 6
- Add configuration option for custom handlebar delimiters HOT 3
- [node-plop] instanceof Array is not working with array from vm script
- Action `type: "modify"`'s `pattern` property should be built as a Handlebars template HOT 1
- node v14๏ผIntl.Segmenter is not a constructor HOT 1
- titleCase fails to transform name HOT 2
- Supporting plopfile.ts .ts extension HOT 5
- Action type that trigger shell command HOT 2
- Possible to make a Multi Level Menu / Sub Menu? HOT 2
- Way of extending ActionType to have type definition for action added with setActionType
- plopfile.ts Typescript support HOT 14
- node-plop and electron: navigator is not defined HOT 2
- Can plop produce files based on json file inputs? HOT 1
- Is it possible to print text? HOT 2
- Can't write tests if the plopfile contains conditional prompts HOT 1
- Bug: Can't use custom action in typescript plopfiles
- Async follow up prompts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plop.