1 | const { hasRequiredDeps, hasRequiredFiles, getYarnOrNPMCommand, scanScripts } = require('./utils/jsdetect')
|
2 | module.exports = function() {
|
3 |
|
4 | if (!hasRequiredFiles(['package.json', '_config.yml'])) return false
|
5 |
|
6 | if (!hasRequiredDeps(['hexo'])) return false
|
7 |
|
8 |
|
9 |
|
10 | const possibleArgsArrs = scanScripts({
|
11 | preferredScriptsArr: ['start', 'dev', 'develop'],
|
12 | preferredCommand: 'hexo server'
|
13 | })
|
14 |
|
15 | if (possibleArgsArrs.length === 0) {
|
16 |
|
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 | }
|