-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-lib.js
29 lines (24 loc) · 1.17 KB
/
build-lib.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
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const path = require('path');
const fs = require('fs-extra');
const DOCS_Folder = 'docs';
return (async () => {
try {
console.log(`Compiling library\n`);
const indexPath = path.join('src', 'index.js');
const { stdout, stderr } = await exec(`vue-cli-service build --target lib --name vueWavesEffect ${indexPath}`);
// console.log('stdout:', stdout);
if (stderr) {
console.log(stderr);
}
// copy "umd" files and remove the "umd" part of the filename
await fs.copy(path.join('dist', 'vueWavesEffect.umd.js'), path.join('dist', 'vueWavesEffect.js'));
await fs.copy(path.join('dist', 'vueWavesEffect.umd.js.map'), path.join('dist', 'vueWavesEffect.js.map'));
await fs.copy(path.join('dist', 'vueWavesEffect.umd.min.js'), path.join('dist', 'vueWavesEffect.min.js'));
await fs.copy(path.join('dist', 'vueWavesEffect.umd.min.js.map'), path.join('dist', 'vueWavesEffect.min.js.map'));
console.log(`Library compiled in the <dist> folder\n`);
} catch (err) {
console.error(err);
}
})();