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

@arinoto/vis

v1.3.2

Published

@anthill's architecture visualiser

Downloads

10

Readme

Vis

Generate solution diagrams from code.

In essence, the tools detect variables and new expressions of certain types and translate that in a relationship graph. E.g. given

interface IArchMarker {}

class Foo implements IArchMarker {}
class Bar implements IArchMarker {
    constructor(private rel: Foo) {}
}

const fooNode = new Foo();
const barNode = new Bar(fooNode);

after executing vis --acceptTypes IArchMarker

will produce something akin to

┌───────────────────┐          ┌──────────────────┐
│                   │          │                  │
│   barNode: Bar    ├──────────►   fooNode: Foo   │
│                   │          │                  │
└───────────────────┘          └──────────────────┘

There are two tools available:

Vis

The all-in-one tool to generate an SVG from a codebase.

vis - Generate solution diagrams from code

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --acceptTypes      List of regexes of base classes/types to include.
                        [array] [default: ["Archetype",".*TerraformResource.*"]]
  --includeFiles     List of regexes of files to include. Defaults to accept
                     any.                                  [array] [default: []]
  --excludeFiles     List of regexes of files to exclude.
                                               [array] [default: ["maxim.*.ts"]]
  --verbose          Print debugging info onto stderr [boolean] [default: false]
  --tsConfigPath     Path of the tsconfig.json
                                           [string] [default: "./tsconfig.json"]
  --clusterAllTypes  When specified will visually cluster all nodes of the same
                     type                             [boolean] [default: false]
  --clusterTypes     List of regexes of base classes/types to cluster together.
                     Defaults to `Api`                [array] [default: ["Api"]]
  --clusterNone      Don't cluster together any types. When present, wins over
                     any other clustering options.    [boolean] [default: false]

Code2graph

Prints a JSON of the graph to the stdout. Here's an example from @arnoto/hello-world.architecture, using

export const helloFunc = new Func<void, { message: string }>({
    code: () => ({ message: 'hello world' })
});

export const helloApi = new Api<void, { message: string }>({
    target: helloFunc
});
❯ ./node_modules/.bin/code2graph
[
  {
    "name": "helloFunc",
    "class": "Func",
    "refs": [
      "helloApi"
    ]
  },
  {
    "name": "helloApi",
    "class": "Api",
    "refs": []
  }
]
code2graph - parse a typescript project and print its architectural graph in
JSON

Options:
  --help          Show help                                            [boolean]
  --version       Show version number                                  [boolean]
  --acceptTypes   List of regexes of base classes/types to include.
                        [array] [default: ["Archetype",".*TerraformResource.*"]]
  --includeFiles  List of regexes of files to include. Defaults to accept any.
                                                           [array] [default: []]
  --excludeFiles  List of regexes of files to exclude.
                                               [array] [default: ["maxim.*.ts"]]
  --verbose       Print debugging info onto stderr    [boolean] [default: false]
  --tsConfigPath  Path of the tsconfig.json[string] [default: "./tsconfig.json"]

On ts project references

By default, typescript will use d.ts files for cross-project references. If, on the other hand, the library's package.json specifies types field to point to src/main.ts, then the actual initialisation is found and references are detected correctly.

E.g. good:

export const helloFunc = new Func<void, { message: string }>({
    code: () => ({ message: 'hello world' })
});

export const helloApi = new Api<void, { message: string }>({
    target: helloFunc
});

Not so good (the target: helloFunc is lost):

export declare const helloFunc: Func<void, {
    message: string;
}>;
export declare const helloApi: Api<void, {
    message: string;
}, void & Object>;