Skip to content
Snippets Groups Projects
Commit abe9f0c9 authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon: Committed by Reiter, Christoph
Browse files

Add required changes to build config

parent e24f2037
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
"chai": "^4.2.0", "chai": "^4.2.0",
"rollup": "^1.11.3", "rollup": "^1.11.3",
"rollup-plugin-commonjs": "^10.0.2", "rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-consts": "^1.0.1",
"rollup-plugin-copy": "^3.1.0", "rollup-plugin-copy": "^3.1.0",
"rollup-plugin-delete": "^1.1.0",
"rollup-plugin-json": "^4.0.0", "rollup-plugin-json": "^4.0.0",
"rollup-plugin-multi-entry": "^2.1.0", "rollup-plugin-multi-entry": "^2.1.0",
"rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-node-resolve": "^5.2.0",
......
...@@ -8,6 +8,9 @@ import replace from "rollup-plugin-replace"; ...@@ -8,6 +8,9 @@ import replace from "rollup-plugin-replace";
import serve from 'rollup-plugin-serve'; import serve from 'rollup-plugin-serve';
import multiEntry from 'rollup-plugin-multi-entry'; import multiEntry from 'rollup-plugin-multi-entry';
import url from "rollup-plugin-url"; import url from "rollup-plugin-url";
import consts from 'rollup-plugin-consts';
import del from 'rollup-plugin-delete'
const pkg = require('./package.json'); const pkg = require('./package.json');
const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local'; const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
...@@ -16,6 +19,24 @@ console.log("build: " + build); ...@@ -16,6 +19,24 @@ console.log("build: " + build);
let manualChunks = Object.keys(pkg.dependencies).reduce(function (acc, item) { acc[item] = [item]; return acc;}, {}); let manualChunks = Object.keys(pkg.dependencies).reduce(function (acc, item) { acc[item] = [item]; return acc;}, {});
manualChunks = Object.keys(pkg.devDependencies).reduce(function (acc, item) { if (item.startsWith('vpu-')) acc[item] = [item]; return acc;}, manualChunks); manualChunks = Object.keys(pkg.devDependencies).reduce(function (acc, item) { if (item.startsWith('vpu-')) acc[item] = [item]; return acc;}, manualChunks);
function getBuildInfo() {
const child_process = require('child_process');
const url = require('url');
let remote = child_process.execSync('git config --get remote.origin.url').toString().trim();
let commit = child_process.execSync('git rev-parse --short HEAD').toString().trim();
let parsed = url.parse(remote);
let newPath = parsed.path.slice(0, parsed.path.lastIndexOf('.'))
let newUrl = parsed.protocol + '//' + parsed.host + newPath + '/commit/' + commit;
return {
info: commit,
url: newUrl,
env: build
}
}
export default { export default {
input: (build !== 'test') ? 'src/demo.js' : 'test/**/*.js', input: (build !== 'test') ? 'src/demo.js' : 'test/**/*.js',
output: { output: {
...@@ -36,7 +57,14 @@ export default { ...@@ -36,7 +57,14 @@ export default {
chokidar: true, chokidar: true,
}, },
plugins: [ plugins: [
del({
targets: 'dist/*'
}),
(build == 'test') ? multiEntry() : false, (build == 'test') ? multiEntry() : false,
consts({
environment: build,
buildinfo: getBuildInfo(),
}),
resolve({ resolve({
customResolveOptions: { customResolveOptions: {
// ignore node_modules from vendored packages // ignore node_modules from vendored packages
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment