forked from scttcper/ngx-color
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ts
61 lines (52 loc) · 1.3 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
import { copySync } from 'fs-extra';
import { ngPackagr } from 'ng-packagr';
import { join } from 'path';
import * as del from 'del';
const MODULE_NAMES = [
'alpha',
'block',
'chrome',
'circle',
'compact',
'github',
'hue',
'material',
'photoshop',
'sketch',
'slider',
'swatches',
'twitter',
'shade',
];
async function main() {
// cleanup dist
del.sync(join(process.cwd(), '/dist'));
del.sync(join(process.cwd(), '/node_modules/ngx-color'));
await ngPackagr()
.forProject(join(process.cwd(), 'src/lib/common/package.json'))
.build();
// put it in node modules so the path resolves
// proper path support eventually
copySync(
join(process.cwd(), '/dist/common'),
join(process.cwd(), '/node_modules/ngx-color'),
);
copySync(
join(process.cwd(), '/dist/common'),
join(process.cwd(), '/dist/packages-dist'),
);
// build each package
for (const m of MODULE_NAMES) {
await ngPackagr()
.forProject(join(process.cwd(), `src/lib/components/${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);
});