Skip to content
Snippets Groups Projects
Commit 075c5c0f authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Merge branch 'master' of gitlab.tugraz.at:VPU/WebComponents/Notification

parent c41df129
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<script type="module" id="vpu-notification-wc-src" src="bundle.js"></script> <script type="module" id="vpu-notification-src" src="bundle.js"></script>
</head> </head>
<body> <body>
......
...@@ -6,7 +6,7 @@ module.exports = function(config) { ...@@ -6,7 +6,7 @@ module.exports = function(config) {
basePath: 'dist', basePath: 'dist',
frameworks: ['mocha', 'chai'], frameworks: ['mocha', 'chai'],
files: [ files: [
'./bundle.js', {pattern: './*.js', included: true, watched: true, served: true, type: 'module'},
{pattern: './**/*', included: false, watched: true, served: true}, {pattern: './**/*', included: false, watched: true, served: true},
], ],
autoWatch: true, autoWatch: true,
......
...@@ -11,20 +11,22 @@ ...@@ -11,20 +11,22 @@
"puppeteer": "^1.15.0", "puppeteer": "^1.15.0",
"mocha": "^6.2.0", "mocha": "^6.2.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"rollup": "^1.11.3", "rollup": "^1.20.3",
"rollup-plugin-commonjs": "^9.3.4", "rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-copy": "^2.0.1", "rollup-plugin-consts": "^1.0.1",
"rollup-plugin-node-resolve": "^4.2.3", "rollup-plugin-copy": "^3.1.0",
"rollup-plugin-postcss": "^2.0.3", "rollup-plugin-delete": "^1.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-serve": "^1.0.1", "rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^4.0.4", "rollup-plugin-terser": "^5.1.1",
"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-replace": "^2.2.0", "rollup-plugin-url": "^2.2.2",
"i18next-scanner": "^2.10.2", "i18next-scanner": "^2.10.2",
"vpu-common": "file:./vendor/common" "vpu-common": "file:./vendor/common"
}, },
"dependencies": { "dependencies": {
"bulma": "^0.7.5",
"lit-element": "^2.1.0" "lit-element": "^2.1.0"
}, },
"scripts": { "scripts": {
......
import path from 'path'; import path from 'path';
import resolve from 'rollup-plugin-node-resolve'; import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs'; import commonjs from 'rollup-plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
import copy from 'rollup-plugin-copy'; import copy from 'rollup-plugin-copy';
import {terser} from "rollup-plugin-terser"; import {terser} from "rollup-plugin-terser";
import json from 'rollup-plugin-json'; import json from 'rollup-plugin-json';
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 consts from 'rollup-plugin-consts';
import del from 'rollup-plugin-delete';
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';
console.log("build: " + build); console.log("build: " + build);
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);
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: {
...@@ -19,7 +42,13 @@ export default { ...@@ -19,7 +42,13 @@ export default {
format: 'esm' format: 'esm'
}, },
plugins: [ plugins: [
del({
targets: 'dist/*'
}),
multiEntry(), multiEntry(),
consts({
environment: build,
}),
resolve({ resolve({
customResolveOptions: { customResolveOptions: {
// ignore node_modules from vendored packages // ignore node_modules from vendored packages
...@@ -30,21 +59,21 @@ export default { ...@@ -30,21 +59,21 @@ export default {
include: 'node_modules/**' include: 'node_modules/**'
}), }),
json(), json(),
replace({ url({
"process.env.BUILD": '"' + build + '"', limit: 0,
}), include: [
postcss({ "node_modules/bulma/**/*.css",
inject: false, "node_modules/bulma/**/*.sass",
minimize: false, ],
plugins: [] emitFiles: true,
fileName: 'shared/[name].[hash][extname]'
}), }),
(build !== 'local' && build !== 'test') ? terser() : false, (build !== 'local' && build !== 'test') ? terser() : false,
copy({ copy({
targets: [ targets: [
'assets/index.html', {src: 'assets/index.html', dest: 'dist'},
'assets/favicon.ico' {src: 'assets/favicon.ico', dest: 'dist'},
], ]
outputFolder: 'dist'
}), }),
(process.env.ROLLUP_WATCH === 'true') ? serve({contentBase: 'dist', host: '127.0.0.1', port: 8002}) : false (process.env.ROLLUP_WATCH === 'true') ? serve({contentBase: 'dist', host: '127.0.0.1', port: 8002}) : false
] ]
......
...@@ -7,4 +7,5 @@ export const createUUID = () => { ...@@ -7,4 +7,5 @@ export const createUUID = () => {
}); });
return uuid; return uuid;
} };
...@@ -2,7 +2,8 @@ import {i18n} from './i18n'; ...@@ -2,7 +2,8 @@ import {i18n} from './i18n';
import {send as notify} from 'vpu-common/notification'; import {send as notify} from 'vpu-common/notification';
import {html, LitElement} from 'lit-element'; import {html, LitElement} from 'lit-element';
import './vpu-notification'; import './vpu-notification';
import commonUtils from 'vpu-common/utils'; import * as commonUtils from 'vpu-common/utils';
import bulmaCSSPath from 'bulma/css/bulma.min.css';
class NotificationDemo extends LitElement { class NotificationDemo extends LitElement {
constructor() { constructor() {
...@@ -25,10 +26,9 @@ class NotificationDemo extends LitElement { ...@@ -25,10 +26,9 @@ class NotificationDemo extends LitElement {
} }
render() { render() {
const bulmaCSS = commonUtils.getAssetURL(bulmaCSSPath);
return html` return html`
<style> <link rel="stylesheet" href="${bulmaCSS}">
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css">
<section class="section"> <section class="section">
<div class="container"> <div class="container">
......
...@@ -2,7 +2,8 @@ import {i18n} from './i18n'; ...@@ -2,7 +2,8 @@ import {i18n} from './i18n';
import {createUUID} from './utils' import {createUUID} from './utils'
import {html} from 'lit-element'; import {html} from 'lit-element';
import VPULitElement from 'vpu-common/vpu-lit-element'; import VPULitElement from 'vpu-common/vpu-lit-element';
import commonUtils from 'vpu-common/utils'; import * as commonUtils from 'vpu-common/utils';
import bulmaCSSPath from 'bulma/css/bulma.min.css';
/** /**
* Notification web component * Notification web component
...@@ -74,8 +75,10 @@ class VPUNotification extends VPULitElement { ...@@ -74,8 +75,10 @@ class VPUNotification extends VPULitElement {
} }
render() { render() {
commonUtils.initAssetBaseURL('vpu-notification-src');
const bulmaCSS = commonUtils.getAssetURL(bulmaCSSPath);
return html` return html`
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css"> <link rel="stylesheet" href="${bulmaCSS}">
<style> <style>
#notification {position: fixed; top: 0; max-width: 500px; margin: 0.75em auto; left: 0; right: 0; z-index: 1000; padding: 0;} #notification {position: fixed; top: 0; max-width: 500px; margin: 0.75em auto; left: 0; right: 0; z-index: 1000; padding: 0;}
.notification h3 {font-weight: bold; margin-bottom: 3px;} .notification h3 {font-weight: bold; margin-bottom: 3px;}
......
common @ adbdf637
Subproject commit 378256b0ae92712fd5b8feed3a987cd014617c0b Subproject commit adbdf63736ba48eaf93ca06f83ee3652b7f85f12
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