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

Remove the toolkit git submodule

Instead install things from npm like everything else.

rollup.utils.js was part of toolkit, but not of any published package, so just
copy that for now.
parent 2f19ee09
No related branches found
No related tags found
1 merge request!207Draft: Remove the toolkit git submodule
Pipeline #185510 passed
/vendor/**
/dist/**
/*.js
\ No newline at end of file
[submodule "vendor/toolkit"]
path = vendor/toolkit
url = git@gitlab.tugraz.at:dbp/web-components/toolkit.git
node_modules/
/dist
/vendor
......@@ -4,9 +4,6 @@
"main": "src/dbp-frontend-template-app.js",
"license": "LGPL-2.1-or-later",
"private": true,
"workspaces": [
"vendor/toolkit/packages/*"
],
"devDependencies": {
"@babel/core": "^7.10.3",
"@babel/preset-env": "^7.10.3",
......@@ -18,6 +15,7 @@
"chai": "^4.2.0",
"eslint": "^8.0.0",
"eslint-plugin-jsdoc": "^39.0.0",
"find-cache-dir": "^3.3.2",
"glob": "^8.0.0",
"i18next-parser": "^6.4.0",
"karma": "^6.0.0",
......@@ -38,14 +36,10 @@
"selfsigned": "^2.0.0"
},
"dependencies": {
"@dbp-toolkit/app-shell": "^0.3.0",
"@dbp-toolkit/auth": "^0.3.0",
"@dbp-toolkit/common": "^0.3.0",
"@dbp-toolkit/font-source-sans-pro": "^0.2.2",
"@dbp-toolkit/language-select": "^0.3.0",
"@dbp-toolkit/notification": "^0.3.0",
"@dbp-toolkit/person-profile": "^0.2.2",
"@open-wc/scoped-elements": "^2.0.0",
"@dbp-toolkit/app-shell": "^0.3.3",
"@dbp-toolkit/common": "^0.3.3",
"@dbp-toolkit/font-source-sans-pro": "^0.2.4",
"@open-wc/scoped-elements": "^2.1.0",
"i18next": "^21.4.2",
"lit": "^2.0.0"
},
......
......@@ -18,7 +18,7 @@ import {
getBuildInfo,
generateTLSConfig,
getDistPath,
} from './vendor/toolkit/rollup.utils.js';
} from './rollup.utils.js';
let appName = 'dbp-frontend-template-app';
const pkg = require('./package.json');
......
import path from 'path';
import url from 'url';
import fs from 'fs';
import child_process from 'child_process';
import selfsigned from 'selfsigned';
import findCacheDir from 'find-cache-dir';
export function getBuildInfo(build) {
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,
time: new Date().toISOString(),
env: build
}
}
export async function getDistPath(packageName, assetPath) {
if (assetPath === undefined)
assetPath = '';
// make sure the package exists to avoid typos
await getPackagePath(packageName, '');
return path.join('local', packageName, assetPath);
}
export async function getPackagePath(packageName, assetPath) {
let packageRoot;
let current = require.resolve('./package.json');
if (require(current).name === packageName) {
// current package
packageRoot = path.dirname(current);
} else {
// Other packages from nodes_modules etc.
packageRoot = path.dirname(require.resolve(packageName + '/package.json'));
}
return path.relative(process.cwd(), path.join(packageRoot, assetPath));
}
/**
* Creates a dummy dev server certificate, caches it and returns it.
*/
export async function generateTLSConfig() {
const certDir = findCacheDir({name: 'dbp-dev-server-cert'});
const keyPath = path.join(certDir, 'server.key');
const certPath = path.join(certDir, 'server.cert');
await fs.promises.mkdir(certDir, {recursive: true});
if (!fs.existsSync(keyPath) || !fs.existsSync(certPath)) {
const attrs = [{name: 'commonName', value: 'dbp-dev.localhost'}];
const pems = selfsigned.generate(attrs, {algorithm: 'sha256', days: 9999, keySize: 2048});
await fs.promises.writeFile(keyPath, pems.private);
await fs.promises.writeFile(certPath, pems.cert);
}
return {
key: await fs.promises.readFile(keyPath),
cert: await fs.promises.readFile(certPath)
}
}
\ No newline at end of file
Subproject commit c39365c8a6555a4d8bef97e06c0680c2dea6b054
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment