Skip to content

Commit

Permalink
Add some context to the dirty fix of the wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofVDB1 committed Feb 5, 2024
1 parent 47995bb commit b0bd8d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/oslo-extractor-uml-ea/lib/DataRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Logger } from '@oslo-flanders/core';
import { fetchFileOrUrl } from '@oslo-flanders/core';
import MDBReader from 'mdb-reader';
import MDBReader from './MdbReaderWrapper';
import type { EaAttribute } from '@oslo-extractor-uml-ea/types/EaAttribute';
import type { EaConnector } from '@oslo-extractor-uml-ea/types/EaConnector';
import type { EaDiagram } from '@oslo-extractor-uml-ea/types/EaDiagram';
Expand Down
14 changes: 14 additions & 0 deletions packages/oslo-extractor-uml-ea/lib/MdbReaderWrapper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as MDBReaderOriginal from 'mdb-reader';

// This is a very dirty fix to a problem with one of the external libraries we use being mdb-reader.
// As of version 2.x the library is written in ESM and does not
// support CommonJS: https://github.com/andipaetzold/mdb-reader/releases/tag/v2.0.0-next.7
// This means that we cannot use it in our project as it is and we either need to fork it
// and fix it ourselves or use a dirty workaround
// The workaround is to use the default import of the library and then access the default property
// of the default import, which will throw some errors in the editor, but will work as expected.


const MDBReader = MDBReaderOriginal.default.default;

Check failure on line 12 in packages/oslo-extractor-uml-ea/lib/MdbReaderWrapper.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 16.x)

Property 'default' does not exist on type 'typeof MDBReader'.

Check failure on line 12 in packages/oslo-extractor-uml-ea/lib/MdbReaderWrapper.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 18.x)

Property 'default' does not exist on type 'typeof MDBReader'.

Check failure on line 12 in packages/oslo-extractor-uml-ea/lib/MdbReaderWrapper.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

Property 'default' does not exist on type 'typeof MDBReader'.

Check failure on line 12 in packages/oslo-extractor-uml-ea/lib/MdbReaderWrapper.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18.x)

Property 'default' does not exist on type 'typeof MDBReader'.

export default MDBReader;

0 comments on commit b0bd8d5

Please sign in to comment.