Skip to content
Snippets Groups Projects
Commit 759c9a24 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Add a common demo config for package demos

Centralize the server config in one place, so it can easily be changed in one
file for all package demos.

This just adds it for the app-shell, for starters.
parent deca3bef
No related branches found
No related tags found
No related merge requests found
Pipeline #191126 failed
export default {
basePath: '/dist/',
entryPointURL: 'http://127.0.0.1:8000',
keyCloakBaseURL: 'https://auth-dev.tugraz.at/auth',
keyCloakRealm: 'tugraz-vpu',
keyCloakClientId: 'auth-dev-mw-frontend-local',
}
......@@ -16,12 +16,18 @@
}
</style>
<script type="module" src="/dbp-app-shell.js"></script>
<script type="module" src="<%= getUrl(name + '.js') %>"></script>
</head>
<body>
<dbp-app-shell auth requested-login-status entry-point-url="http://127.0.0.1:8000" keycloak-config='{"url": "https://auth-dev.tugraz.at/auth", "realm": "tugraz-vpu", "clientId": "auth-dev-mw-frontend-local", "silentCheckSsoRedirectUri": "/silent-check-sso.html"}' src="/example.topic.metadata.json"></dbp-app-shell>
<dbp-app-shell
auth
requested-login-status
entry-point-url="<%= entryPointURL %>"
keycloak-config='{"url": "<%= keyCloakBaseURL %>", "realm": "<%= keyCloakRealm %>", "clientId": "<%= keyCloakClientId %>", "silentCheckSsoRedirectUri": "<%= getUrl('silent-check-sso.html') %>"}'
src="<%= getUrl('example.topic.metadata.json') %>">
</dbp-app-shell>
</body>
</html>
\ No newline at end of file
</html>
import glob from 'glob';
import url from 'url';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import serve from 'rollup-plugin-serve';
import del from 'rollup-plugin-delete';
import json from '@rollup/plugin-json';
import emitEJS from 'rollup-plugin-emit-ejs';
import {getPackagePath, getDistPath} from '../../rollup.utils.js';
import config from '../../demo.common.config.js';
const build = typeof process.env.BUILD !== 'undefined' ? process.env.BUILD : 'local';
console.log('build: ' + build);
const pkg = require('./package.json');
const basePath = '/dist/';
const appName = 'dbp-app-shell';
export default (async () => {
let privatePath = await getDistPath(pkg.name);
return {
input:
build != 'test'
? ['src/dbp-app-shell.js', 'src/dbp-activity-example.js']
? ['src/' + appName + '.js', 'src/dbp-activity-example.js']
: glob.sync('test/**/*.js'),
output: {
dir: 'dist',
......@@ -27,13 +35,29 @@ export default (async () => {
del({
targets: 'dist/*',
}),
emitEJS({
src: 'assets',
include: ['**/*.ejs', '**/.*.ejs'],
data: {
getUrl: (p) => {
return url.resolve(basePath, p);
},
getPrivateUrl: (p) => {
return url.resolve(`${basePath}${privatePath}/`, p);
},
name: appName,
entryPointURL: config.entryPointURL,
keyCloakBaseURL: config.keyCloakBaseURL,
keyCloakRealm: config.keyCloakRealm,
keyCloakClientId: config.keyCloakClientId,
},
}),
resolve(),
commonjs(),
json(),
copy({
targets: [
{src: 'assets/silent-check-sso.html', dest: 'dist'},
{src: 'assets/index.html', dest: 'dist'},
{src: 'assets/*.json', dest: 'dist'},
{
src: await getPackagePath('@dbp-toolkit/common', 'assets/icons/*.svg'),
......@@ -43,8 +67,8 @@ export default (async () => {
}),
process.env.ROLLUP_WATCH === 'true'
? serve({
contentBase: 'dist',
historyApiFallback: '/index.html',
contentBase: '.',
historyApiFallback: basePath + 'index.html',
host: '127.0.0.1',
port: 8002,
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment