-
Notifications
You must be signed in to change notification settings - Fork 8
/
prepare_web-components.js
55 lines (48 loc) · 1.24 KB
/
prepare_web-components.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
const fs = require('fs-extra');
const concat = require('concat');
const build = async () => {
const files = [
'tmp/web-components/main.js',
'tmp/web-components/polyfills.js',
'tmp/web-components/runtime.js',
];
await fs.ensureDir('dist/libs/web-components');
await concat(files, 'dist/libs/web-components/web-components.js');
await fs.copyFile(
'apps/web-components/package.json',
'dist/libs/web-components/package.json'
);
await fs.copyFile(
'tmp/web-components/3rdpartylicenses.txt',
'dist/libs/web-components/3rdpartylicenses.txt'
);
await fs.copyFile(
'tmp/web-components/LICENSE.txt',
'dist/libs/web-components/LICENSE.txt'
);
const license = await fs.readFile(
'dist/libs/web-components/LICENSE.txt',
'utf-8'
);
const thirdPartyLicenses = await fs.readFile(
'tmp/web-components/3rdpartylicenses.txt',
'utf-8'
);
let jsCode = await fs.readFile(
'dist/libs/web-components/web-components.js',
'utf-8'
);
jsCode = `/*
${license}
*/
${jsCode}
/* Third party licenses:
${thirdPartyLicenses}
*/
`;
await fs.writeFile('dist/libs/web-components/web-components.js', jsCode, {
encoding: 'utf-8',
});
console.log('Web-Components Build OK');
};
build();