Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use @xmldom/xmldom 0.9.2 instead of legacy xmldom 0.6.0 #404

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"lint": "eslint . --report-unused-disable-directives --max-warnings 0"
},
"dependencies": {
"@xmldom/xmldom": "^0.9.2",
"axios": "^1.7.7",
"buffer": "^6.0.3",
"file-type": "^19.5.0",
Expand All @@ -25,8 +26,7 @@
"react-datepicker": "^7.3.0",
"react-dom": "^18.3.1",
"react-owl-carousel": "^2.3.3",
"react-router-dom": "^6.26.2",
"xmldom": "^0.6.0"
"react-router-dom": "^6.26.2"
},
"devDependencies": {
"@eslint/js": "^9.10.0",
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/marketplace/Partners/Partners.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FC } from 'react';
import { useEffect, useState } from 'react';
import { DOMParser } from 'xmldom';
import { DOMParser } from '@xmldom/xmldom';

import OwlCarousel from 'react-owl-carousel';
import 'owl.carousel/dist/assets/owl.carousel.css';
Expand Down Expand Up @@ -31,7 +31,8 @@ export const Partners: FC = () => {
const partnerNameTags = xmlDoc.getElementsByTagName('name');

for (const nameTag of Array.from(partnerNameTags)) {
const name = nameTag.textContent || 'Error in loading name';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const name = (nameTag as any)?.textContent || 'Error in loading name';
const photoUrl = `assets/img/partners/${name
.toLowerCase()
.replace(' ', '-')}.jpg`;
Expand Down
19 changes: 10 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@sectester/reporter": "^0.33.1",
"@sectester/runner": "^0.33.1",
"@sectester/scan": "^0.33.1",
"@xmldom/xmldom": "^0.9.2",
"axios": "^1.7.7",
"bcrypt": "^5.1.1",
"class-transformer": "^0.5.1",
Expand All @@ -62,7 +63,6 @@
"raw-body": "^3.0.0",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1",
"xmldom": "^0.6.0",
"xpath": "0.0.34"
},
"devDependencies": {
Expand Down
7 changes: 3 additions & 4 deletions src/partners/partners.service.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Injectable, Logger } from '@nestjs/common';
import { DOMParser } from 'xmldom';
import { DOMParser } from '@xmldom/xmldom';
import xpath, { SelectReturnType } from 'xpath';

@Injectable()
export class PartnersService {
private readonly logger = new Logger(PartnersService.name);

private readonly XML_HEADER = '<?xml version="1.0" encoding="UTF-8"?>';
private readonly XML_AUTHORS_STR: string = `
${this.XML_HEADER}
private readonly XML_AUTHORS_STR: string = `${this.XML_HEADER}
<partners>
<partner>
<name>Walter White</name>
Expand Down Expand Up @@ -57,7 +56,7 @@ export class PartnersService {
this.XML_AUTHORS_STR,
'text/xml'
);
return partnersXMLObj;
return partnersXMLObj as unknown as Node;
}

private selectPartnerPropertiesByXPATH(
Expand Down