UNPKG

937 BJavaScriptView Raw
1const { hasRequiredDeps, hasRequiredFiles, getYarnOrNPMCommand, scanScripts } = require('./utils/jsdetect')
2
3/**
4 * detection logic - artificial intelligence!
5 * */
6module.exports = function() {
7 // REQUIRED FILES
8 if (!hasRequiredFiles(['package.json', 'stencil.config.ts'])) return false
9 // REQUIRED DEPS
10 if (!hasRequiredDeps(['@stencil/core'])) return false
11
12 /** everything below now assumes that we are within stencil */
13
14 const possibleArgsArrs = scanScripts({
15 preferredScriptsArr: ['start'],
16 preferredCommand: 'stencil build --dev --watch --serve'
17 })
18
19 return {
20 type: 'stencil',
21 command: getYarnOrNPMCommand(),
22 port: 8888, // the port that the Netlify Dev User will use
23 proxyPort: 3333, // the port that stencil normally outputs
24 env: { ...process.env, BROWSER: 'none', PORT: 3000 },
25 possibleArgsArrs,
26 urlRegexp: new RegExp(`(http://)([^:]+:)${3000}(/)?`, 'g'),
27 dist: 'www'
28 }
29}