UNPKG

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