forked from vuejs/vue-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinspect.js
26 lines (25 loc) · 791 Bytes
/
inspect.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const fs = require('fs')
const path = require('path')
const execa = require('execa')
const resolve = require('resolve')
module.exports = function inspect (paths, args) {
const cwd = process.cwd()
let servicePath
try {
servicePath = resolve.sync('@vue/cli-service', { basedir: 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',
...(args.mode ? ['--mode', args.mode] : []),
...(args.verbose ? ['--verbose'] : []),
...paths
], { cwd, stdio: 'inherit' })
}
}