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

gnig

v0.2.6

Published

A tool to generate TypeScript interfaces from graphml neo4j models.

Downloads

7

Readme

GNIG

A tool to generate TypeScript interfaces from graphml graphical files. This tool has a very specific use-case. While it's not for everyone, I believe it to be easy enough to modify to suit similar needs.

Usage

(Make sure you read the use-case and caveats sections below!)

Global Install

npm install -g graphml-schema-generator

To have the wizard assist you with questions, type: gschema And answer the questions until finished.

Alternatively, you can use the following syntax: gschema <path/to/graphml/file> <path/to/out/directory> The paths can be either relative or absolute. The tool should pick on it either way.

Local Install

npm install --save graphm-schema-generator

You can either type the whole path to the file each time, such as: ./node_modules/gml-to-typescript/build/index Or you can create an npm script that references the path

However you choose to go about it, the usage is exactly the same as stated in the Global Install section. Please refer to that.

If you don't want to pollute your development environment this might be a better way to install this. Then you can use npm scripts to alias it to a more manageable command.

Use case

The generator is intended to transform a graphml file generated by tools such as yWork Yed.

For instance the following entity defined graphically using yEd translate to the typescript code just underneath it.

import { ObjectID } from 'mongodb';

interface User {
    _id?: ObjectID;
    username: string;
    password: string;
    email: string;
}

This code will be saved into the directory of your choosing with this naming convention: entities.interface.ts. The interface name itself will be the singular version of entities.

Like I said, this is very specific, but the whole goal of this was to avoid the arduous task of having to do the work twice. This way, the whole schema can be defined inside a tool such as yEd and the interfaces are generated automatically.

Caveats

There are a few things to take into consideration before using this module.

  • Only works with yEd and TypeScript. Should there be any type of interest in this, I don't mind expanding the scope, but I first developed this for my own use and it suits them just fine.
  • Inside of yEd, you need to use the first type of node inside of "Entity Relationship" category. This is because this node allows for two labels (one for the entity name, and one for the parameters).

TODO:

  • Generalize usage to more graphml tools
  • Generalize to output to vanilla JS, perhaps to mongoose schemas?