Initated build process

pull/12/head
cagataycivici 2019-05-24 16:24:04 +03:00
parent 38e15e864f
commit fb23ad37ff
3 changed files with 28 additions and 1 deletions

25
build-lib.js Normal file
View File

@ -0,0 +1,25 @@
const fs = require('fs-extra');
const path = require('path');
const { execSync } = require('child_process');
const vueCliServicePath = path.resolve(__dirname, 'node_modules/@vue/cli-service/bin/vue-cli-service');
fs.copyFile('source.txt', 'destination.txt', (err) => {
if (err) throw err;
console.log('source.txt was copied to destination.txt');
});
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
if (/\.vue$/.test(file)) {
let filename = file.split('.vue')[0].toLowerCase();
execSync(
`node ${vueCliServicePath} build src/components/${folder}/${file} --target lib --name ${filename} --dest components/${folder} --no-clean `
)
}
else if (/\.js$/.test(file)) {
execSync(
`node ${vueCliServicePath} build src/components/${folder}/${file} --target lib --name ${folder} --dest components/${folder} --no-clean `
)
}
});
});

View File

@ -9,6 +9,7 @@
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"build-lib": "node build-lib",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit" "test:unit": "vue-cli-service test:unit"
}, },

View File

@ -1,3 +1,4 @@
module.exports = { module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/primevue' : '/' publicPath: process.env.NODE_ENV === 'production' ? '/primevue' : '/',
productionSourceMap: false
} }