Feature request: `nuxi add module` (not `nuxi module add`)
Opened this issue · 4 comments
Nuxt module template is a bit complicated to copy-paste easily from github. I suggest to extend nuxi add
command and include modules creation, too
I'm certain what you need is https://nuxt.new/
-t
is alias for template
.
You can see the rest of the templates here: https://github.com/nuxt/starter/tree/templates/templates
Hmm, thanks for reminder about nuxi init -t
, it covers 98% of my needs. I will only need to remove playground folder manually and rename module in nested files
Hmm, thanks for reminder about
nuxi init -t
, it covers 98% of my needs. I will only need to remove playground folder manually and rename module in nested files
I always have a handy ~/scripts.ts
for all those extra tasks... 👀
(should I rename it to ~/tasks.ts
? 🤔)
I'm also building a scaffolding tool (extending nuxi) using inquirer, and I have to remove unwanted files, add new ones, modify package.json and nuxt.config.ts, etc. You can create a script that calls nuxi init -t
and after that removes playground and other files.
const shell: 'bash' | 'powershell' = platform() === 'win32' ? 'powershell' : 'bash'
const npm = // some prompt for package manager and populate its commands
const moduleName: string = 'module-name'
await asyncSpawn(shell, ['-c', `${npm.execute} nuxi@latest init -t module ${moduleName}`])
const exclude: string[] = [
'playground',
]
consola.log('Removing files...')
for (const dir of exclude) {
rmSync(join(moduleName, dir))
consola.info(`${moduleName}/${dir} removed.`)
}
Wish you health and success.
Thank you again for providing an example, I think, I will adopt it in our toolbox. Have a nice evening!