1 | const { hasRequiredDeps, hasRequiredFiles, getYarnOrNPMCommand, scanScripts } = require('./utils/jsdetect')
|
2 | module.exports = function() {
|
3 |
|
4 | if (!hasRequiredFiles(['package.json'])) return false
|
5 |
|
6 | if (!hasRequiredDeps(['next'])) return false
|
7 |
|
8 |
|
9 |
|
10 | const possibleArgsArrs = scanScripts({
|
11 | preferredScriptsArr: ['dev', 'develop', 'start'],
|
12 | preferredCommand: 'next'
|
13 | })
|
14 |
|
15 | if (possibleArgsArrs.length === 0) {
|
16 |
|
17 | possibleArgsArrs.push(['next'])
|
18 | }
|
19 | return {
|
20 | type: 'next.js',
|
21 | command: getYarnOrNPMCommand(),
|
22 | port: 8888,
|
23 | proxyPort: 3000,
|
24 | env: { ...process.env },
|
25 | possibleArgsArrs,
|
26 | urlRegexp: new RegExp(`(http://)([^:]+:)${3000}(/)?`, 'g'),
|
27 | dist: 'out'
|
28 | }
|
29 | }
|