2019-05-24 13:24:04 +00:00
|
|
|
const fs = require('fs-extra');
|
|
|
|
const path = require('path');
|
2019-05-25 13:49:00 +00:00
|
|
|
const {execSync} = require('child_process');
|
2019-05-24 13:24:04 +00:00
|
|
|
const vueCliServicePath = path.resolve(__dirname, 'node_modules/@vue/cli-service/bin/vue-cli-service');
|
|
|
|
|
|
|
|
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
|
|
|
|
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
|
2019-05-25 15:29:48 +00:00
|
|
|
if (/\.vue$/.test(file) || /\.js$/.test(file)) {
|
2019-05-24 13:24:04 +00:00
|
|
|
let filename = file.split('.vue')[0].toLowerCase();
|
2019-05-25 16:10:26 +00:00
|
|
|
console.log('Building ' + filename);
|
2019-05-25 16:03:57 +00:00
|
|
|
|
2019-05-24 13:24:04 +00:00
|
|
|
execSync(
|
|
|
|
`node ${vueCliServicePath} build src/components/${folder}/${file} --target lib --name ${filename} --dest components/${folder} --no-clean `
|
|
|
|
)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|