Closed ahkhanjani closed 1 year ago
@ahkhanjani Yep we're looking into it in #245
It should be a pretty straightforward change at the bottom of the cli index.ts:
async function promptForDestinationDir() {
if (!fs.existsSync('./shadcnui.config.ts')) {
const { dir } = await prompts([
{
type: "text",
name: "dir",
message: "Where would you like to install the component(s)?",
initial: "./components/ui",
},
])
return dir
}
const config = require('./shadcnui.config.ts')
return config.componentsPath
}
I don't really know how to parse a .config.ts file, this is just an idea.
It's kind of painful to type the path on every component install. Sometimes the path is too long or there's a typo etc. A config file in the root directory could solve this issue. Something like this:
If the file exists the CLI shouldn't ask for a path.