feat: modernize netlistsvg to v2.0.0-alpha.1#153
Closed
paulgeorge wants to merge 24 commits into
Closed
Conversation
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#137.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete modernization of netlistsvg, bringing the unmaintained upstream (last commit Jan 2024) up to current standards.
Upstream PRs merged
--layoutoption returning undefinedDependencies
package-lock.json(fixes upstream could you please commit and maintain a package lock file? #136)CI & Build
Test suite
Documentation
Test plan
npm ciinstalls cleanly (390 packages, 0 vulnerabilities)npx tsccompiles without errorsnpm run build:bundleproduces valid esbuild bundlenpm test— 83/83 tests pass across 12 suitesnpm audit— 0 vulnerabilities--layoutflag works end-to-end