Commit Graph
14 Commits
Author SHA1 Message Date
libretech 8bdc2c6b7a ci: run the unit tests, and build images only for pull requests and releases
build / test (pull_request) Successful in 7s
build / build (pull_request) Successful in 6m0s
Every push to main published :main and :sha-* images, which nothing pulls.
The libreshop images had grown to 5.8 GB in the registry, on a Gitea host that
is nearly out of space.

- test: npm test for every pull request, every push to main and every release
  tag. It runs in the image's base (Dockerfile FROM, node:22.14.0-alpine), so
  on the runtime's Node, without network and without dependencies. The source
  is piped into the container, because the job container's paths do not exist
  on the Docker host.
- build: after the tests, for a pull request (build only) and for a v* tag
  (build and, with PUBLISH_ENABLED, publish :vX.Y.Z and :latest).

Refs libretech/mp#71
2026-10-08 22:29:00 +02:00
libretech cbcc54bd75 test(checkout): add dependency-free unit tests that pin the checkout defects
npm test runs node:test on the TypeScript sources with Node's type stripping
(Node 22.14 in the image, Node 24 locally), with no dependencies.

Node, unlike tsc, does not resolve extensionless relative imports. TypeScript
5.2 cannot emit .ts import extensions. tests/unit/support therefore registers
a small resolve hook that appends ".ts" for imports from .ts files.

- pricing, paypal-order, log-format: characterization tests of the current
  output.
- The known defects of
  libretech/mp#67 are tests of the correct
  behaviour, marked todo: null, two-line and price-null addresses and
  deliveries, a deleted product, the payment surcharge missing from the
  breakdown, and in the log line circular JSON, the Basic credentials of an
  axios error, and an Error rendered as {}.
- That the breakdown adds up to the amount holds today, including for the
  subtotals closest to a half cent, so that test is a regular one.

Refs libretech/mp#71
2026-10-08 22:15:57 +02:00
libretech 7fd4aeff17 refactor(logging): move the console line format into src/logging/format.ts
The printf template of config/logger.ts becomes formatLogLine, with the same
logic, so it can be unit tested without winston.

No behaviour change.

Refs libretech/mp#71
2026-10-08 22:10:28 +02:00
libretech 9873c184d6 refactor(checkout): move VAT rates, pricing and the PayPal order into pure modules
src/checkout/ holds code without the PayPal SDK or Strapi at runtime, so it can be
unit tested without node_modules:

- vat.ts: vatIncludedDecimal and vatDecimal. config/constants.ts re-exports them
  under the same names and keeps vatDecimalExcluded.
- pricing.ts: calculateTotalProductPrice, unchanged. The product service
  re-exports it, so every importer keeps working.
- paypal-order.ts: the order request createSessionOrThrow builds, in two halves.
  buildPayPalOrderItems (the total guard and the unsent items) still runs
  before the try block, and buildPayPalOrderRequest inside it. Errors and log
  lines stay as they were, for every input. The SDK enums are replaced by their
  string values (CAPTURE, SET_PROVIDED_ADDRESS).

No behaviour change.

Refs libretech/mp#71
2026-10-08 22:10:28 +02:00
libretech 901a3b385f feat(product): price standalone products from the cover alone
build / build (push) Successful in 8m52s
Recovered work in progress from 2026-05. A product-cover can be marked
standalone, and a standalone product (Journaling Booklet) prices as the
cover price without the pattern/pages/ruling lookups, which do not exist
for it. The remaining component lookups are now guarded so a missing
relation yields null instead of calling findOne with undefined.
2026-09-23 22:10:06 +02:00
libretech 7f7cacc448 ci: bump runner-image pin v0.1.0 → v0.2.0 (#4)
build / build (push) Successful in 5m57s
Co-authored-by: Michael Czechowski <mail@dailysh.it>
Co-committed-by: Michael Czechowski <mail@dailysh.it>
2026-05-04 23:46:06 +02:00
libretech fa2a81ecd1 fix(ci): correct image digest separator
build / build (push) Successful in 7m47s
2026-04-30 12:20:33 +02:00
libretech 8e0554572b ci: digest-pin runner-image v0.1.0
build / build (push) Failing after 0s
2026-04-30 12:17:55 +02:00
libretech 3213a5a400 ci: update runner-image path to public/ namespace
build / build (push) Failing after 1s
2026-04-30 11:57:23 +02:00
libretech 5c36ce7dbb chore: update action ref to public/actions
build / build (push) Successful in 6m4s
2026-04-29 22:50:14 +02:00
libretech 9600bc8fd3 chore: slim build.yml to use shared docker-build action (#3)
build / build (push) Successful in 6m43s
2026-04-29 22:08:31 +02:00
libretech defd078e4b feat(cms): white-label email templates and API doc config (#2)
Build and publish / build (push) Successful in 7m11s
## Summary

- Replace all hardcoded muellerprints brand identity in email templates with template variables sourced from env vars
- Inject shop context into both `sendInvoice` and `sendDeliveryNote` template calls in `order.ts`
- Make API documentation title/description env-var driven

## New env vars (all optional with safe defaults)

| Var | Default | Used in |
|-----|---------|---------|
| `SHOP_NAME` | `"Shop"` | Email subject, body, footer |
| `SHOP_CONTACT_NAME` | `""` | Email footer |
| `SHOP_ADDRESS` | `""` | Email footer |
| `SHOP_PHONE` | `""` | Email footer |
| `SHOP_EMAIL` | `ADMIN_EMAIL_ADDRESS` | Email footer |
| `SHOP_LOGO_URL` | `""` | Email header logo |
| `SHOP_SECONDARY_LOGO_URL` | `""` | Email footer logo |
| `API_TITLE` | `"Paperwork API"` | Swagger/OpenAPI title |
| `API_DESCRIPTION` | `"Paperwork API"` | Swagger/OpenAPI description |

## Test plan

- [ ] Set `SHOP_NAME=TestShop` and trigger invoice send → confirm subject and body use `TestShop`
- [ ] Leave `SHOP_NAME` unset → confirm default `"Shop"` appears
- [ ] Set `SHOP_LOGO_URL` → confirm logo renders in email header; unset → confirm no broken `<img>` tag
- [ ] Check Strapi admin `/documentation` with `API_TITLE=MyAPI` env var

Closes #1

Reviewed-on: #2
Co-authored-by: Michael Czechowski <mail@dailysh.it>
Co-committed-by: Michael Czechowski <mail@dailysh.it>
v0.1.1
2026-04-29 20:13:23 +02:00
Michael Czechowski a716f52dd4 ci: kick first build after enabling Gitea Actions
Build and publish / build (push) Successful in 6m35s
v0.1.0
2026-04-29 17:51:05 +02:00
Michael Czechowski 32a296baf2 feat: extract cms from mp/cms — initial libreshop/cms
Build and publish / build (push) Failing after 17s
Source moved verbatim from mp/cms/ on 2026-04-29; mp was the first
concrete adapter consuming the libreshop toolkit. Builds and publishes
git.librete.ch/libreshop/cms on every main / v* push via the standard
.gitea/workflows/build.yml shared across libreshop components.
2026-04-29 17:48:30 +02:00