Skip to content

feat: modernize netlistsvg to v2.0.0-alpha.1#153

Closed
paulgeorge wants to merge 24 commits into
nturley:masterfrom
paulgeorge:modernize-v2
Closed

feat: modernize netlistsvg to v2.0.0-alpha.1#153
paulgeorge wants to merge 24 commits into
nturley:masterfrom
paulgeorge:modernize-v2

Conversation

@paulgeorge

Copy link
Copy Markdown

Summary

Complete modernization of netlistsvg, bringing the unmaintained upstream (last commit Jan 2024) up to current standards.

Upstream PRs merged

Dependencies

  • Removed lodash entirely — replaced with native JS/TS equivalents
  • Upgraded TypeScript 3.3 → 5.7 with strict mode
  • Replaced deprecated tslint with eslint + typescript-eslint
  • Updated all deps: elkjs 0.9.3, fs-extra 11, jest 29, ajv 8.17, etc.
  • Added package-lock.json (fixes upstream could you please commit and maintain a package lock file? #136)
  • 0 npm audit vulnerabilities

CI & Build

  • Replaced defunct Travis CI + AppVeyor with GitHub Actions (Node 20/22 matrix)
  • Replaced browserify with esbuild for browser bundling
  • Added Dependabot for automated dependency updates

Test suite

  • Expanded from 9 tests / 3 suites83 tests / 12 suites
  • 94% line coverage (87% branch, 96% function)
  • New tests: Port, Skin, YosysModel, elkGraph, index, CLI e2e, examples regression, edge cases, SVG snapshots

Documentation

  • Updated README for fork (badges, install instructions, Node 20+ requirement)
  • Added CLAUDE.md, CONTRIBUTING.md
  • PR review report for all upstream PRs
  • Hierarchical netlists roadmap document (future feature from PR WIP: Hierarchical netlists #92)

Test plan

  • npm ci installs cleanly (390 packages, 0 vulnerabilities)
  • npx tsc compiles without errors
  • npm run build:bundle produces valid esbuild bundle
  • npm test — 83/83 tests pass across 12 suites
  • npm audit — 0 vulnerabilities
  • CLI produces valid SVG output
  • --layout flag works end-to-end

Your Name added 24 commits March 16, 2026 14:23
Cherry-pick of upstream PR nturley#151. When pre-computed ELK layout data
was provided, drawModule result was discarded instead of being
resolved through the promise chain.
Cherry-pick of upstream PR nturley#121. Converts recursive gather() to
iterative loop to prevent stack overflow on large netlists.
Cherry-pick of upstream PR nturley#75. Adds a value label below the
reference label on the generic analog component template.
Point repository, bugs, and homepage URLs to paulgeorge/netlistsvg.
Add CONTRIBUTING.md with development setup and PR guidelines.
Documents PR nturley#92's approach, why it couldn't be merged directly,
and outlines a plan for implementing the feature on the modernized
codebase.
Replace all lodash utility calls with native JavaScript/TypeScript:
_.map/_.forEach -> Object.entries().map/for...of
_.filter -> Array.filter
_.flatMap -> Array.flatMap
_.find -> Array.find
_.findIndex -> Array.findIndex
_.includes -> Array.includes
_.keys -> Object.keys
_.max -> Math.max
_.first/_.last -> array[0]/array[array.length-1]
_.minBy -> Array.reduce
_.isEqual -> direct property comparison
_.mapValues -> Object.fromEntries/Object.entries
Update tsconfig.json: target ES2020, module commonjs, strict: true,
esModuleInterop, skipLibCheck, resolveJsonModule, declaration.
Fix all strict mode type errors across the codebase.
Remove tslint.json, add .eslintrc.yml with @typescript-eslint/parser
and @typescript-eslint/eslint-plugin. Update lint script in package.json.
Add GitHub Actions CI workflow with Node 20/22 matrix testing.
Add Dependabot config for weekly npm and Actions updates.
Remove defunct Travis CI and AppVeyor configurations.
Add esbuild for browser bundle generation with a custom plugin to
inline fs.readFileSync calls (replacing brfs transform).
Update package.json scripts: add build, build:bundle, build:demo.
Remove browserify, browserify-shim, and brfs config from package.json.
Downgrade pre-existing lint errors to warnings in eslint config.
Add maintained fork notice, GitHub Actions CI badge, Node 20+
requirement, updated install instructions pointing to this fork,
relative image paths, and updated status section.
Update jest.config.js with coverage collection settings targeting
>80% line coverage. Add test:coverage script to package.json and
simplify the test script to run jest directly.
Cover Port key/value operations and constant finding, Skin loading
and template lookup, YosysModel interfaces and helpers, ELK graph
construction, and main render/dumpLayout API.
CLI tests verify end-to-end rendering via bin/netlistsvg.js.
Example tests replace test-all.js with Jest-based regression
tests for all 6 digital and 5 analog example netlists.
Edge case tests cover malformed JSON, empty netlists, invalid skins,
and FlatModule utility functions. Snapshot tests capture SVG output
for mux4, up3down5, hyperedges, and resistor_divider to prevent
visual regressions.
Fixes upstream issue nturley#136 - package-lock.json should be committed
for reproducible builds. Also ignores coverage/ output directory.
@paulgeorge paulgeorge closed this Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant