From fb23ad37ff106da41230783dc568cfa0529c1f6b Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Fri, 24 May 2019 16:24:04 +0300 Subject: [PATCH] Initated build process --- build-lib.js | 25 +++++++++++++++++++++++++ package.json | 1 + vue.config.js | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 build-lib.js diff --git a/build-lib.js b/build-lib.js new file mode 100644 index 000000000..6ec6a1a07 --- /dev/null +++ b/build-lib.js @@ -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 ` + ) + } + }); +}); \ No newline at end of file diff --git a/package.json b/package.json index a162720f8..e2cae22c0 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", + "build-lib": "node build-lib", "lint": "vue-cli-service lint", "test:unit": "vue-cli-service test:unit" }, diff --git a/vue.config.js b/vue.config.js index 333e791f8..1bacfa729 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,3 +1,4 @@ module.exports = { - publicPath: process.env.NODE_ENV === 'production' ? '/primevue' : '/' + publicPath: process.env.NODE_ENV === 'production' ? '/primevue' : '/', + productionSourceMap: false } \ No newline at end of file