forked from nuxt/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nuxi): add initial support for enabling/disabling devtools (#18864)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { resolve } from 'pathe' | ||
import { execa } from 'execa' | ||
import { showHelp } from '../utils/help' | ||
import { defineNuxtCommand } from './index' | ||
|
||
export default defineNuxtCommand({ | ||
meta: { | ||
name: 'enable', | ||
usage: 'npx nuxi devtools enable|disable [rootDir]', | ||
description: 'Enable or disable features in a Nuxt project' | ||
}, | ||
async invoke (args) { | ||
const [command, _rootDir = '.'] = args._ | ||
const rootDir = resolve(_rootDir) | ||
|
||
if (!['enable', 'disable'].includes(command)) { | ||
console.error(`Unknown command \`${command}\`.`) | ||
showHelp(this.meta) | ||
process.exit(1) | ||
} | ||
|
||
// Defer to feature setup | ||
await execa('npx', ['@nuxt/devtools@latest', command, rootDir], { stdio: 'inherit', cwd: rootDir }) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters