Skip to content

Commit

Permalink
refactor: use moduleResolution option Bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
schoero committed Sep 20, 2023
1 parent e962fe2 commit 30b339b
Show file tree
Hide file tree
Showing 25 changed files with 63 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

// ES module import
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.importModuleSpecifierEnding": "minimal",
"typescript.preferences.useAliasesForRenames": true,
"typescript.preferences.autoImportFileExcludePatterns": [
"@types/node/test.d.ts"
Expand Down
Empty file added docs/migration.md
Empty file.
8 changes: 4 additions & 4 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 @@ -74,7 +74,7 @@
"@schoero/cspell-config": "^1.6.16",
"@schoero/eslint-config": "^1.41.17",
"@schoero/markdownlint-config": "^1.1.7",
"@schoero/ts-config": "^0.3.5",
"@schoero/ts-config": "^0.3.6",
"@schoero/unwritten-config": "^0.0.3",
"@schoero/vite-config": "^0.0.25",
"@types/node": "^20.6.3",
Expand Down
8 changes: 4 additions & 4 deletions src/pdf/swissqrbill.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, expect, it } from "vitest";

import { mm2pt } from "swissqrbill:shared/utils.js";
import { minimalRequired } from "swissqrbill:tests:data/valid-data.js";
import { TestDocument } from "swissqrbill:tests:utils/pdf.js";
import { mm2pt } from "swissqrbill:shared/utils";
import { minimalRequired } from "swissqrbill:tests:data/valid-data";
import { TestDocument } from "swissqrbill:tests:utils/pdf";

import { SwissQRBill } from "./swissqrbill.js";
import { SwissQRBill } from "./swissqrbill";


describe("qr-bill", async () => {
Expand Down
12 changes: 6 additions & 6 deletions src/pdf/swissqrbill.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { validateData } from "swissqrbill:shared/validator.js";
import { validateData } from "swissqrbill:shared/validator";

import { cleanData } from "../shared/cleaner.js";
import { generateQRData, renderQRCode } from "../shared/qr-code.js";
import translations from "../shared/translations.js";
import * as utils from "../shared/utils.js";
import { cleanData } from "../shared/cleaner";
import { generateQRData, renderQRCode } from "../shared/qr-code";
import translations from "../shared/translations";
import * as utils from "../shared/utils";

import type { Creditor, Data, Debtor, Languages, QRBillOptions, Size } from "../shared/types.js";
import type { Creditor, Data, Debtor, Languages, QRBillOptions, Size } from "../shared/types";

/**
* The QRBill class creates the Payment Part with the QR Code. It can be attached to any PDFKit document instance
Expand Down
6 changes: 3 additions & 3 deletions src/pdf/table.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";

import { Table } from "swissqrbill:pdf/table.js";
import { Table } from "swissqrbill:pdf/table";
import {
alignmentOverrides,
alignmentVariants,
Expand All @@ -14,8 +14,8 @@ import {
paddingOverrides,
paddingVariants,
textColorOverrides
} from "swissqrbill:tests:data/table.js";
import { TestDocument } from "swissqrbill:tests:utils/pdf.js";
} from "swissqrbill:tests:data/table";
import { TestDocument } from "swissqrbill:tests:utils/pdf";


describe("table", async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/shared/cleaner.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";

import { cleanData } from "swissqrbill:shared/cleaner.js";
import { cleanData } from "swissqrbill:shared/cleaner";

import type { Data } from "swissqrbill:shared/types.js";
import type { Data } from "swissqrbill:shared/types";


describe("cleaner", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/cleaner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Creditor, Data, Debtor } from "./types.js";
import type { Creditor, Data, Debtor } from "./types";


export function cleanData(data: Data): Data {
Expand Down
6 changes: 3 additions & 3 deletions src/shared/qr-code.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from "vitest";

import { cleanData } from "swissqrbill:shared/cleaner.js";
import { generateQRData } from "swissqrbill:shared:qr-code.js";
import { cleanData } from "swissqrbill:shared/cleaner";
import { generateQRData } from "swissqrbill:shared:qr-code";
import {
creditorWithBuildingNumber,
creditorWithBuildingNumberString,
Expand All @@ -22,7 +22,7 @@ import {
minimalRequiredWithEuro,
minimalRequiredWithMaxedOutMessage,
minimalRequiredWithMessage
} from "swissqrbill:tests:data/valid-data.js";
} from "swissqrbill:tests:data/valid-data";


describe("generateQRData", () => {
Expand Down
6 changes: 3 additions & 3 deletions src/shared/qr-code.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getReferenceType } from "../shared/utils.js";
import { getReferenceType } from "../shared/utils";

import { qrcodegen } from "./qr-code-generator.js";
import { qrcodegen } from "./qr-code-generator";

import type { Data } from "./types.js";
import type { Data } from "./types";


export function generateQRData(data: Data): string {
Expand Down
6 changes: 3 additions & 3 deletions src/shared/translations.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, expect, test } from "vitest";

import { minimalRequired } from "swissqrbill:tests:data/valid-data.js";
import { pdf } from "swissqrbill:tests:utils/pdf.js";
import { svg } from "swissqrbill:tests:utils/svg.js";
import { minimalRequired } from "swissqrbill:tests:data/valid-data";
import { pdf } from "swissqrbill:tests:utils/pdf";
import { svg } from "swissqrbill:tests:utils/svg";


describe("translations", async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
isQRReferenceValid,
isSCORReference,
isSCORReferenceValid
} from "swissqrbill:shared:utils.js";
} from "swissqrbill:shared:utils";


// https://github.com/swico/qr-bill#qr-iban
Expand Down
10 changes: 5 additions & 5 deletions src/shared/validator.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";

import { cleanData } from "swissqrbill:shared/cleaner.js";
import { resolveMessageParams, ValidationErrors } from "swissqrbill:shared/errors.js";
import { validateData } from "swissqrbill:shared/validator.js";
import { cleanData } from "swissqrbill:shared/cleaner";
import { resolveMessageParams, ValidationErrors } from "swissqrbill:shared/errors";
import { validateData } from "swissqrbill:shared/validator";
import {
additionalInformationInvalidType,
additionalInformationTooLong,
Expand Down Expand Up @@ -70,7 +70,7 @@ import {
referenceTypeInvalid,
regularIBANAndQRReference,
regularIBANAndReferenceTooLong
} from "swissqrbill:tests:data/invalid-data.js";
} from "swissqrbill:tests:data/invalid-data";
import {
creditorWithBuildingNumber,
creditorWithBuildingNumberString,
Expand All @@ -93,7 +93,7 @@ import {
minimalRequiredWithEuro,
minimalRequiredWithMaxedOutMessage,
minimalRequiredWithMessage
} from "swissqrbill:tests:data/valid-data.js";
} from "swissqrbill:tests:data/valid-data";


describe("validator", async () => {
Expand Down
6 changes: 3 additions & 3 deletions src/shared/validator.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ValidationError, ValidationErrors } from "swissqrbill:shared/errors.js";
import { ValidationError, ValidationErrors } from "swissqrbill:shared/errors";

import { isIBANValid, isQRIBAN, isQRReference, isQRReferenceValid } from "./utils.js";
import { isIBANValid, isQRIBAN, isQRReference, isQRReferenceValid } from "./utils";

import type { Data } from "./types.js";
import type { Data } from "./types";


/**
Expand Down
14 changes: 7 additions & 7 deletions src/svg/swissqrbill.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { calc, SVG } from "svg-engine";

import { validateData } from "swissqrbill:shared/validator.js";
import { validateData } from "swissqrbill:shared/validator";

import { cleanData } from "../shared/cleaner.js";
import { generateQRData, renderQRCode } from "../shared/qr-code.js";
import translations from "../shared/translations.js";
import * as utils from "../shared/utils.js";
import { cleanData } from "../shared/cleaner";
import { generateQRData, renderQRCode } from "../shared/qr-code";
import translations from "../shared/translations";
import * as utils from "../shared/utils";

import { calculateTextWidth } from "./characterWidth.js";
import { calculateTextWidth } from "./characterWidth";

import type { Creditor, Data, Debtor, Languages, SVGOptions } from "../shared/types.js";
import type { Creditor, Data, Debtor, Languages, SVGOptions } from "../shared/types";


export class SwissQRBill {
Expand Down
4 changes: 2 additions & 2 deletions tests/data/invalid-data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { creditorWithQRIBAN, minimalRequired, minimalRequiredWithDebtor } from "swissqrbill:tests:data/valid-data.js";
import { creditorWithQRIBAN, minimalRequired, minimalRequiredWithDebtor } from "swissqrbill:tests:data/valid-data";

import type { Data } from "swissqrbill:shared:types.js";
import type { Data } from "swissqrbill:shared:types";


// Missing creditor
Expand Down
2 changes: 1 addition & 1 deletion tests/data/table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PDFTable } from "swissqrbill:shared/types.js";
import type { PDFTable } from "swissqrbill:shared/types";


export const backgroundColorOverrides: PDFTable = {
Expand Down
4 changes: 2 additions & 2 deletions tests/data/valid-data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fillUntil } from "swissqrbill:tests:utils/fill.js";
import { fillUntil } from "swissqrbill:tests:utils/fill";

import type { Creditor, Data, Debtor } from "swissqrbill:shared:types.js";
import type { Creditor, Data, Debtor } from "swissqrbill:shared:types";

// Default data
const creditor: Creditor = {
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import {
minimalRequiredWithEuro,
minimalRequiredWithMaxedOutMessage,
minimalRequiredWithMessage
} from "swissqrbill:tests:data/valid-data.js";
import { pdf } from "swissqrbill:tests:utils/pdf.js";
import { svg } from "swissqrbill:tests:utils/svg.js";
} from "swissqrbill:tests:data/valid-data";
import { pdf } from "swissqrbill:tests:utils/pdf";
import { svg } from "swissqrbill:tests:utils/svg";


describe("data", async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/options.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from "vitest";

import { minimalRequired } from "swissqrbill:tests:data/valid-data.js";
import { pdf } from "swissqrbill:tests:utils/pdf.js";
import { minimalRequired } from "swissqrbill:tests:data/valid-data";
import { pdf } from "swissqrbill:tests:utils/pdf";


describe("options", async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/fill.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";

import { fillUntil } from "./fill.js";
import { fillUntil } from "./fill";


describe("fill", () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { buffer } from "node:stream/consumers";
import PDFParser from "pdf2json";
import PDFDocument from "pdfkit";

import { SwissQRBill } from "swissqrbill:pdf/swissqrbill.js";
import { SwissQRBill } from "swissqrbill:pdf/swissqrbill";

import type { Data, PDFOptions } from "swissqrbill:shared:types.js";
import type { Data, PDFOptions } from "swissqrbill:shared:types";


export type TestDocumentName = `${string}/${string}.pdf`;
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/svg.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { mkdir, writeFile } from "node:fs/promises";
import { dirname, join } from "node:path";

import { SwissQRBill } from "swissqrbill:svg:swissqrbill.js";
import { SwissQRBill } from "swissqrbill:svg:swissqrbill";

import type { Data, SVGOptions } from "swissqrbill:shared:types.js";
import type { Data, SVGOptions } from "swissqrbill:shared:types";


export type TestDocumentName = `${string}/${string}.svg`;
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"swissqrbill:svg:*": ["src/svg/*"],
"swissqrbill:tests:*": ["tests/*"]
},
"skipLibCheck": true,
"target": "ES6"
"skipLibCheck": true
},
"include": [
"src",
Expand Down

0 comments on commit 30b339b

Please sign in to comment.