UNPKG

1.16 kBJavaScriptView Raw
1const { hasRequiredDeps, hasRequiredFiles, getYarnOrNPMCommand, scanScripts } = require('./utils/jsdetect')
2module.exports = function() {
3 // REQUIRED FILES
4 if (!hasRequiredFiles(['package.json', 'app.json'])) return false
5 // REQUIRED DEPS
6 if (!hasRequiredDeps(['expo'])) return false
7
8 /** everything below now assumes that we are within expo */
9
10 const possibleArgsArrs = scanScripts({
11 // This script will run `expo start --web` in a new Expo project.
12 // Note: Expo will automatically launch the browser with your app's
13 // Webpack server listening on port 19006, but the instance proxied
14 // by `netlify dev` will be running on port 8888.
15 preferredScriptsArr: ['web'],
16 preferredCommand: 'expo start --web'
17 })
18
19 if (possibleArgsArrs.length === 0) {
20 // ofer to run it when the user doesnt have any scripts setup! 🤯
21 possibleArgsArrs.push(['expo', 'start', '--web'])
22 }
23 return {
24 type: 'expo',
25 command: getYarnOrNPMCommand(),
26 port: 8888,
27 proxyPort: 19006,
28 env: { ...process.env },
29 possibleArgsArrs,
30 urlRegexp: new RegExp(`(http://)([^:]+:)${19006}(/)?`, 'g'),
31 dist: 'web-build'
32 }
33}