Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test(`setup ${__filename}`, t => {
t.plan(1)
frockfile = JSON.parse(fs.readFileSync(path.join(__dirname, 'frockfile.json')))
portfinder.getPorts(3, (err, foundPorts) => {
if (err) {
t.fail(err)
}
ports = foundPorts
// mangle the found ports into the loaded frockfile
frockfile.servers[0].port = ports[0]
frockfile.servers[1].port = ports[1]
frockfile.sockets[0].port = ports[2]
frock = lib(frockfile, {pwd})
frock.run(err => {
if (err) {
t.fail(err)
before((done) => createInfos(5, (err, infos) => {
expect(err).to.not.exist()
getPorts(6, (err, ports) => {
expect(err).to.not.exist()
bootstrapPeer = infos[0]
tcpPeer1 = infos[1]
tcpPeer2 = infos[2]
wsPeer1 = infos[3]
wsPeer2 = infos[4]
// Setup the addresses of our nodes
bootstrapPeer.multiaddrs.add(`/ip4/0.0.0.0/tcp/${ports.shift()}`)
bootstrapPeer.multiaddrs.add(`/ip4/0.0.0.0/tcp/${ports.shift()}/ws`)
tcpPeer1.multiaddrs.add(`/ip4/0.0.0.0/tcp/${ports.shift()}`)
tcpPeer2.multiaddrs.add(`/ip4/0.0.0.0/tcp/${ports.shift()}`)
wsPeer1.multiaddrs.add(`/ip4/0.0.0.0/tcp/${ports.shift()}/ws`)
wsPeer2.multiaddrs.add(`/ip4/0.0.0.0/tcp/${ports.shift()}/ws`)
return;
})
.then(() => console.log('Shutdown: '.cyan + name.green))
.catch(err => {
if (catchExec(name, err)) {
// Restart if not explicitly shutdown
runCmd(name, cmd, options);
}
});
}
console.log('Starting docs in Development mode'.cyan);
process.on(SIGINT, shutdown);
portfinder.getPorts(2, {}, (portFinderErr, [docsPort, webpackPort]) => {
if (portFinderErr) {
console.log('Failed to acquire ports'.red);
process.exit(1);
}
// runCmd('webpack-dev-server', `nodemon --watch webpack --watch webpack.docs.js --exec webpack-dev-server -- --config webpack.docs.js --color --port ${webpackPort} --debug --hot --host ${ip.address()}`);
runCmd('webpack-dev-server', `nodemon --watch webpack --watch webpack.docs.js --exec webpack-dev-server -- --config webpack.docs.js --color --port ${webpackPort} --debug --hot --host 127.0.0.1`);
runCmd('docs-server', 'nodemon --watch docs --watch src --exec babel-node docs/server.js', {
env: {
PORT: docsPort,
WEBPACK_DEV_PORT: webpackPort,
...process.env
}
});
});
processMap[name] = childProcess;
})
.then(() => console.log('Shutdown: '.cyan + name.green))
.catch((err) => {
if (catchExec(name, err)) {
// Restart if not explicitly shutdown
runCmd(name, cmd, options);
}
});
}
console.log('Starting docs in Development mode'.cyan);
process.on(SIGINT, shutdown);
portfinder.getPorts(2, {}, (portFinderErr, [docsPort, webpackPort]) => {
if (portFinderErr) {
console.log('Failed to acquire ports'.red);
process.exit(1);
}
runCmd('webpack-dev-server', `nodemon --watch webpack --watch webpack.docs.js --exec webpack-dev-server -- --config webpack.docs.js --color --port ${webpackPort} --debug --hot --host ${ip.address()}`);
runCmd('docs-server', 'nodemon --watch docs --watch src --exec babel-node docs/server.js', {
env: {
PORT: docsPort,
WEBPACK_DEV_PORT: webpackPort,
...process.env,
},
});
});