Skip to content

Commit

Permalink
Merge pull request #415 from schoero/v4
Browse files Browse the repository at this point in the history
* New features
  * SwissQRBill can now be attached to any PDFDocument instance from PDFKit.
  * New SwissQRCode class to create the standalone Swiss QR Code to attach to an existing PDFKit document.
  * New Table class to create a table to attach to an existing PDFKit document.
  * It is now possible to change the font of the QR Bill. The allowed fonts are `"Arial"` | `"Frutiger"` | `"Helvetica"` | `"Liberation Sans"`
  * Additional options for SVG renderings.

* Breaking changes
  * The entrypoints have changed. Please read the [importing documentation](docs/importing.md) for more information.
  * SwissQRBill no longer extends PDFKit.
  * The table method has been extracted into it's own class.
  * Events have been removed from SwissQRBill.
  * Properties and options have been renamed.
  * Now requires Node.js >= 18.0.0

* Fixes
  * Some slight rendering improvements.

* Other improvements
  * Better examples. The examples are now automatically hosted on StackBlitz. Everyone can now easily try out the library in the browser without having to install anything.
  * Automated documentation. SwissQRBill now uses [unwritten](https://github.com/schoero/unwritten) to automatically generate the documentation. This makes it easier to keep the documentation up to date.
  * Automated testing for even more stability.
  • Loading branch information
schoero authored Nov 10, 2023
2 parents 57d7602 + e474a1e commit 4df6c5f
Show file tree
Hide file tree
Showing 177 changed files with 103,649 additions and 8,341 deletions.
47 changes: 47 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"import": [
"@schoero/cspell-config",
"@cspell/dict-fr-fr/cspell-ext.json",
"@cspell/dict-it-it/cspell-ext.json"
],
"overrides": [
{
"filename": "**/translations.ts",
"language": "en, de, fr, it",
"caseSensitive": false
}
],
"words": [
"brfs",
"debitor",
"fontkit",
"Frutiger",
"Grosse",
"iban",
"italian",
"linebreak",
"linebreaker",
"pdfdocument",
"pdfkit",
"postgenerate",
"qrcodegen",
"qriban",
"QRIBAN",
"QRIID",
"QRR",
"SCOR",
"swiss",
"swissqrbill",
"swissqrcode",
"twint",
"Twint",
"TWINT",
"undash"
],
"ignorePaths": [
"node_modules/**",
"lib/**",
"tests/output/**",
"src/shared/qr-code-generator.ts"
]
}
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
lib
src/shared/qr-code-generator.ts
!/.vscode
!/.github
44 changes: 42 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
{
"extends": "@schoero"
}
"extends": "@schoero",
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@typescript-eslint/no-unnecessary-condition": "off"
}
},
{
"files": ["examples/**/*.js", "examples/**/*.ts"],
"rules": {
"no-undef": "off"
}
},
{
"files": ["vite.config.ts", "vite.config.bundle.ts"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"project": ["tsconfig.vite.json"],
"sourceType": "module"
}
},
{
"files": ["examples/**/*.js", "examples/**/*.ts"],
"rules": {
"unicorn/prefer-node-protocol": "off"
}
},
{
"env": {
"browser": true,
"es6": true,
"node": false
},
"files": ["src/browser/**/*.ts"],
"parserOptions": {
"createDefaultProgram": true
}
}
]
}
70 changes: 57 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,62 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
- pull_request
- push

jobs:
build:
lint:
if:
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name !=
github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Run a one-line script
run: |
npm ci
npm test
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: npm
node-version: 20

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint:ci

- name: Typecheck
run: npm run typecheck

- name: Spellcheck
run: npm run spellcheck:ci

test:
if:
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name !=
github.event.pull_request.base.repo.full_name
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: npm
node-version: ${{ matrix.node }}

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

strategy:
fail-fast: true
matrix:
node:
- 18
- 20
- 21
os:
- ubuntu-latest
- windows-latest
- macos-latest
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ node_modules
tests/output
examples/output
lib
.DS_Store
local
.DS_Store
.env
3 changes: 3 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@schoero/markdownlint-config"
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
message="chore(release): v%s"
9 changes: 9 additions & 0 deletions .unwritten.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "../unwritten/schemas/renderer/config.json",
"extends": "@schoero/unwritten-config",
"renderConfig": {
"markdown": {
"sectionSeparator": "<br/>"
}
}
}
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"DavidAnson.vscode-markdownlint"
]
}
41 changes: 41 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"configurations": [
{
"args": ["run", "${relativeFileDirname}/${fileBasenameNoExtension}"],
"autoAttachChildProcesses": true,
"console": "integratedTerminal",
"name": "debug current test file",
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"request": "launch",
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"type": "node"
},
{
"args": ["run", "${relativeFileDirname}/${fileBasenameNoExtension}"],
"autoAttachChildProcesses": true,
"console": "integratedTerminal",
"env": {
"VISUAL": "true"
},
"name": "visually debug current test file",
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"request": "launch",
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"type": "node"
},
{
"args": ["run", "${relativeFileDirname}/${fileBasenameNoExtension}"],
"autoAttachChildProcesses": true,
"console": "integratedTerminal",
"name": "debug current test file with node internals",
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"request": "launch",
"skipFiles": [],
"smartStep": true,
"type": "node"
}
],
"version": "0.2.0"
}
64 changes: 60 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,65 @@
{

// ESLint
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[json]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[json5]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[jsonc]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"eslint.validate": ["javascript", "typescript", "json", "jsonc", "json5", "yaml"],
"editor.formatOnSave": false,

// Prettier
"prettier.enable": false,

// File nesting
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.ts": "${basename}.${extname},${basename}.test.${extname},${basename}.test.snap,${basename}.test-d.${extname}",
"*.js": "${basename}.${extname},${basename}.mjs,${basename}.cjs,${basename}.d.ts"
},

// Hide JSDoc comments
"foldOnOpen.targets": ["AllBlockComments"],

// ES module import
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.importModuleSpecifierEnding": "minimal",
"typescript.preferences.useAliasesForRenames": true,
"typescript.preferences.autoImportFileExcludePatterns": [
"@types/node/test.d.ts"
],

// Markdown
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint",
"editor.formatOnSave": true,
"editor.wordWrapColumn": 119
},

// VSCode
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.markdownlint": true,
"source.organizeImports": false
},
"foldOnOpen.targets": ["AllBlockComments"],
"javascript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.importModuleSpecifierEnding": "js",
}

"editor.rulers": [
119
],

"search.exclude": {
"lib": true
}
}
33 changes: 32 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@

# Change Log

# [v4.0.0](https://github.com/schoero/swissqrbill/compare/v3.2.2...v4.0.0) - 10.11.2023

With version 4, SwissQRBill has been completely reworked. The main goal was to make the API more flexible and reduce the complexity of the library. As a consequence, the API has changed quite significantly. However, migration should be fairly easy.

Please read the [migration guide](docs/migration-v3-to-v4.md) for more information and have a look at the updated [documentation](docs).

* New features
* SwissQRBill can now be attached to any PDFDocument instance from PDFKit.
* New SwissQRCode class to create the standalone Swiss QR Code to attach to an existing PDFKit document.
* New Table class to create a table to attach to an existing PDFKit document.
* It is now possible to change the font of the QR Bill. The allowed fonts are `"Arial"` | `"Frutiger"` | `"Helvetica"` | `"Liberation Sans"`
* Additional options for SVG renderings.

* Breaking changes
* The entrypoints have changed. Please read the [importing documentation](docs/importing.md) for more information.
* SwissQRBill no longer extends PDFKit.
* The table method has been extracted into it's own class.
* Events have been removed from SwissQRBill.
* Properties and options have been renamed.
* Now requires Node.js >= 18.0.0

* Fixes
* Some slight rendering improvements.

* Other improvements
* Better examples. The examples are now automatically hosted on StackBlitz. Everyone can now easily try out the library in the browser without having to install anything.
* Automated documentation. SwissQRBill now uses [unwritten](https://github.com/schoero/unwritten) to automatically generate the documentation. This makes it easier to keep the documentation up to date.
* Automated testing for even more stability.

Thanks to [@danielpanero](https://github.com/danielpanero) and [@skch-17](https://github.com/skch-17) for their contributions.

# [v3.2.3](https://github.com/schoero/swissqrbill/compare/v3.2.2...v3.2.3) - 16.04.2023

* Updated dependencies.
Expand Down Expand Up @@ -174,5 +205,5 @@
# [v1.0.5](https://github.com/schoero/swissqrbill/compare/v1.0.4...v1.0.5) - 03.03.2020

* Fixed french characters.
* Removes new lines in userdata.
* Removes new lines in user data.
* Fixed some layout issues.
2 changes: 2 additions & 0 deletions FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github:
- schoero
Loading

0 comments on commit 4df6c5f

Please sign in to comment.