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

loopback-uml-generator

v1.0.1

Published

UML generator that uses Loopback (IBM) ORM configuration files as references

Downloads

7

Readme

Loopback UML Generator

I work in a company where we use Loopback for most of our Javascript projects. I realise that there was a gap between production code and architecture documents.

Because keeping diagrams up-to-date can be a time consuming task, I started working on a Node.js module that will generate the UML class diagram using the famous PlantUML Java library.

Installation

The library is available on this NPM repository

npm i -g loopback-uml-generator

The module will be installed globally.

You also need to download the PlantUML jar executable on your machine.

Then, just set the environment variables PLANTUML_JAR as the path of the executable.

Example: (MacOS / Linux)

export PLANTUML_JAR="~/Documents/plantuml.jar"

Usage

Once installed, just navigate into your Loopback project, and type:

lbUML <the-name-of-output-files>

The name argument is optional, if you don't set it, the module will use the app name and its version to generate the files (based on your package.json file).

Two files will be created at the root of your project:

  • *.txt, the PlantUML description file
  • *.png, the generated UML class diagram image file

Example

Here is a quick example that shows a basic UML class diagram:

Execution

Loopback-UML-Generator started...

 - PlantUML description file will be saved as UML-Generator-lb-car-1.0.0.txt
 - PlantUML image file will be saved as UML-Generator-lb-car-1.0.0.png
 - PlantUML jar used: ~/Documents/plantuml.jar
 ✓ Discovered 4 JSON model(s) in this project
 ♥ PlantUML started, please wait a few seconds...
 ✓ Done! Bye ♥

Result

You might want to customise the diagram's style (colors, and so on). Just edit the generated text diagram file, with some properties, such as skinparam monochrome, then execute the PlantUML jar file and you're good to go.

How it works

Based on files such as package.json and server/model-config.json, the module will scan for any JSON file present in the directories listed in _meta/sources property. Required fields and objects are extracted after and a formatter will create the UML description file. That's not rocket science :)

Limitations

Currently, the module supports the following Loopback's objects:

  • classes
  • properties
  • remote-methods
  • relations

Please note that for the relations object, only hasOne, hasMany, and belongsTo types are supported.

This module is still a demo, so feel free to contribuate or report any issue! Cheers ♥