Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ permissions:

env:
FORCE_COLOR: 2
NODE: 24 # The Node.js version to publish from

jobs:
publish:
Expand All @@ -26,14 +25,11 @@ jobs:
persist-credentials: false

- name: Install pnpm and Node.js
uses: pnpm/setup@c9883cc79df532ad1a7b81bf9ab944ceb090d65c # v2.0.0
uses: pnpm/setup@v3
with:
version: 12
runtime: node@${{ env.NODE }}
cache: true

- name: Install dependencies
run: pnpm install
require-lockfile: true

- name: Lint
run: pnpm lint
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:

env:
FORCE_COLOR: 2
NODE: 24 # The Node.js version to run lint on

permissions:
contents: read
Expand All @@ -27,14 +26,11 @@ jobs:
persist-credentials: false

- name: Install pnpm and Node.js
uses: pnpm/setup@c9883cc79df532ad1a7b81bf9ab944ceb090d65c # v2.0.0
uses: pnpm/setup@v3
with:
version: 12
runtime: node@${{ env.NODE }}
cache: true

- name: Install dependencies
run: pnpm install
require-lockfile: true

- name: Run lint
run: pnpm lint
8 changes: 2 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

env:
FORCE_COLOR: 2
NODE: 24 # The Node.js version to publish from

permissions:
contents: write
Expand All @@ -28,14 +27,11 @@ jobs:
persist-credentials: false

- name: Install pnpm and Node.js
uses: pnpm/setup@c9883cc79df532ad1a7b81bf9ab944ceb090d65c # v2.0.0
uses: pnpm/setup@v3
with:
version: 12
runtime: node@${{ env.NODE }}
cache: true

- name: Install dependencies
run: pnpm install
require-lockfile: true

- name: Verify version matches tag
run: |
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,16 @@ jobs:
persist-credentials: false

- name: Install pnpm and Node.js
uses: pnpm/setup@c9883cc79df532ad1a7b81bf9ab944ceb090d65c # v2.0.0
uses: pnpm/setup@v3
with:
version: 12
runtime: node@24
cache: true
require-lockfile: true

- name: Install dependencies
run: pnpm install

- name: Reject local link overrides (Kernregel)
- name: Reject local link overrides
run: |
if grep -R "link:" pnpm-workspace.yaml pnpm-lock.yaml 2>/dev/null; then
echo "::error::pnpm-workspace.yaml/pnpm-lock.yaml contain a local link: override. Run ./set-dev.sh false before committing." >&2
echo "::error::pnpm-workspace.yaml/pnpm-lock.yaml contain a local link: override." >&2
exit 1
fi
echo "No link: override found — lockfile resolves from the registry."
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ permissions:

env:
FORCE_COLOR: 2
NODE: 24 # The Node.js version to publish from

jobs:
publish:
Expand All @@ -26,14 +25,11 @@ jobs:
persist-credentials: false

- name: Install pnpm and Node.js
uses: pnpm/setup@c9883cc79df532ad1a7b81bf9ab944ceb090d65c # v2.0.0
uses: pnpm/setup@v3
with:
version: 12
runtime: node@${{ env.NODE }}
cache: true

- name: Install dependencies
run: pnpm install
require-lockfile: true

- name: Lint
run: pnpm lint
Expand Down
10 changes: 4 additions & 6 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env sh
# Kernregel (AGENTS.md): niemals einen lokalen link:-Override committen.
# Lokaler Dev-Zustand: ./set-dev.sh true — vor dem Commit: ./set-dev.sh false.
# Dieser Guard prüft den Staging-Bereich, nicht den Arbeitsbaum.
# Never commit a local link: override (see AGENTS.md).
# This guard inspects the staging area, not the working tree.

files="pnpm-workspace.yaml pnpm-lock.yaml"
offenders=""
Expand All @@ -13,8 +12,7 @@ for f in $files; do
done

if [ -n "$offenders" ]; then
echo "✗ Commit abgebrochen: link:-Override in:$offenders" >&2
echo " (Kernregel, AGENTS.md — verunreinigt CI und die Registry-Lockfile)" >&2
echo " → ./set-dev.sh false ausführen, erneut adden und committen." >&2
echo "✗ Commit aborted: link: override in:$offenders" >&2
echo " Remove the override, stage the files again and commit." >&2
exit 1
fi
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
41 changes: 30 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@ 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).

## 3.2.0 — Sprite filenames, vinyl removal and dead options

### Changed

* The `defs`, `symbol` and `stack` modes now write their sprites to
`sprite.defs.svg`, `sprite.symbol.svg` and `sprite.stack.svg` by default,
matching the library defaults. Previously the CLI overrode them with the
outdated `sprite.css.svg`.
* `vinyl` is completely removed from the CLI: the dependency in `package.json`,
the import and every type reference are gone. Compiled files are detected by
their `path` property since 1.0.1, so the package was only still declared.
* Requires `@svgforge/svgforge` 3.2.0.

### Removed

* Dropped the `--shape-align` / `-a` option. It had no effect since the «css»
sprite mode was removed from the library.
* Dropped the `--svg-precision` option. It was parsed and forwarded but never
read by the library.

### Fixed

* `docs/command-line.md` now reflects the actual `--help` output: Vento instead
of Mustache, `.vto` template defaults, the `--quiet`, `--view-render-css`
and `--view-render-*` options, and the current sprite filenames.
* `--help` shows the template defaults as short paths (`tmpl/…`) instead of the
absolute paths they resolve to at runtime.

## 3.1.0 — Clear skip reporting and resvg status

### Added
Expand Down Expand Up @@ -102,13 +130,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
svgforge library (`svgforge/lib/svg-sprite/utils/index.js`), removing
the last lodash dependency

### Changed: depend on svgforge 1.1.0 and fix the GitHub release step
### Changed: depend on svgforge 1.1.0

* Bump the `svgforge` dependency to `^1.1.0` (view-mode `.dims` stylesheet,
example-document overhaul and invalid-XML fix)
* Add `GH_TOKEN` to the release workflow so `gh release create` can publish
the GitHub release (it previously failed for svgforge with
"select a GitHub user or use GH_TOKEN")

### Changed: re-add the `view` mode dimension stylesheet

Expand All @@ -128,7 +153,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
page instead of the online configurator
* Mark the `defs` sprite mode as legacy in the modes table

## 1.0.1 — Drop remaining lodash/async dependencies
## 1.0.1 — Depend on svgforge 1.0.1

* Bump the `svgforge` dependency to `^1.0.1` (native promise-based helpers,
`deepMerge` and `escapeHtml` utilities, no `async`/`lodash` dependencies)
Expand All @@ -150,16 +175,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Refactor: ES6 classes, JSDoc and xo-default linting

* Convert the CLI to modern ES6 with JSDoc type annotations
* Strip all `off` rules from `xo.config.js`; fixed lint findings in code with
justified line/file-level disables (`xo .` → 0 errors, 0 warnings)
* Add `u` flags to all regex literals (`require-unicode-regexp`)
* Rename the binary and package from `svg-sprite-cli`/`svg-sprite` to
`svgforge-cli`/`svgforge`, including all user-facing config descriptions
* Bump engines to Node >= 22 and modernize package metadata
* Resolve the local `svgforge` workspace dependency via a gitignored
`pnpm-workspace.yaml` override (`svgforge: link:../svgforge`) so the
committed `package.json` stays publication-safe (`svgforge: 1.0.0`)
* Add `/pnpm-workspace.yaml` to `.gitignore` and regenerate the lockfile
* Replace the `glob` package with the native `fs.globSync` API and drop `glob`
from the dependencies; `engines.node` stays `>= 22` (required for the glob
API introduced in Node 22)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ This results in shape IDs like `path--to--source` (assuming the default shape ID

## Development

Requirements: Node.js >= 18, [pnpm](https://pnpm.io).
Requirements: Node.js >= 24, [pnpm](https://pnpm.io).

```bash
pnpm install
Expand Down
16 changes: 3 additions & 13 deletions bin/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ shape:
alias: m
map: shape.meta

align:
description: Path to YAML file with alignment information
alias: a
map: shape.align

dest:
description: Path to output directory for intermediate SVG files
alias: ims
Expand Down Expand Up @@ -135,11 +130,6 @@ svg:
description: Custom root attributes for the outermost <svg> element (external JSON file)
map: svg.rootAttributes

precision:
description: Floating point precision for CSS positioning values
default: -1
map: svg.precision

view:
description: Activates the «view» mode
default: false
Expand Down Expand Up @@ -222,7 +212,7 @@ defs:

sprite:
description: Sprite path and filename (relative to --defs-dest)
default: svg/sprite.css.svg
default: svg/sprite.defs.svg
alias: ds
map: mode.defs.sprite

Expand Down Expand Up @@ -298,7 +288,7 @@ symbol:

sprite:
description: Sprite path and filename (relative to --symbol-dest)
default: svg/sprite.css.svg
default: svg/sprite.symbol.svg
alias: ss
map: mode.symbol.sprite

Expand Down Expand Up @@ -374,7 +364,7 @@ stack:

sprite:
description: Sprite path and filename (relative to --stack-dest)
default: svg/sprite.css.svg
default: svg/sprite.stack.svg
alias: Ss
map: mode.stack.sprite

Expand Down
16 changes: 12 additions & 4 deletions bin/svgforge.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,17 @@ const RENDER_TYPES = ['css'];
*/

/**
Recursively nested map of vinyl files
A compiled output file (sprite, stylesheet or example document)

@typedef {{[key: string]: File | FileMap}} FileMap
@typedef {object} FileLike
@property {string} path Absolute output path
@property {Buffer|string} contents File contents
*/

/**
Recursively nested map of file objects

@typedef {{[key: string]: FileLike | FileMap}} FileMap
*/

/**
Expand Down Expand Up @@ -146,7 +154,7 @@ function addOption(parser, name, option) {
if ('default' in option) {
const templated = name.endsWith('-template');
const defaultValue = templated ? resolveSvgForgePath(option.default) : option.default;
parser = parser.default(alias, defaultValue);
parser = parser.default(alias, defaultValue, templated ? option.default : undefined);

if (option.default === true || option.default === false) {
parser = parser.boolean(name);
Expand Down Expand Up @@ -195,7 +203,7 @@ function addConfigMap(store, keyPath, value) {
/**
Recursively write files to disk

@param {FileMap} files Nested map of vinyl files
@param {FileMap} files Nested map of file objects
@returns {number} Number of written files
*/
function writeFiles(files) {
Expand Down
Loading
Loading