From 31c8ebc6fffeb0629eae43059a69e1452d91a4f6 Mon Sep 17 00:00:00 2001 From: Stephan Krusche Date: Wed, 24 May 2023 00:53:25 +1000 Subject: [PATCH] Update dependencies and fix lint issues --- LICENSE | 2 +- package.json | 6 +++++- .../src/main/resources/conversion-resource.ts | 4 ++-- .../server/src/main/resources/diagram-resource.ts | 4 ++-- .../collaboration-service.ts | 2 +- .../conversion-service/conversion-service.ts | 15 ++++++--------- packages/webapp/package.json | 2 +- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/LICENSE b/LICENSE index 9002ac2..0c7db49 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 Chair for Applied Software Engineering +Copyright (c) 2023 TUM Applied Software Engineering Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 11de8b4..4912803 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,12 @@ "private": true, "main": "index.js", "repository": "git@github.com:ls1intum/Apollon_standalone.git", - "author": "Tobias Priesching ", "license": "MIT", + "author": { + "name": "Stephan Krusche", + "email": "krusche@tum.de", + "url": "https://ase.cit.tum.de/krusche" + }, "workspaces": { "packages": [ "packages/*" diff --git a/packages/server/src/main/resources/conversion-resource.ts b/packages/server/src/main/resources/conversion-resource.ts index eaba241..7f5ef2a 100644 --- a/packages/server/src/main/resources/conversion-resource.ts +++ b/packages/server/src/main/resources/conversion-resource.ts @@ -15,10 +15,10 @@ export class ConversionResource { if (typeof model === 'string') { model = JSON.parse(model); } - const { svg, clip } = await this.conversionService.convertToSvg((model)); + const { svg, clip } = await this.conversionService.convertToSvg((model as unknown) as UMLModel); const { width, height } = clip; pdfMake.vfs = pdfFonts.pdfMake.vfs; - var doc = pdfMake.createPdf({ + const doc = pdfMake.createPdf({ content: [ { svg, diff --git a/packages/server/src/main/resources/diagram-resource.ts b/packages/server/src/main/resources/diagram-resource.ts index d424abb..60e4fd2 100644 --- a/packages/server/src/main/resources/diagram-resource.ts +++ b/packages/server/src/main/resources/diagram-resource.ts @@ -3,7 +3,7 @@ import { Request, Response } from 'express'; import pdfMake from 'pdfmake/build/pdfmake.min'; // @ts-ignore import pdfFonts from 'pdfmake/build/vfs_fonts'; -import { DiagramDTO } from '../../../../shared/src/main/diagram-dto'; +import { DiagramDTO } from 'shared/src/main/diagram-dto'; import { DiagramService } from '../services/diagram-service/diagram-service'; import { DiagramFileStorageService } from '../services/diagram-storage/diagram-file-storage-service'; @@ -47,7 +47,7 @@ export class DiagramResource { } else { pdfMake.vfs = pdfFonts.pdfMake.vfs; const svg = req.body.svg; - var doc = pdfMake.createPdf({ + const doc = pdfMake.createPdf({ content: [ { svg, diff --git a/packages/server/src/main/services/collaboration-service/collaboration-service.ts b/packages/server/src/main/services/collaboration-service/collaboration-service.ts index abeff8f..e2e504e 100644 --- a/packages/server/src/main/services/collaboration-service/collaboration-service.ts +++ b/packages/server/src/main/services/collaboration-service/collaboration-service.ts @@ -11,7 +11,7 @@ export class CollaborationService { private wsServer: any; private clients: { [key: string]: Client } = {}; private diagramService: DiagramFileStorageService; - private interval: NodeJS.Timeout; + private readonly interval: NodeJS.Timeout; constructor() { this.wsServer = new WebSocket.Server({ noServer: true }); this.diagramService = new DiagramFileStorageService(); diff --git a/packages/server/src/main/services/conversion-service/conversion-service.ts b/packages/server/src/main/services/conversion-service/conversion-service.ts index d880928..3c42e19 100644 --- a/packages/server/src/main/services/conversion-service/conversion-service.ts +++ b/packages/server/src/main/services/conversion-service/conversion-service.ts @@ -3,27 +3,24 @@ import { ApollonEditor, SVG, UMLModel } from '@ls1intum/apollon'; export class ConversionService { convertToSvg = async (model: UMLModel): Promise => { - //@ts-ignore - document.body.innerHTML = '
'; + document.body.innerHTML = '
'; - //JSDOM does not support getBBox so we have to mock it here - //@ts-ignore + // JSDOM does not support getBBox so we have to mock it here + // @ts-ignore window.SVGElement.prototype.getBBox = () => ({ x: 0, y: 0, width: 10, - heigth: 10, + height: 10, }); - //@ts-ignore + // @ts-ignore const container = document.querySelector('div')!; const editor = new ApollonEditor(container, {}); editor.model = model; - const svg: SVG = await editor.exportAsSVG(); - - return svg; + return editor.exportAsSVG(); }; } diff --git a/packages/webapp/package.json b/packages/webapp/package.json index 0e45b09..667b92a 100644 --- a/packages/webapp/package.json +++ b/packages/webapp/package.json @@ -12,7 +12,7 @@ "build:local": "yarn clean && DEPLOYMENT_URL=http://localhost:8080 webpack --config ./webpack/webpack.prod.js" }, "engines": { - "node": ">=14.1.0", + "node": ">=18.14.0", "yarn": ">=1.22.0" }, "dependencies": {