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

@das.laboratory/cli-helpers

v1.1.1

Published

A collection of wheels I don't want to reinvent over and over again anymore.

Downloads

10

Readme

@das.laboratory/cli-helpers

A collection of wheels I don't want to reinvent over and over again anymore.

Install

npm install @das.laboratory/cli-helpers

Usage

Start with instantiating the helpers and provide a width. Then use the included helpers.

import CliHelpers from '@das.laboratory/cli-helpers';

const cliWidth = 100;
const cliHelpers = new CliHelpers(cliWidth);

cliHelpers.showMessage("Let's put a pin in that pre launch throughput!", 76);

Or import individual helpers without configuring the default width:

import { clearScreen, showMessage } from '@das.laboratory/cli-helpers';

clearScreen();
showMessage("Let's put a pin in that pre launch throughput!", 76, 100);

Checkout the examples file for more... uhm... examples.

API

cliHelpers.header(input, lineLength?)

Outputs a header, centered inside a red box with rounded corners.

console.log(cliHelpers.header("I'm the header! I'm " + cliWidth + ' chars wide (80 by default)!'));

header

input

Type: string

The text to be shown.

lineLength

Type: number
Default: 80

The length of the header.


cliHelpers.showLogo(lineLength?)

Displays the ILY version of the simpleshow logo (aka the interactive logo), centered using a given line length.

console.log(cliHelpers.showLogo(100));

header

lineLength

Type: number
Default: 80

The length of a line. Used to center the logo.


cliHelpers.centerText(input, textLength?, lineLength?)

Outputs the input text, centered and wrapped over multiple lines if too long.

console.log(
	cliHelpers.centerText(
		"Our competitors are jumping the shark, can you send me an invite?. Land the plane if you want to motivate these clowns. Try less carrot and more stick by moving the needle for high-performance keywords or game plans. Closing these latest prospects is like putting socks on an octopus. Identify pain points, and let's not solutionize this right now. Just parking-lot this for on-brand but wholly fresh ideas and overcome key issues to meet critical milestones. Circle back so ladder up / ladder back to the strategy.",
		76,
		100
	)
);

header

input

Type: string

The text to be shown.

textLength

Type: number
Default: 76

The maximum length of text per line.

lineLength

Type: number
Default: 80

The maximum length of the line, including text and whitespace.


cliHelpers.showMessage(input, textLength?, lineLength?)

This is the more opinionated shorthand version of centerText(). It adds one linebreak before and two after the text. It also console.logs the text directly, instead of just returning the string.

cliHelpers.showMessage("Let's put a pin in that pre launch throughput!", 76, 100);

header

input

Type: string

The text to be shown.

textLength

Type: number
Default: 76

The maximum length of text per line.

lineLength

Type: number
Default: 80

The maximum length of the line, including text and whitespace.


cliHelpers.keyToContinue(input?, lineLength?)

Outputs a message and waits for the user to press a key to continue. Asynchronous.

await cliHelpers.keyToContinue('Press any key to continue...', 100);

header

input

Type: string

The text to be shown.

lineLength

Type: number
Default: 80

The maximum length of the line, including text and whitespace.


cliHelpers.clearScreen()

Clears the terminal in the same no-history and no-scroll-back way that using cmd + k does.

cliHelpers.clearScreen();

cliHelpers.softClear()

Clears the terminal in the same way that the 'clear' command does (not erasing the history).

cliHelpers.softClear();

Development

This library uses Parcel 2 for bundling. Use these npm scripts to get started.

Watch
npm start
# or
npm run watch
# or
npm run dev
# or
npx parcel watch
Build
npm run build
# or
npx parcel build

Publish new version to npm registry

Syntax

npm run bump:<newversion> --message=<commitmessage>

Options

newversion: major | minor | patch | premajor | preminor | prepatch | prerelease

commitmessage: A string that will become the commit message (if unclean, the repository will be committed before published on npm)

Example
npm run bump:patch --message="Fixed that thing with the error. Like... you know. That error."

Dry-run publish first

If you don't want npm to make any changes and that it should only report what it would have done, use the --dry-run flag:

npm publish --dry-run

See also: npm-version npm-publish Updating your published package version number