1 | var R = require('ramda');
|
2 | var minimist = require('minimist');
|
3 | var chalk = require('chalk');
|
4 | var fsPath = require('path');
|
5 |
|
6 | var codeDir = process.env.QUICK_BUILD ? 'src' : 'lib';
|
7 | var loadScript = path => require(fsPath.join(__dirname, codeDir, path));
|
8 |
|
9 | var server = loadScript('server').default;
|
10 | var yamlConfig = loadScript('server/yaml-config');
|
11 | var log = loadScript('shared/log').default;
|
12 |
|
13 |
|
14 |
|
15 | var args = process.argv.slice(2);
|
16 | args = args.length > 0 ? args = minimist(args) : {};
|
17 |
|
18 |
|
19 |
|
20 | const config = yamlConfig.load() || {};
|
21 | var entry = args.entry || (config && config.entry);
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | if (entry) {
|
42 | entry = R.is(String, entry) ? entry.split(',') : entry;
|
43 | server.start({
|
44 | entry,
|
45 | port: args.port || config.port,
|
46 | })
|
47 | .catch(err => {
|
48 | log.error(chalk.red('Failed to start.'));
|
49 | log.error(chalk.red(err.message));
|
50 | log.error()
|
51 | });
|
52 | } else {
|
53 | log.error();
|
54 | log.error(chalk.red('No entry path was specified for the UIHarness.'));
|
55 | log.error(chalk.grey(' Make sure you have a [.uiharness.yml] file in the root of the project,'));
|
56 | log.error(chalk.grey(' or pass a --entry command line argument, for example: `--entry ./src/specs`'));
|
57 | log.error();
|
58 | }
|