unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.89k stars 496 forks source link

fix(cli): respect custom `buildDir` option for `tasks` sub command #2635

Closed TMBL-DEV closed 1 week ago

TMBL-DEV commented 2 months ago

updated list & run to get a nitro instance and grab the buildDir from the nitro options and at the close the nitro instance.

πŸ”— Linked issue

#2634 Task cli forces .nitro as buildDir

❓ Type of change

πŸ“š Description

Changes

In run.ts & list.ts from the task command i used createNitro() to have a nitro instance so i could access the options. i use the nitro.options.builDir to replace the hardcoded ".nitro" buildDir that is passed to the runTask function. at the end of the command run function i also close the the nitro instance that i created.

Why

Now if your buildDir in the nitro.config.tsis not the default .nitro directory instead of getting an error it uses the correct buildDir and your command will run. This will also make sure that the task cli works with nuxt, because nuxt uses the the buildDir .nuxt.

πŸ“ Checklist

TMBL-DEV commented 2 weeks ago

@pi0 is this good?