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

skemator

v1.0.6

Published

To build diagrams via scripting

Downloads

13

Readme

skemator

To build diagrams via scripting.

Index

Introduction

Welcome to the skemator official documentation.

By skemator, we can refer to:

  • Skemator Project: this whole set of tools.
  • Skemator Language: the programming language implementation of skemator.
  • Skemator CLI: the command-line interface of skemator.
  • Skemator API: the abstract programming interface of skemator.

Installation

$ npm i -g skemator

Get started

To start working with skemator, create the following file called example1.skm:

#L2R
[This]
 [is]
  ==>[imagination]=i1
   [or]=o1
    [reality]=r1
  ==>[reality]=r2
   [or]=o2
    [imagination]=i2
@i1 .-> @i2
@r1 .-> @r2

(Use double quotes to wrap special characters, like ., -, or others that can arise errors.)

Then, from the console, you can type this to generate an image from your *.skm file:

$ skemator compile example1.skm --png

Automatically, a example1.png will be generated beside example1.skm. It should look like:

A complete diagram

Usage

Below, the CLI and API usages are explained.

CLI

The skemator CLI brings some powerful shortcuts. With it, we can:

  • Compile *.skm to *.mmd, *.png, *.svg, *.pdf
  • Compile *.plantuml to *.png
  • Compile index.md to book.md
  • Compile *.bkm to a real files and folders

So, this tool can be useful for anyone who works with skm, bkm, plantuml and md.

Help

The help for all the commands:

Usage:
  skemator <command> <args> [options]

Commands:
  skemator compile <files..>      Compile skemator files
  skemator compile:uml <files..>  Compile plantuml files
  skemator compile:book <file>    Compile markdown files recursively in 1
  skemator create:book <folder>   Create a book in a folder (by a script
                                  optionally)

Options:
  --version  Show version number                                       [boolean]
  --verbose                                           [boolean] [default: false]
  --help     Show help                                                 [boolean]

The help to compile a *.skm file to *.mmd (and *.pdf, *.png, *.svg):

skemator compile <files..>

Compile skemator files

Options:
  --version    Show version number                                     [boolean]
  --verbose                                           [boolean] [default: false]
  --help       Show help                                               [boolean]
  --pdf                                               [boolean] [default: false]
  --png                                               [boolean] [default: false]
  --svg                                               [boolean] [default: false]
  --watch, -w                                         [boolean] [default: false]
  --command                                                 [default: "compile"]

The help to compile a *.uml or *.plantuml file into *.png:

skemator compile:uml <files..>

Compile plantuml files

Options:
  --version    Show version number                                     [boolean]
  --verbose                                           [boolean] [default: false]
  --help       Show help                                               [boolean]
  --watch, -w                                         [boolean] [default: false]
  --command                                              [default: "compileUML"]

The help to compile a book (into a book.md file from an index.md file):

skemator compile:book <file>

Compile markdown files recursively in 1

Options:
  --version    Show version number                                     [boolean]
  --verbose                                           [boolean] [default: false]
  --help       Show help                                               [boolean]
  --title                                             [boolean] [default: false]
  --index                                             [boolean] [default: false]
  --watch, -w                                         [boolean] [default: false]
  --command                                             [default: "compileBook"]

The help to create a book (optionally using a *.bkm script):

skemator create:book <folder>

Create a book in a folder (by a script optionally)

Options:
  --version     Show version number                                    [boolean]
  --verbose                                           [boolean] [default: false]
  --help        Show help                                              [boolean]
  --script, -s                                          [string] [default: null]
  --watch, -w                                         [boolean] [default: false]
  --command                                              [default: "createBook"]

Compile example

Example: it compiles first.skm second.skm third.skm and generates the *.mmd *.png *.svg *.pdf files.

$ skemator compile first.skm second.smk third.skm --png --svg --pdf

Watch example

Example: it watches first.skm second.skm third.skm for changes and generates the *.mmd *.png *.svg *.pdf files.

$ skemator compile first.skm second.smk third.skm --png --svg --pdf --watch

API

The API shares all the options accepted by the CLI, but passed in a JavaScript object to the Skemator.execute static method as unique parameter. The command property is reserved by this software, and it indicates which method needs to be statically invoked by the Skemator class, and this way we can dispatch all the commands from the same method.3

Import module

const Skemator = require("skemator");

Compile example

Example: compiles first.skm second.skm third.skm and generates the *.mmd *.png *.svg *.pdf files.

Skemator.execute({
  command: "compile",
  files: ["first.skm", "second.smk", "third.skm"]
  png: true,
  svg: true,
  pdf: true
});

Watch example

Example: watches first.skm second.skm third.skm for changes and generates the *.mmd *.png *.svg *.pdf files.

Skemator.execute({
  command: "watch",
  files: ["first.skm", "second.smk", "third.skm"]
  png: true,
  svg: true,
  pdf: true
});

Browser

Browser is not supported yet.

Language

Every script read by this tool follows a specific set of grammar rules.

Every script is composed by the header (options, currently the direction) and the body.

Script options

Each option has a new line character ('\n') at the end of it.

Diagram direction option

One of:

  • #L2R: from left to right
  • #R2L: from right to left
  • #T2B: from top to bottom
  • #B2T: from bottom to top

Script body

Every body of a script is composed by sentences.

Every sentence is finished with a new line character (\n).

Below, the different types of sentences are explained.

Sentence type 1: Node sentence

Node: --some message-->[Node]=id

...where...

  • is the tabulation. Optional.
  • --some message is the message of the relation with its parent. Optional.
  • --> is the type of the relation with its parent. Optional, but needed for the message. It can be:
    • --> which is an arrow
    • .-> which is a dotted arrow
    • ==> which is a bold arrow
    • --- which is a line
  • [Node] is the of the node ([, ]) and its text content (Node). Required. It can be:
    • [...] which is a square
    • <...> which is a diammond
    • {...} which is a rounded square
    • (...) which is a circle
  • =id is the identifier for the node. Optional.

...or, alternatively...

Node: --some message-->@id

...where...

  • is the tabulation. Optional. It indicates in which level of the main tree is set this node. With the tabulation, we implicitly overstand a relation between this node and its corresponding parent in the tree, and this way we do not need to explicitly code every time this implicit relation.
  • --some message is the message of the relation with its parent. Optional.
  • --> is the type of the relation with its parent. Optional, but needed for the message.
  • @id is the identifier for the node. Required.

Sentence type 2: Relation sentence

Node: [Some node]--some message-->@someOtherNode

...where...

  • [Some node] is the node source of the relation. Required. Any type of node is accepted.
  • --some message is the message of the relation with its parent. Optional.
  • --> is the type of the relation with its parent. Required.
  • @someOtherNode is the node destination of the relation. Required. Any type of node is accepted.

Note: each sentence ends with a new line (\n), included the last one.

Versioning

This projects adheres to the semmantic versioning 2.0 of MAJOR.MINOR.PATCH.

Issues

Please, share the issues you found in the corresponding section of the package. Thank you.

Changelog

Changes from version to version are available in the CHANGELOG.md file in the root.

License

This license is tied to the license of mermaid and other libraries.

But the part developed by me is WTFL (which means meh).