@nebula.js/cli-serve 2.0.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/engine.js DELETED
@@ -1,49 +0,0 @@
1
- const path = require('path');
2
- const { spawn } = require('child_process');
3
-
4
- const execCmd = (cmd, cmdArgs = [], opts) =>
5
- new Promise((resolve, reject) => {
6
- const child = spawn(cmd, cmdArgs, opts);
7
- const res = {
8
- exitCode: null,
9
- out: '',
10
- err: '',
11
- };
12
- child.on('error', reject);
13
- child.stdout.on('data', (chunk) => {
14
- res.out += chunk.toString();
15
- });
16
- child.stderr.on('data', (chunk) => {
17
- res.err += chunk.toString();
18
- });
19
- child.on('exit', (exitCode) => {
20
- res.exitCode = exitCode;
21
- if (exitCode === 0) {
22
- resolve(res);
23
- } else {
24
- reject(res);
25
- }
26
- });
27
- });
28
-
29
- const useEngine = ({ ACCEPT_EULA = false, cwd = path.resolve(__dirname, '../'), files }) => {
30
- if (ACCEPT_EULA !== true) {
31
- throw new Error('Need to accept EULA in order to start engine container');
32
- }
33
- console.error('Starting engine container...');
34
- const f = (files || []).reduce((acc, curr) => [...acc, '-f', curr], []);
35
- process.env.ACCEPT_EULA = 'yes';
36
- const stopEngine = async () => {
37
- console.error('Stopping engine container...');
38
- try {
39
- await execCmd('docker-compose', [...f, 'down', '--remove-orphans'], {
40
- cwd,
41
- });
42
- } catch (err) {
43
- console.error(err);
44
- }
45
- };
46
- return execCmd('docker-compose', [...f, 'up', '-d', '--build'], { cwd }).then(() => stopEngine);
47
- };
48
-
49
- module.exports = useEngine;
package/lib/sn.js DELETED
@@ -1 +0,0 @@
1
- // dummy entrypoint