-
Notifications
You must be signed in to change notification settings - Fork 0
/
copier.ts
33 lines (29 loc) · 805 Bytes
/
copier.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
import fs from 'fs';
import path from 'path';
import glob from 'glob';
const srcDir = path.join('./src');
const distDir = path.join('./dist/js');
const files = glob.sync('**/*.d.ts', {
cwd: srcDir,
});
const scss = glob.sync('**/*.scss', {
cwd: srcDir,
});
const svg = glob.sync('**/*.svg', {
cwd: srcDir,
});
const copyFile = (from: string, to: string) => {
fs.copyFile(from, to, (err) => {
if(err)console.log(err);
console.log('Successfully built', from, '===========> ', to);
});
};
[...files, ...scss, ...svg].forEach((file: string) => {
const from = path.join(srcDir, file);
const to = path.join(distDir, file);
const esm = path.join('./dist/esm', file);
const umd = path.join('./dist/umd', file);
copyFile(from, esm);
copyFile(from, to);
copyFile(from, umd);
});