-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy path.aegir.js
48 lines (45 loc) · 1.06 KB
/
.aegir.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict';
const EchoServer = require('aegir/utils/echo-server')
const { format } =require('iso-url')
/** @type {import('aegir').Options["build"]["config"]} */
const esbuild = {
plugins: [
{
name: 'node built ins',
setup (build) {
build.onResolve({ filter: /^stream$/ }, () => {
return { path: require.resolve('readable-stream') }
})
}
}
]
}
/** @type {import('aegir').PartialOptions} */
module.exports = {
build: {
config: esbuild
},
test: {
browser: {
config: {
buildConfig: esbuild
}
},
async before (options) {
let echoServer = new EchoServer()
await echoServer.start()
const { address, port } = echoServer.server.address()
let hostname = address
if(options.runner === 'react-native-android') {
hostname = '10.0.2.2'
}
return {
echoServer,
env: { ECHO_SERVER : format({ protocol: 'http:', hostname, port })}
}
},
async after (options, before) {
await before.echoServer.stop()
}
}
}