npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

assembly-diagrams

v0.0.1

Published

Generate Assembly Diagram SVGs

Downloads

2,596

Readme

Assembly Diagrams

An Assembly Diagram is a visualisation of a Component Assembly, and a Component Assembly is a set of components that are connected (stacked) in a particular way.

Assembly Diagrams are useful for understanding and designing full-stack automated test suites that can run in milliseconds:

Watch the video

Assembly Diagrams typically visualise three kinds of components:

  • #FFB000 Test components
  • #DC267F Infrastructure components
  • #648FFF Production components

You can think of each component as a "lego brick" with three characteristics:

  • The top studs of the brick represent the component's contract (the interface it implements)
  • The brick itself is how the component fulfils the contract (its implementation)
  • The bottom anti-studs is the contract the component needs (its dependency)

There can be multiple implementations of the same interface. This makes it possible to create a wide range of Component Assemblies. If you've ever played with lego you know this.

| Full Stack | DOM-HTTP-Domain | DOM-Domain | HTTP-Domain | Domain | | ---------------------------------------------| --------------------------------------- | ---------------------------------- | ----------------------------------- | ----------------------------------- | | test | test | test | test | test |

Each of these assemblies make tradeoffs between three important aspects of automated tests:

  • Speed
  • Confidence (how much is tested)
  • Diagnostic precision (how easy it is to understand why a test fails)

The general idea is to have more of the fast tests and fewer of the slow ones - as few as you can get away with.

The Dom-Domain assembly exercises most of the functional parts of the stack, yet they typically run in a few milliseconds. This is because there is no I/O in the assembly.

These tests obviously don't provide any confidence about components that are not present. The Full Stack assembly connects all the components similarly to the production environment. Tests in this assembly can be run occasionally, for maximum confidence.

The extremely fast acceptance tests enable high productivity, as developers can get near-instant feedback on their changes. The slower, really thorough ones have a different purpose - to verify that everything works before a commit, and for more thorough CI tests.

Conventions

Components are grouped in the follow categories:

  • test code - green
  • infrastructure - pink
  • production code - light blue

This makes it easier to distinguish between different types of components. It also makes it easier to quickly spot what's essential about an assembly:

  • How fast is it? (less infrastructure means faster tests)
  • How much confidence does it give? (less production code means less confidence)
  • How easy is it to diagnose why a test failed? (less production code and infastructure means easier) (fast/slow, with/without infrastructure).

Generate your own assembly diagrams

Write an assembly script by copying and modifying one of the scripts in the assemblies directory. You also need Node.js installed. Then run:

npx assembly-diagrams some-assembly.txt > some-assembly.svg

For more information:

npx assembly-diagrams --help

Build PNGs from SVGs

If you need to convert the SVG file to a PNG file, you can use cairosvg.

brew install python3
pip3 install cairosvg lxml tinycss cssselect
cairosvg --scale 0.4 assembly.svg -o assembly.png

The Makefile contains an example of how to automate generation of SVG and PNG files

Release process

npm version major|minor|patch
npm publish
git push && git push --tags