From 71fe41c84b2b37451524e15934dec53669e3d469 Mon Sep 17 00:00:00 2001 From: John Doe <265342703+SpotlightOn@users.noreply.github.com> Date: Thu, 8 Oct 2026 14:56:20 +0200 Subject: [PATCH 1/6] chore: depend on svgforge 3.0.0 stable --- package.json | 2 +- pnpm-workspace.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2edb821..6cb0867 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "test:coverage": "mkdir -p coverage && node --test --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info" }, "dependencies": { - "@svgforge/svgforge": "3.0.0-beta.1", + "@svgforge/svgforge": "^3.0.0", "js-yaml": "^5.4.3", "vinyl": "^3.0.1", "yargs": "^18.2.0" diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index dd56849..b660724 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,4 @@ allowBuilds: unrs-resolver: true minimumReleaseAgeExclude: - - '@svgforge/svgforge@3.0.0-beta.1 || 3.0.0' + - '@svgforge/svgforge@3.0.0' From 69d9f39181607f2d26cf8de8c48035232170ac59 Mon Sep 17 00:00:00 2001 From: John Doe <265342703+SpotlightOn@users.noreply.github.com> Date: Thu, 8 Oct 2026 14:56:20 +0200 Subject: [PATCH 2/6] docs: fold changelog into 3.0.0 and note dependency updates --- CHANGELOG.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82d3ee9..9ad0243 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,21 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased - -### Added - -* A compact **run summary** is printed to `stderr` after every run: the number - of processed shapes (along with excluded input files), the active sprite - modes with their enabled options (example, inline, stylesheet rendering), - the number of written files, the elapsed time and the shape concurrency. - -### Changed - -* The progress bar line is capped at **80 characters** and at the current - terminal width. The width is re-read on every redraw, so terminals that are - resized while a run is in progress (e.g. xterm) are taken into account. - ## 3.0.0 — Vento-based sprite generation ### Added @@ -31,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 the final state instead of one line per processed shape, so CI logs stay clean. +* A compact **run summary** is printed to `stderr` after every run: the number + of processed shapes (along with excluded input files), the active sprite + modes with their enabled options (example, inline, stylesheet rendering), + the number of written files, the elapsed time and the shape concurrency. + ### Changed (breaking) * The underlying `@svgforge/svgforge` library was upgraded to **3.0.0**, which @@ -39,8 +29,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 templating (see the [svgforge changelog](https://github.com/svgforge/svgforge/blob/main/CHANGELOG.md) for details — custom templates and `variables` functions may need adjustment). +### Changed + +* Dependencies updated: `@svgforge/svgforge` is now required as `^3.0.0` + (stable release instead of the beta pin), `js-yaml` as `^5.4.3` and `yargs` + as `^18.2.0`. +* The progress bar line is capped at **80 characters** and at the current + terminal width. The width is re-read on every redraw, so terminals that are + resized while a run is in progress (e.g. xterm) are taken into account. + ### Fixed +* The published npm package ships the new `lib/` directory (progress and + report modules); the `files` list previously contained only `bin/`. * The CLI template defaults were updated to the new Vento suffix (`.vto`): `--dcss`, `-d` and the example rendering previously failed with a missing `tmpl/common/sprite.css` when used against svgforge 3.0.0. From e1163fb87b56aa1db6f38f216a74e6bdc661ab86 Mon Sep 17 00:00:00 2001 From: John Doe <265342703+SpotlightOn@users.noreply.github.com> Date: Fri, 9 Oct 2026 17:48:03 +0200 Subject: [PATCH 3/6] fix: add --quiet and make the progress bar CI-aware Treat a CI environment as non-interactive so the progress bar prints only the final summary line instead of live redraws. The new `--quiet` / `-q` option suppresses all non-error output. --- CHANGELOG.md | 63 +++++++++++++++++++------------------------------ bin/config.yaml | 5 ++++ bin/svgforge.js | 2 +- lib/progress.js | 10 ++++++-- 4 files changed, 38 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ad0243..53345bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,52 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 3.0.0 — Vento-based sprite generation -### Added - -* An animated **progress bar** is shown on `stderr` while shapes are being - processed when running on an interactive terminal. It is fed by the - [`progress` event of the svgforge spriter](https://github.com/svgforge/svgforge/blob/main/docs/api.md#spriter-events); - non-TTY runs (CI, pipes, log files) print only a single summary line with - the final state instead of one line per processed shape, so CI logs stay - clean. - -* A compact **run summary** is printed to `stderr` after every run: the number - of processed shapes (along with excluded input files), the active sprite - modes with their enabled options (example, inline, stylesheet rendering), - the number of written files, the elapsed time and the shape concurrency. - ### Changed (breaking) -* The underlying `@svgforge/svgforge` library was upgraded to **3.0.0**, which - replaces the Mustache templating engine with [Vento](https://vento.js.org). - Examples and CSS resources generated by the CLI now use the new Vento - templating (see the [svgforge changelog](https://github.com/svgforge/svgforge/blob/main/CHANGELOG.md) - for details — custom templates and `variables` functions may need adjustment). +* Upgraded to `@svgforge/svgforge` 3.0.0, which replaces Mustache with + [Vento](https://vento.js.org). Examples and stylesheet resources now use + Vento templates; custom templates and `variables` functions may need + adjustment (see the + [svgforge changelog](https://github.com/svgforge/svgforge/blob/main/CHANGELOG.md)). -### Changed +### Added -* Dependencies updated: `@svgforge/svgforge` is now required as `^3.0.0` - (stable release instead of the beta pin), `js-yaml` as `^5.4.3` and `yargs` - as `^18.2.0`. -* The progress bar line is capped at **80 characters** and at the current - terminal width. The width is re-read on every redraw, so terminals that are - resized while a run is in progress (e.g. xterm) are taken into account. +* A progress bar on `stderr` while shapes are processed (from the spriter's + `progress` event), capped at 80 characters and the current terminal width. + Non-TTY runs (CI, pipes) only print the final summary line. +* A compact run summary after each run: processed shapes (and excluded files), + active modes with their options, number of written files, elapsed time and + concurrency. +* `--quiet` / `-q` suppresses all non-error output. ### Fixed -* The published npm package ships the new `lib/` directory (progress and - report modules); the `files` list previously contained only `bin/`. -* The CLI template defaults were updated to the new Vento suffix (`.vto`): - `--dcss`, `-d` and the example rendering previously failed with a missing - `tmpl/common/sprite.css` when used against svgforge 3.0.0. -* The `./` base directory marker works again: the documentation promises that a - literal `./` segment in an input glob (e.g. `assets/./**/*.svg`) marks the - base directory from which shape ID traversal starts, yielding IDs like - `path--to--source`. Since the switch to `fs.globSync` (and glob >= 9 in - general), the `./` was stripped from the glob results, so the base directory - name leaked into the shape IDs (`assets--path--to--source`). The marker is - now detected on the original pattern instead and the marked base directory - is removed from the shape IDs. +* The published package ships the `lib/` directory (progress and report + modules); `files` previously listed only `bin/`. +* CLI template defaults use the new `.vto` suffix — `--dcss`, `-d` and example + rendering no longer fail against svgforge 3.0.0. +* The `./` base directory marker in an input glob works again: since glob >= 9 + strips `./`, the base directory name leaked into shape IDs. The marker is now + detected on the original pattern and removed from the shape IDs. + +### Changed + +* Dependencies: `js-yaml` ^5.4.3 and `yargs` ^18.2.0. ## 2.0.1 — Do not re-ingest the output destination diff --git a/bin/config.yaml b/bin/config.yaml index 82799a5..5674849 100644 --- a/bin/config.yaml +++ b/bin/config.yaml @@ -12,6 +12,11 @@ log: description: Logging verbosity ("info", "verbose" or "debug") alias: l map: log +quiet: + description: Suppress all output except errors + alias: q + default: false + map: quiet shape: id: diff --git a/bin/svgforge.js b/bin/svgforge.js index e20f54c..1dbd0d2 100755 --- a/bin/svgforge.js +++ b/bin/svgforge.js @@ -552,7 +552,7 @@ async function main() { // before any progress events fire. The total is resolved from the glob // below before the add loop starts, because the queue processes shapes // while they are still being added. - const progressBar = createProgressBar(spriter); + const progressBar = createProgressBar(spriter, config.quiet); // Glob (>= 9, incl. fs.globSync) returns paths without the "./" segment, so // the base directory marker has to be detected on the original pattern. A diff --git a/lib/progress.js b/lib/progress.js index 3805c6a..a039ac4 100644 --- a/lib/progress.js +++ b/lib/progress.js @@ -27,11 +27,12 @@ const MAX_LINE_WIDTH = 80; in particular) are resized while a run is in progress. @param {object} spriter Spriter instance (listens to its `progress` events) + @param {boolean} [isQuiet] Suppress all progress output @returns {{refreshTotal: (total: number) => void, finish: () => void}} Progress bar controls */ -export function createProgressBar(spriter) { +export function createProgressBar(spriter, isQuiet = false) { const stream = process.stderr; - const tty = stream.isTTY; + const tty = stream.isTTY && !process.env.CI && !isQuiet; let lastUpdate = 0; let total = 0; let processed = 0; @@ -76,6 +77,11 @@ export function createProgressBar(spriter) { }, finish() { spriter.off('progress', onProgress); + + if (isQuiet) { + return; + } + if (tty) { stream.write('\n'); } else if (total > 0) { From fac415ec7df3ac37a7022776337e56d0918632d8 Mon Sep 17 00:00:00 2001 From: John Doe <265342703+SpotlightOn@users.noreply.github.com> Date: Fri, 9 Oct 2026 17:48:04 +0200 Subject: [PATCH 4/6] chore: resolve svgforge 3.0.0 from the registry in the lockfile --- pnpm-lock.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4da9e98..14b2dc6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@svgforge/svgforge': - specifier: 3.0.0-beta.1 - version: 3.0.0-beta.1 + specifier: ^3.0.0 + version: 3.0.0 js-yaml: specifier: ^5.4.3 version: 5.4.3 @@ -307,8 +307,8 @@ packages: peerDependencies: eslint: ^9.0.0 || ^10.0.0 - '@svgforge/svgforge@3.0.0-beta.1': - resolution: {integrity: sha512-Iaa/sTfvV5NCJq5qHvLHwxoNiw8icthhFFyAWJFRXududICwu10NZiyR1PYOuF3yP7JrRZzr70/7i8CGQxfKmw==} + '@svgforge/svgforge@3.0.0': + resolution: {integrity: sha512-WjtHoZ4xEHXL5VpNA0hCRAH89WA58sKFeJTiN3I5TljQ5TCw1Rj3nAjR0elOJqyAp/RLVmg6rEY9f9rBhWLoZg==} engines: {node: '>=24'} '@tybys/wasm-util@0.10.4': @@ -2169,7 +2169,7 @@ snapshots: estraverse: 5.3.0 picomatch: 4.0.7 - '@svgforge/svgforge@3.0.0-beta.1': + '@svgforge/svgforge@3.0.0': dependencies: '@resvg/resvg-js': 2.6.2 '@xmldom/xmldom': 0.9.12 From 3ca4b32bd551999021286aa06fcb327a5c1ecf0f Mon Sep 17 00:00:00 2001 From: John Doe <265342703+SpotlightOn@users.noreply.github.com> Date: Fri, 9 Oct 2026 17:58:30 +0200 Subject: [PATCH 5/6] test: keep the progress tests independent of the CI environment The progress bar treats a CI environment as non-interactive. The tests simulated a terminal via stderr.isTTY only, so they failed on GitHub Actions where CI is set. Clear CI in the tests and cover the CI branch explicitly. --- test/progress.test.js | 61 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/test/progress.test.js b/test/progress.test.js index d70645b..df73120 100644 --- a/test/progress.test.js +++ b/test/progress.test.js @@ -1,6 +1,11 @@ import assert from 'node:assert/strict'; import process from 'node:process'; -import {describe, it} from 'node:test'; +import { + afterEach, + beforeEach, + describe, + it, +} from 'node:test'; import {setTimeout as delay} from 'node:timers/promises'; import {createProgressBar} from '../lib/progress.js'; @@ -45,6 +50,23 @@ const createSpriterStub = listeners => ({ }); describe('createProgressBar', () => { + // The progress bar treats a CI environment as non-interactive. These tests + // simulate a real terminal, so keep CI off unless a test sets it explicitly. + let originalCI; + + beforeEach(() => { + originalCI = process.env.CI; + delete process.env.CI; + }); + + afterEach(() => { + if (originalCI === undefined) { + delete process.env.CI; + } else { + process.env.CI = originalCI; + } + }); + it('writes an animated progress bar on interactive terminals', () => { const listeners = {}; const spriter = createSpriterStub(listeners); @@ -76,6 +98,43 @@ describe('createProgressBar', () => { assert.ok(rendered.endsWith('\n')); }); + describe('in a CI environment', () => { + beforeEach(() => { + process.env.CI = 'true'; + }); + + it('does not redraw on a TTY', () => { + const listeners = {}; + const spriter = createSpriterStub(listeners); + const chunks = []; + const originalIsTTY = process.stderr.isTTY; + const originalWrite = process.stderr.write; + + process.stderr.isTTY = true; + process.stderr.write = chunk => { + chunks.push(String(chunk)); + return true; + }; + + const bar = createProgressBar(spriter); + bar.refreshTotal(4); + listeners.progress({processed: 1, total: 4}); + listeners.progress({processed: 4, total: 4}); + + assert.equal(chunks.length, 0, 'no output before finish()'); + + bar.finish(); + + process.stderr.isTTY = originalIsTTY; + process.stderr.write = originalWrite; + + const rendered = chunks.join(''); + assert.equal(rendered.includes('\r'), false, 'no carriage-return redraws in CI'); + assert.equal(rendered.split('\n').filter(Boolean).length, 1, 'exactly one summary line'); + assert.match(rendered, /4\/4 \(100\.0%\)\n/u); + }); + }); + it('writes nothing while running when not on a TTY', () => { const listeners = {}; const spriter = createSpriterStub(listeners); From 7a999d0d6fa2ce79477efe1ee5b3f6185925ca8b Mon Sep 17 00:00:00 2001 From: John Doe <265342703+SpotlightOn@users.noreply.github.com> Date: Fri, 9 Oct 2026 18:49:14 +0200 Subject: [PATCH 6/6] ci: let the Socket scan comment on pull requests The GITHUB_TOKEN was limited to contents: read, so posting the Socket report as a pull request comment failed with HTTP 403. Grant issues and pull-requests write and align actions/setup-python with the library repo. --- .github/workflows/socket.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/socket.yml b/.github/workflows/socket.yml index 3bf771a..98f6b8f 100644 --- a/.github/workflows/socket.yml +++ b/.github/workflows/socket.yml @@ -19,6 +19,8 @@ concurrency: permissions: contents: read + issues: write + pull-requests: write jobs: socket-security: @@ -33,7 +35,7 @@ jobs: fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v7 with: python-version: '3.12'