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

termestry

v0.0.1

Published

A Tapestry for the Terminal

Downloads

14

Readme

Termestry

Version 0.0.1

A dependency free tapestry for the terminal


With Termestry, you can draw on terminal with ease.

Installation

Termestry is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm install termestry

You can also just add it to your package.json file, and it will be installed the next time you run npm install:

{
  "dependencies": {
    "termestry": "^0.0.1"
  }
}

Basic Usage

Drawing a Rectangle

import { Canvas, Paint, Color, Size, Point } from "termestry";

const myPaint = new Paint(
  Color.RED /* stroke color */,
  Color.BLUE /* fill color */
);

const myCanvas = new Canvas(myPaint); /* create a canvas with the paint */

const size = new Size(10, 10);

myCanvas.rect(
  Point.centerFor(size),
  size
); /* draw a rectangle at the center of the screen */

myCanvas.draw(); // draw the canvas

Creating a stick figure

import { Paint, Color, Size, Point, Canvas } from './src/index.js';

const myPaint = new Paint(
    Color.Red, /* stroke color */
    Color.None, /* fill color */
);
const myCanvas = new Canvas(myPaint); /* create a canvas with the paint */

// What is a stick figure?
//  O <- A circle (head)
// --- <- A long line (arms)
//  | <- A line (body)
// / \ <- Two lines (legs)

const head = new Size(6, 6);
const body = new Size(1, 5);
const arms = new Size(5, 1);
const legs = new Size(5, 2);

const center = Point.centerFor(head);

// The head
myCanvas.ellipse(
    center, // Where to draw the head
    head.width / 2, // The X radius
    head.height / 2, // The Y radius
    0, // The rotation
    0, // The start angle
    2 * Math.PI, // The end angle (2 * PI is a full circle)
);

// The arms
let arms_subpath = myCanvas.subpathAt(
    new Point(
        center.x - arms.width / 2,
        center.y + head.height - arms.height
    )
); // Create a subpath at the center of the head

arms_subpath.lineTo(
    new Point(
        center.x + arms.width / 2,
        center.y + head.height - arms.height
    )
); // Draw the arms

// The body
let body_subpath = myCanvas.subpathAt(
    new Point(
        center.x,
        center.y + head.height / 2
    )
); // Create a subpath at the bottom of the head

body_subpath.lineTo(
    new Point(
        center.x,
        center.y + head.height / 2 + body.height
    )
); // Draw the body

// The legs
let legs_subpath = myCanvas.subpathAt(
    new Point(
        center.x,
        center.y + head.height / 2 + body.height
    )
); // Create a subpath at the bottom of the body

legs_subpath.lineTo(
    new Point(
        center.x - legs.width,
        center.y + head.height / 2 + body.height + legs.height
    )
); // Draw the left leg

let legs_subpath_2 = myCanvas.subpathAt(
    new Point(
        center.x,
        center.y + head.height / 2 + body.height
    )
); // Create a subpath at the bottom of the body

legs_subpath_2.lineTo(
    new Point(
        center.x + legs.width,
        center.y + head.height / 2 + body.height + legs.height
    )
); // Draw the right leg

myCanvas.draw(); // Draw the canvas

For API usage, and more specific examples, refer to the API (⚠️ Link Broken ⚠️).

Project Status

Termestry is currently in alpha. While the current API is stable, there may be breaking changes in the future, and more features will be added.

To help with the development of Termestry, you can contribute to the project by submitting issues, pull requests, or shooting me an email at [email protected].

License

Termestry is licensed under the CC BY 4.0 license. This means that you can use Termestry in any way you want, as long as you give credit to me, the original author (RedYetiDev).

What is "as long as you give credit to me"?

Giving credit is showing that you used Termestry in your project. This can be done by linking to the GitHub repository, or by linking to the npm package.

Can I use Termestry in a commercial project?

Of course! You can use Termestry in any project, commercial or not, as long as you give credit to me.