Skip to content

Commit

Permalink
refactor: simplify tsconfig aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
schoero committed Oct 1, 2023
1 parent 3786cd1 commit a925539
Show file tree
Hide file tree
Showing 24 changed files with 88 additions and 95 deletions.
9 changes: 5 additions & 4 deletions docs/importing.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ As PDFKit internally relies on several different built in modules of Node.js, it
### Browser pre-built bundle

[![Open in StackBlitz](https://img.shields.io/badge/%E2%9A%A1%EF%B8%8E_Open_in_StackBlitz-1374ef?style=flat-square)
][browser prebuilt bundle]
][browser pre-built bundle]

PDFKit also provides a pre-built bundle that can be used directly in the browser.

[node esm javascript]: https://stackblitz.com/fork/github/schoero/swissqrbill/tree/feat/stackblitz-examples/examples/node-esm-javascript
[node cjs javascript]: https://stackblitz.com/fork/github/schoero/swissqrbill/tree/feat/stackblitz-examples/examples/node-cjs-javascript
[browser bundling with webpack]: https://stackblitz.com/fork/github/schoero/swissqrbill/tree/feat/stackblitz-examples/examples/browser-bundling-with-webpack
[node esm javascript]: https://stackblitz.com/fork/github/schoero/swissqrbill/tree/v4/examples/node-esm-javascript
[node cjs javascript]: https://stackblitz.com/fork/github/schoero/swissqrbill/tree/v4/examples/node-cjs-javascript
[browser bundling with webpack]: https://stackblitz.com/fork/github/schoero/swissqrbill/tree/v4/examples/browser-bundling-with-webpack
[browser pre-built bundle]: https://stackblitz.com/fork/github/schoero/swissqrbill/tree/v4/examples/browser-pre-built-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
></script>
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/[email protected].4/lib/pdf/swissqrbill.js"
src="https://cdn.jsdelivr.net/npm/[email protected].7/lib/svg/swissqrbill.js"
></script>
<script type="module" src="./src/script.js"></script>
</head>
Expand Down
File renamed without changes.
69 changes: 24 additions & 45 deletions package-lock.json

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

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.0.0-alpha.6",
"version": "4.0.0-alpha.7",
"type": "module",
"name": "swissqrbill",
"description": "Swiss QR Bill generation in Node.js and browsers",
Expand All @@ -15,6 +15,10 @@
},
"sideEffects": false,
"exports": {
"./bundle": {
"import": "./lib/bundle/swissqrbill.js",
"require": "./lib/bundle/swissqrbill.cjs"
},
"./errors": {
"import": "./lib/shared/errors.js",
"require": "./lib/shared/errors.cjs"
Expand Down Expand Up @@ -42,7 +46,7 @@
},
"types": "./lib/shared/types.d.ts",
"scripts": {
"build": "rm -r ./lib && vite build --config vite.config.bundle.ts && vite build --config vite.config.ts",
"build": "rm -r ./lib || true && vite build --config vite.config.ts && vite build --config vite.config.bundle.ts",
"docs": "npm run docs:pdf && npm run docs:svg && npm run docs:table && npm run docs:shared",
"docs:pdf": "unwritten src/pdf/swissqrbill.ts src/shared/types.ts -t tsconfig.docs.json -o docs/pdf/",
"docs:shared": "unwritten src/shared/utils.ts -t tsconfig.docs.json -o docs/utils/",
Expand Down Expand Up @@ -85,13 +89,13 @@
"@cspell/dict-fr-fr": "^2.2.2",
"@cspell/dict-it-it": "^3.0.1",
"@schoero/changelog-config": "^0.0.2",
"@schoero/cspell-config": "^1.6.16",
"@schoero/cspell-config": "^1.6.17",
"@schoero/eslint-config": "^1.41.19",
"@schoero/markdownlint-config": "^1.1.7",
"@schoero/ts-config": "^0.3.7",
"@schoero/unwritten-config": "^0.0.3",
"@schoero/vite-config": "^0.0.26",
"@types/node": "^20.7.2",
"@types/node": "^20.8.0",
"@types/pdfkit": "^0.12.12",
"@types/svg-parser": "^2.0.4",
"@typescript-eslint/eslint-plugin": "^6.7.3",
Expand Down Expand Up @@ -125,7 +129,7 @@
"svg"
],
"volta": {
"node": "20.7.0",
"node": "20.8.0",
"npm": "10.1.0"
}
}
6 changes: 6 additions & 0 deletions src/bundle/swissqrbill.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * as errors from "swissqrbill:errors";
export * as pdf from "swissqrbill:pdf:swissqrbill";
export * as table from "swissqrbill:pdf:table";
export * as svg from "swissqrbill:svg:swissqrbill";
export * as types from "swissqrbill:types";
export * as utils from "swissqrbill:utils";
2 changes: 1 addition & 1 deletion src/pdf/swissqrbill.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";

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

Expand Down
12 changes: 6 additions & 6 deletions src/pdf/swissqrbill.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { cleanData } from "swissqrbill:shared/cleaner";
import { generateQRData, renderQRCode } from "swissqrbill:shared/qr-code";
import { translations } from "swissqrbill:shared/translations";
import { formatAmount, formatIBAN, formatReference, getReferenceType, mm2pt, pt2mm } from "swissqrbill:shared/utils";
import { validateData } from "swissqrbill:shared/validator";
import { cleanData } from "swissqrbill:shared:cleaner";
import { generateQRData, renderQRCode } from "swissqrbill:shared:qr-code";
import { translations } from "swissqrbill:shared:translations";
import { formatAmount, formatIBAN, formatReference, getReferenceType, mm2pt, pt2mm } from "swissqrbill:utils";
import { validateData } from "swissqrbill:shared:validator";

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


/**
Expand Down
2 changes: 1 addition & 1 deletion 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";
import { Table } from "swissqrbill:pdf:table";
import {
alignmentOverrides,
alignmentVariants,
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";
import { cleanData } from "swissqrbill:shared:cleaner";

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


describe("cleaner", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/qr-code.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, test } from "vitest";

import { cleanData } from "swissqrbill:shared/cleaner";
import { cleanData } from "swissqrbill:shared:cleaner";
import { generateQRData } from "swissqrbill:shared:qr-code";
import {
creditorWithBuildingNumber,
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";
} from "swissqrbill:utils";


// https://github.com/swico/qr-bill#qr-iban
Expand Down
6 changes: 3 additions & 3 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";
import { resolveMessageParams, ValidationErrors } from "swissqrbill:shared/errors";
import { validateData } from "swissqrbill:shared/validator";
import { cleanData } from "swissqrbill:shared:cleaner";
import { resolveMessageParams, ValidationErrors } from "swissqrbill:errors";
import { validateData } from "swissqrbill:shared:validator";
import {
additionalInformationInvalidType,
additionalInformationTooLong,
Expand Down
Loading

0 comments on commit a925539

Please sign in to comment.