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 @@ ...@@ -16,12 +16,18 @@
} }
</style> </style>
<script type="module" src="/dbp-app-shell.js"></script> <script type="module" src="<%= getUrl(name + '.js') %>"></script>
</head> </head>
<body> <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> </body>
</html> </html>
\ No newline at end of file
import glob from 'glob'; import glob from 'glob';
import url from 'url';
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 copy from 'rollup-plugin-copy'; import copy from 'rollup-plugin-copy';
import serve from 'rollup-plugin-serve'; import serve from 'rollup-plugin-serve';
import del from 'rollup-plugin-delete'; import del from 'rollup-plugin-delete';
import json from '@rollup/plugin-json'; import json from '@rollup/plugin-json';
import emitEJS from 'rollup-plugin-emit-ejs';
import {getPackagePath, getDistPath} from '../../rollup.utils.js'; 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'; const build = typeof process.env.BUILD !== 'undefined' ? process.env.BUILD : 'local';
console.log('build: ' + build); console.log('build: ' + build);
const pkg = require('./package.json');
const basePath = '/dist/';
const appName = 'dbp-app-shell';
export default (async () => { export default (async () => {
let privatePath = await getDistPath(pkg.name);
return { return {
input: input:
build != 'test' build != 'test'
? ['src/dbp-app-shell.js', 'src/dbp-activity-example.js'] ? ['src/' + appName + '.js', 'src/dbp-activity-example.js']
: glob.sync('test/**/*.js'), : glob.sync('test/**/*.js'),
output: { output: {
dir: 'dist', dir: 'dist',
...@@ -27,13 +35,29 @@ export default (async () => { ...@@ -27,13 +35,29 @@ export default (async () => {
del({ del({
targets: 'dist/*', 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(), resolve(),
commonjs(), commonjs(),
json(), json(),
copy({ copy({
targets: [ targets: [
{src: 'assets/silent-check-sso.html', dest: 'dist'}, {src: 'assets/silent-check-sso.html', dest: 'dist'},
{src: 'assets/index.html', dest: 'dist'},
{src: 'assets/*.json', dest: 'dist'}, {src: 'assets/*.json', dest: 'dist'},
{ {
src: await getPackagePath('@dbp-toolkit/common', 'assets/icons/*.svg'), src: await getPackagePath('@dbp-toolkit/common', 'assets/icons/*.svg'),
...@@ -43,8 +67,8 @@ export default (async () => { ...@@ -43,8 +67,8 @@ export default (async () => {
}), }),
process.env.ROLLUP_WATCH === 'true' process.env.ROLLUP_WATCH === 'true'
? serve({ ? serve({
contentBase: 'dist', contentBase: '.',
historyApiFallback: '/index.html', historyApiFallback: basePath + 'index.html',
host: '127.0.0.1', host: '127.0.0.1',
port: 8002, port: 8002,
}) })
......
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