From 24901621ed3c384728cc0760ed38e90ac33b1659 Mon Sep 17 00:00:00 2001 From: Fernando IL Date: Fri, 20 Dec 2024 15:32:16 -0600 Subject: [PATCH] chore: :construction: update dependencies and small refactorings --- eslint.config.js | 2 +- package.json | 42 +++++++++++----------- src/abstract_invoice_data.ts | 12 +++---- src/builders/abstract_pdf_maker_builder.ts | 8 ++--- src/builders/browser/pdf_maker_builder.ts | 7 ++-- typedoc.json | 3 +- 6 files changed, 36 insertions(+), 38 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index a86528b..fdb991a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,6 +1,6 @@ // @ts-check import nodecfdiConfig from '@nodecfdi/eslint-config'; -const { defineConfig } = nodecfdiConfig(import.meta.dirname, { vitest: true }); +const { defineConfig } = nodecfdiConfig(import.meta.dirname, { vitest: true, sonarjs: true }); export default defineConfig(); diff --git a/package.json b/package.json index 108d05c..e271ade 100644 --- a/package.json +++ b/package.json @@ -74,34 +74,34 @@ "version": "pnpm run build && pnpm run changelog" }, "devDependencies": { - "@commitlint/cli": "^19.4.1", - "@commitlint/config-conventional": "^19.4.1", - "@jsprismarine/typedoc-material-theme": "^1.0.4", + "@commitlint/cli": "^19.6.1", + "@commitlint/config-conventional": "^19.6.0", "@nodecfdi/cfdi-core": "^0.5.0", "@nodecfdi/cfdi-expresiones": "^3.0.2", - "@nodecfdi/eslint-config": "^2.0.2", - "@nodecfdi/prettier-config": "^1.2.0", - "@nodecfdi/tsconfig": "^1.7.2", - "@types/node": "^20.16.5", - "@types/pdfmake": "^0.2.9", - "@vitest/coverage-istanbul": "^2.0.5", - "auto-changelog": "^2.4.0", - "eslint": "^9.10.0", - "husky": "^9.1.5", + "@nodecfdi/eslint-config": "^2.4.1", + "@nodecfdi/prettier-config": "^1.4.0", + "@nodecfdi/tsconfig": "^1.7.3", + "@types/node": "^22.10.2", + "@types/pdfmake": "^0.2.10", + "@vitest/coverage-istanbul": "^2.1.8", + "auto-changelog": "^2.5.0", + "eslint": "^9.17.0", + "husky": "^9.1.7", "is-in-ci": "^1.0.0", - "np": "^10.0.7", - "pdfmake": "^0.2.12", - "prettier": "^3.3.3", + "np": "^10.1.0", + "pdfmake": "^0.2.16", + "prettier": "^3.4.2", "tshy": "^3.0.2", - "typedoc": "^0.26.7", - "typescript": "^5.6.2", - "vitest": "^2.0.5" + "typedoc": "^0.27.5", + "typedoc-github-theme": "^0.2.0", + "typescript": "^5.7.2", + "vitest": "^2.1.8" }, "peerDependencies": { "@nodecfdi/cfdi-core": ">=0.5.0", "@nodecfdi/cfdi-expresiones": ">=3.0.2", - "@types/pdfmake": ">=0.2.9", - "pdfmake": ">=0.2.9" + "@types/pdfmake": ">=0.2.10", + "pdfmake": ">=0.2.16" }, "peerDependenciesMeta": { "@types/pdfmake": { @@ -138,7 +138,7 @@ ] }, "prettier": "@nodecfdi/prettier-config", - "packageManager": "pnpm@9.10.0", + "packageManager": "pnpm@9.15.1", "publishConfig": { "access": "public", "tag": "latest" diff --git a/src/abstract_invoice_data.ts b/src/abstract_invoice_data.ts index 064ec28..a102378 100644 --- a/src/abstract_invoice_data.ts +++ b/src/abstract_invoice_data.ts @@ -4,21 +4,21 @@ import { DiscoverExtractor } from '@nodecfdi/cfdi-expresiones'; import normalizeSpace from '#src/utils/normalize_space'; export default abstract class AbstractInvoiceData { - protected declare _emisor: XmlNodeInterface; + declare protected _emisor: XmlNodeInterface; - protected declare _receptor: XmlNodeInterface; + declare protected _receptor: XmlNodeInterface; - protected declare _timbreFiscalDigital: XmlNodeInterface; + declare protected _timbreFiscalDigital: XmlNodeInterface; - protected declare _qrUrl: string; + declare protected _qrUrl: string; - protected declare _tfdSourceString: string; + declare protected _tfdSourceString: string; protected _logo: string | undefined; protected _additionalFields: { title: string; value: string }[] | undefined; - protected declare _legendFooter: string; + declare protected _legendFooter: string; public emisor(): XmlNodeInterface { return this._emisor; diff --git a/src/builders/abstract_pdf_maker_builder.ts b/src/builders/abstract_pdf_maker_builder.ts index 358189a..e556e65 100644 --- a/src/builders/abstract_pdf_maker_builder.ts +++ b/src/builders/abstract_pdf_maker_builder.ts @@ -13,13 +13,13 @@ import { } from '#src/types'; export default class AbstractPdfMakerBuilder { - protected declare _documentTranslator: DocumentTranslatorInterface; + declare protected _documentTranslator: DocumentTranslatorInterface; - protected declare _catalogs: CatalogsData; + declare protected _catalogs: CatalogsData; - protected declare _documentOptions: DocumentOptions; + declare protected _documentOptions: DocumentOptions; - protected declare _options?: BufferOptions; + declare protected _options?: BufferOptions; protected _primaryColor = '#359136'; diff --git a/src/builders/browser/pdf_maker_builder.ts b/src/builders/browser/pdf_maker_builder.ts index 4381102..ec70430 100644 --- a/src/builders/browser/pdf_maker_builder.ts +++ b/src/builders/browser/pdf_maker_builder.ts @@ -74,9 +74,9 @@ export default class PdfMakerBuilder< protected async buildPdf(data: T): Promise { const vfsFonts = await import('pdfmake/build/vfs_fonts.js'); - const vfs = 'default' in vfsFonts ? vfsFonts.default : undefined; - if (vfs && !this._overrideVFS) { - this._overrideVFS = vfs.pdfMake.vfs; + const vfs = 'default' in vfsFonts ? vfsFonts.default : vfsFonts; + if (!this._overrideVFS) { + this._overrideVFS = vfs as unknown as Record; } const pdfTemplate = this._documentTranslator.translate( @@ -87,7 +87,6 @@ export default class PdfMakerBuilder< this._bgGrayColor, ); - // eslint-disable-next-line import-x/no-named-as-default-member return pdfMake.createPdf(pdfTemplate, this.layouts(), this._overrideFonts, this._overrideVFS); } diff --git a/typedoc.json b/typedoc.json index aaaa872..dad51bd 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,6 +1,5 @@ { - "plugin": ["@jsprismarine/typedoc-material-theme"], - "themeColor": "#badc69", + "plugin": ["typedoc-github-theme"], "entryPoints": ["./src"], "entryPointStrategy": "expand", "out": "./docs"