1 4
import * as path from 'path';
2 4
import notifier from 'node-notifier';
3

4 4
const COLORS = {
5
  red: '\x1b[31m',
6
  green: '\x1b[32m',
7
  yellow: '\x1b[33m',
8
  blue: '\x1b[34m',
9
};
10 4
const RESET = '\x1b[0m';
11

12 4
export const output = (content: string | string[], color: 'red' | 'green' | 'blue' | 'yellow') => {
13 4
  const message = Array.isArray(content) ? content : [content];
14 4
  console.log(`${COLORS[color]}%s${RESET}`, ...message);
15
};
16

17 0
function log(type: 'error' | 'warn', message: string) {
18 0
  console[type](message);
19
}
20

21 0
function notice(message: string) {
22 0
  notifier.notify({
23
    title: 'Remax build error',
24
    message,
25
    icon: path.join(__dirname, '../../../error.png'),
26
  });
27
}
28

29 4
export default {
30
  message: output,
31 0
  error: (message: string) => log('error', message),
32 0
  warn: (message: string) => log('warn', message),
33
  notice,
34
};

Read our documentation on viewing source code .

Loading