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 @@
<html>
<head>
<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>
<body>
......
......@@ -6,7 +6,7 @@ module.exports = function(config) {
basePath: 'dist',
frameworks: ['mocha', 'chai'],
files: [
'./bundle.js',
{pattern: './*.js', included: true, watched: true, served: true, type: 'module'},
{pattern: './**/*', included: false, watched: true, served: true},
],
autoWatch: true,
......
......@@ -11,20 +11,22 @@
"puppeteer": "^1.15.0",
"mocha": "^6.2.0",
"chai": "^4.2.0",
"rollup": "^1.11.3",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-copy": "^2.0.1",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-postcss": "^2.0.3",
"rollup": "^1.20.3",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-consts": "^1.0.1",
"rollup-plugin-copy": "^3.1.0",
"rollup-plugin-delete": "^1.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"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-multi-entry": "^2.1.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-url": "^2.2.2",
"i18next-scanner": "^2.10.2",
"vpu-common": "file:./vendor/common"
},
"dependencies": {
"bulma": "^0.7.5",
"lit-element": "^2.1.0"
},
"scripts": {
......
import path from 'path';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
import copy from 'rollup-plugin-copy';
import {terser} from "rollup-plugin-terser";
import json from 'rollup-plugin-json';
import replace from "rollup-plugin-replace";
import serve from 'rollup-plugin-serve';
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';
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 {
input: (build != 'test') ? 'src/demo.js' : 'test/**/*.js',
output: {
......@@ -19,7 +42,13 @@ export default {
format: 'esm'
},
plugins: [
del({
targets: 'dist/*'
}),
multiEntry(),
consts({
environment: build,
}),
resolve({
customResolveOptions: {
// ignore node_modules from vendored packages
......@@ -30,21 +59,21 @@ export default {
include: 'node_modules/**'
}),
json(),
replace({
"process.env.BUILD": '"' + build + '"',
}),
postcss({
inject: false,
minimize: false,
plugins: []
url({
limit: 0,
include: [
"node_modules/bulma/**/*.css",
"node_modules/bulma/**/*.sass",
],
emitFiles: true,
fileName: 'shared/[name].[hash][extname]'
}),
(build !== 'local' && build !== 'test') ? terser() : false,
copy({
targets: [
'assets/index.html',
'assets/favicon.ico'
],
outputFolder: 'dist'
{src: 'assets/index.html', dest: 'dist'},
{src: 'assets/favicon.ico', dest: 'dist'},
]
}),
(process.env.ROLLUP_WATCH === 'true') ? serve({contentBase: 'dist', host: '127.0.0.1', port: 8002}) : false
]
......
......@@ -7,4 +7,5 @@ export const createUUID = () => {
});
return uuid;
}
};
......@@ -2,7 +2,8 @@ import {i18n} from './i18n';
import {send as notify} from 'vpu-common/notification';
import {html, LitElement} from 'lit-element';
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 {
constructor() {
......@@ -25,10 +26,9 @@ class NotificationDemo extends LitElement {
}
render() {
const bulmaCSS = commonUtils.getAssetURL(bulmaCSSPath);
return html`
<style>
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css">
<link rel="stylesheet" href="${bulmaCSS}">
<section class="section">
<div class="container">
......
......@@ -2,7 +2,8 @@ import {i18n} from './i18n';
import {createUUID} from './utils'
import {html} from '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
......@@ -74,8 +75,10 @@ class VPUNotification extends VPULitElement {
}
render() {
commonUtils.initAssetBaseURL('vpu-notification-src');
const bulmaCSS = commonUtils.getAssetURL(bulmaCSSPath);
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>
#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;}
......
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