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

@sketchmine/node-helpers

v3.0.0

Published

A collection of node.js helpers

Downloads

6

Readme

Github banner for sketchmine

@sketchmine/node-helpers

This package is a collection of Node.js specific helpers.

Dependency graph

Dependency graph of the sketchmine  node-helpers

List of Helpers

  • bytesToSize Displays bytes in a human readable format.
  • copyFile Copies file from one destination to another destination (async).
  • createDir Creates a folder (sync).
  • delFolder Deletes a folder recursively (sync).
  • displayHelp Logs a CLI help page to the console.
  • executeCommand Executes a command on the spawned shell (async).
  • isFile Checks if the string is a file (sync).
  • Logger Custom Logger for the library with different logging spaces.
  • readDirRecursively Lists all children of a directory recursively, (sync).
  • readFile Implementation of readFile (async).
  • writeFile Safely writes content to file. Can create one directory to store file (async).
  • writeJson Safely writes Object or string as JSON file (async).
  • zipToBuffer Get a Promised Array of File buffers from zip (async).

Building the package

To build the package Rollup.js is used as a module bundler. The configuration can be found in the rollup.config.js file and is orchestrated by the Yarn package manager. The package bundle is formatted as commonjs and is meant to be consumed only by Node.js applications.

The build can be started with the following two commands:

  • yarn build for building the package.
  • yarn dev for building and watching the sources of the package.

Linting

The source code of this package will be linted by our CI environment. To ensure a coding standard and quality, use the configured linter tslint. This package extends from the tslint-config-airbnb and the linting configuration extends from the root tslint.json.

Run yarn lint to execute the linter.

Testing the package

To ensure that the helpers are working, write tests and put them in a properly named file.

Note: All tests based on this package should be wrapped in a describe element with the prefix: [node-helpers] › ... like the following:

// import statements

describe('[node-helpers] › ${description of the functionality that should be tested}', () => {
  // your tests should be placed here
});

The Jest framework has been selected for tests.

Run yarn test to run all tests specified for the helpers. Run yarn test -f filename.test to execute only tests that match the provided RegExp for the filename.