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