1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const term = require('terminal-kit').terminal;
|
4 | function outputError(error) {
|
5 | if (typeof error !== 'undefined' && error.message) {
|
6 | term.white('Error: ');
|
7 | term.red(error.message);
|
8 | term('\n');
|
9 | }
|
10 | }
|
11 | exports.default = emitter => {
|
12 | emitter.on('developerPortalUpdate:failed', error => {
|
13 | term.red('Failed pushing to developer portal.\n');
|
14 | term.yellow('error message: ').red(error);
|
15 | term('\n');
|
16 | outputError(error);
|
17 | });
|
18 | emitter.on('developerPortalUpdate:error', error => {
|
19 | term.red('There was an error while pushing to developer portal.');
|
20 | term('\n');
|
21 | outputError(error);
|
22 | });
|
23 |
|
24 | emitter.on('start:prepare:installingDependencies', () => {
|
25 | term.yellow('Installing dependencies.');
|
26 | term('\n');
|
27 | });
|
28 | emitter.on('start:watchers', () => {
|
29 | term.yellow('Starting watchers');
|
30 | term('\n');
|
31 | });
|
32 | emitter.on('start:watchers:stdout', ({ name, data }) => {
|
33 | term.yellow(`[watcher:${name}] `);
|
34 | term.green(data);
|
35 | });
|
36 | emitter.on('start:watchers:stderr', ({ name, data }) => {
|
37 | term.yellow(`[watcher:${name}] `);
|
38 | term.green(data);
|
39 | });
|
40 | emitter.on('start:watchers:close', ({ name, code }) => {
|
41 | term.yellow(`[watcher:${name}] closed exit code: ${code}\n`);
|
42 | });
|
43 | emitter.on('start:prepare:failed', ({ error }) => {
|
44 | term.red('Prepare : An error occured');
|
45 | term('\n');
|
46 | term.white(' Error: ');
|
47 | term.red(error);
|
48 | term('\n');
|
49 | });
|
50 | emitter.on('start:failed', ({ error }) => {
|
51 | term.red('An error occured');
|
52 | term('\n');
|
53 | term.white(' Error: ');
|
54 | term.red(error);
|
55 | term('\n');
|
56 | });
|
57 | emitter.on('start:localServer:start', ({ port }) => {
|
58 | term.yellow('[local:functionServer] ');
|
59 | term.yellow('Serving: ');
|
60 | term(`http://127.0.0.1:${port}`);
|
61 | term('\n');
|
62 | });
|
63 | emitter.on('start:localServer:customPort', ({ port, host }) => {
|
64 | term('*************** Action required *****************\n');
|
65 | term.red('[local:functionServer] You have specified a custom port.\n');
|
66 | term.yellow('You must update the views/index.html to match this setting as follow:\n\n');
|
67 | term(`<script> bearer("CLIENT_ID", { integrationHost: "${host}" }) </script>\n\n`);
|
68 | term('*************************************************\n');
|
69 | });
|
70 | emitter.on('start:localServer:endpoints', ({ endpoints }) => {
|
71 | term.yellow('[local:functionServer] ');
|
72 | term.yellow('paths:');
|
73 | term('\n\t* ');
|
74 | term(endpoints.map(i => i.path).join('\n\t* '));
|
75 | term('\n');
|
76 | });
|
77 | emitter.on('start:localServer:generatingFunctions:start', () => {
|
78 | term.yellow('[local:functionServer] ');
|
79 | term.yellow('Reloading functions');
|
80 | term('\n');
|
81 | });
|
82 | emitter.on('start:localServer:generatingFunctions:stop', () => {
|
83 | term.yellow('[local:functionServer] ');
|
84 | term.yellow('Functions reloaded');
|
85 | term('\n');
|
86 | });
|
87 | emitter.on('start:localServer:generatingFunctions:failed', ({ error }) => {
|
88 | term.yellow('[local:functionServer] ');
|
89 | term.red('Functions build error\n');
|
90 | console.log('%s', error.toString({
|
91 | builtAt: false,
|
92 | entrypoints: false,
|
93 | assets: false,
|
94 | version: false,
|
95 | timings: false,
|
96 | hash: false,
|
97 | modules: false,
|
98 | chunks: false,
|
99 | colors: true
|
100 | }));
|
101 | term('\n');
|
102 | });
|
103 | };
|