UNPKG

902 BJavaScriptView Raw
1const { hasRequiredDeps, hasRequiredFiles, getYarnOrNPMCommand, scanScripts } = require('./utils/jsdetect')
2
3module.exports = function() {
4 // REQUIRED FILES
5 if (!hasRequiredFiles(['package.json'])) return false
6 // REQUIRED DEPS
7 if (!hasRequiredDeps(['vuepress'])) return false
8
9 /** everything below now assumes that we are within vue */
10
11 const possibleArgsArrs = scanScripts({
12 preferredScriptsArr: ['docs:dev', 'dev', 'run'],
13 preferredCommand: 'vuepress dev'
14 })
15
16 if (possibleArgsArrs.length === 0) {
17 // ofer to run it when the user doesnt have any scripts setup! 🤯
18 possibleArgsArrs.push(['vuepress', 'dev'])
19 }
20
21 return {
22 type: 'vuepress',
23 command: getYarnOrNPMCommand(),
24 port: 8888,
25 proxyPort: 8080,
26 env: { ...process.env },
27 possibleArgsArrs,
28 urlRegexp: new RegExp(`(http://)([^:]+:)${8080}(/)?`, 'g'),
29 dist: '.vuepress/dist'
30 }
31}