forked from denisnikolayev/ng2-signalr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
58 lines (32 loc) · 1.09 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"use strict";
// ShellJS.
require('shelljs/global');
// Colors.
const chalk = require('chalk');
echo('Start building...');
/* Cleans aot & dist folders */
rm('-Rf', 'aot/*');
rm('-Rf', 'dist/*');
/* TSLint with Codelyzer */
// https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts
// https://github.com/mgechev/codelyzer
echo('Start TSLint');
exec('tslint ./src/**/*.ts -e ./src/**/*.ngfactory.ts');
echo(chalk.green('TSLint completed'));
/* Aot compilation */
echo('Start AoT compilation');
echo('ngc -p tsconfig-build.json');
exec('ngc -p tsconfig-build.json');
echo(chalk.green('AoT compilation completed'));
/* Creates umd bundle */
echo('Start bundling');
echo('rollup -c rollup.config.js');
exec('rollup -c rollup.config.js');
echo(chalk.green('Bundling completed'));
/* Minimizes umd bundle */
echo('Start minification');
exec('uglifyjs ./dist/bundles/ng2-signalr.umd.js -o ./dist/bundles/ng2-signalr.umd.min.js');
echo(chalk.green('Minification completed'));
/* Copies files */
cp('-Rf', ['package.json', 'LICENSE', 'README.md'], 'dist');
echo('End building');