forked from angulartics/angulartics2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ts
77 lines (67 loc) · 1.66 KB
/
build.ts
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { copySync } from 'fs-extra';
import { ngPackagr } from 'ng-packagr';
import { join } from 'path';
import * as del from 'del';
const CORE_MODULE_NAMES = ['uiroutermodule', 'routerlessmodule'];
// Rollup globals
const MODULE_NAMES = [
'adobeanalytics',
'appinsights',
'baidu',
'facebook',
'ga',
'ga-enhanced-ecom',
'gtm',
'gst',
'hubspot',
'kissmetrics',
'launch',
'mixpanel',
'pyze',
'piwik',
'segment',
'intercom',
'woopra',
'clicky',
'amplitude',
'splunk',
'ibm-digital-analytics',
'gosquared',
];
async function main() {
// cleanup dist
del.sync(join(process.cwd(), '/dist'));
del.sync(join(process.cwd(), '/node_modules/angulartics2'));
await ngPackagr()
.forProject(join(process.cwd(), 'src/lib/core/package.json'))
.build();
// put it in node modules so the path resolves
// proper path support eventually
copySync(
join(process.cwd(), '/dist/core'),
join(process.cwd(), '/node_modules/angulartics2'),
);
copySync(
join(process.cwd(), '/dist/core'),
join(process.cwd(), '/dist/packages-dist'),
);
for (const m of CORE_MODULE_NAMES) {
await ngPackagr()
.forProject(join(process.cwd(), `src/lib/${m}/package.json`))
.build();
}
// build each provider
for (const m of MODULE_NAMES) {
await ngPackagr()
.forProject(join(process.cwd(), `src/lib/providers/${m}/package.json`))
.build();
}
copySync('README.md', join(process.cwd(), 'dist/packages-dist/README.md'));
copySync('LICENSE', join(process.cwd(), 'dist/packages-dist/LICENSE'));
}
main()
.then(() => console.log('success'))
.catch((e) => {
console.error(e);
process.exit(1);
});