-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: vue inspect that proxies to vue-cli-service
- Loading branch information
Showing
2 changed files
with
33 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
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 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const execa = require('execa') | ||
const resolve = require('resolve') | ||
|
||
module.exports = function inspect (paths, mode) { | ||
const cwd = process.cwd() | ||
let servicePath | ||
try { | ||
servicePath = resolve.sync('@vue/cli-service', { cwd }) | ||
} catch (e) { | ||
const { error } = require('@vue/cli-shared-utils') | ||
error(`Failed to locate @vue/cli-service. Make sure you are in the right directory.`) | ||
process.exit(1) | ||
} | ||
const binPath = path.resolve(servicePath, '../../bin/vue-cli-service.js') | ||
if (fs.existsSync(binPath)) { | ||
execa('node', [ | ||
binPath, | ||
'inspect', | ||
...(mode ? ['--mode', mode] : []), | ||
...paths | ||
], { cwd, stdio: 'inherit' }) | ||
} | ||
} |