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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@slyte/cli-utils

v2.1.0

Published

Shared utility library for the Slyte CLI toolchain, providing filesystem abstractions, build-pipeline helpers, CLI argument parsing, and code generation utilities

Readme

@slyte/cli-utils

Shared utility library for the Slyte CLI toolchain. Provides filesystem abstractions, build-pipeline helpers, CLI argument parsing, code generation utilities, and terminal UI components used across Slyte CLI packages.


Installation

This package is consumed internally within the @slyte/cli repo.

npm install @slyte/cli-utils

Usage

const { fileManipulation, commonCliUtils, cliSpinner, errorClass, commonObj, stringManipulation } = require('@slyte/cli-utils');

// Initialize before using file I/O or fingerprinting features
fileManipulation.init(options);

Initialization Options

| Option | Type | Description | |---|---|---| | fingerPrint | boolean | Enable content-hash fingerprinting on output files | | skipTheFingerPrint | string[] \| RegExp[] | Glob patterns or RegExps for files to exclude from fingerprinting | | log | { system, user } | Logger instances for system and user-facing output | | sourceMap | boolean | Enable source map generation | | production | boolean | Enable production mode (errors reject rather than log) |


API

fileManipulation

Filesystem abstraction layer with async and sync variants for all common file operations.

File I/O

  • read(file, callback) / readSync(file, type) — read a file
  • write(file, data, callback) / writeSync(file, content) — write a file
  • append(file, data, callback) / appendSync(file, content) — append to a file
  • truncate(file) — empty a file
  • fileExist(file) — check if a file exists (sync)
  • access(file, callback) — check file accessibility (async)

Directories

  • mkdir(dir, callback) / mkdirSync(dir) — create directory (recursive)
  • readdir(dir, callback) / readdirSync(dir) — list directory contents
  • remove(file, callback) / removeSync(file) — delete a file or directory recursively

Copy & Move

  • copy(options, obj, callback) — copy a file with optional minification, transpilation, and fingerprinting hooks
  • copySync(src, dest) — synchronous file copy
  • copyFolder(src, dest, callback) — recursive folder copy
  • copyWithSymbolicLink(obj, callback) — create a symlink from dist to src
  • rename(oldPath, newPath, callback) — rename/move a file

File Listing

  • getFilesList(dir, validationFn, done, callback) — async recursive directory walk
  • getFilesListSync(dir, ignoreArr) — sync recursive file list
  • getOnlyFilesListSync(dir, ignoreArr) — sync, returns only files (not directories)

Minification

  • minify(options, obj, callback) — minify JS, CSS, or HTML based on file extension
  • minifyJs(...) — JS minification via Terser, with source map support

Concatenation

  • concat(options, obj) — concatenate source files into a single output with optional source map and transpilation

Merge Utilities

  • merge_object(obj, obj1) — deep merge two objects
  • merge_array(arr, arr1) — merge two arrays (unique values)
  • pushIfNotExist(arr, value) — append a value if not already present

commonCliUtils

General-purpose CLI utilities.

Argument Parsing

  • getParams(options, args) — parse a CLI argument array into an options object; supports --key value, --key=value, -k, and boolean coercion

Name Validation

  • validateComponentName(name) — validates lowercase hyphenated component names
  • validateWidgetName(name) — validates widget names
  • validateHelperName(name) — blocks reserved/special characters in helper names
  • validateFolderName(name) — validates folder names against reserved JS keywords
  • validatePackageName(name, options) — validates npm package naming conventions
  • validateClassName(name) — validates and converts to camelCase
  • isReservedKeyword(name) — checks against the full JS reserved word list

String Utilities

  • convertStringToCamelCase(input) — convert any string to camelCase
  • replaceSpecialChar(name) — convert hyphenated names to camelCase

File Utilities

  • removeEmptyFolder(dir, baseRoute, options) — remove empty parent directories up to a base path
  • convertFileSizeTypeFromBytes(bytes) — returns { size, sizeType } (Bytes/KB/MB/GB/TB)

Terminal

  • isUnicodeSupported() — detect unicode terminal support
  • consoletable(table, row, column) — formatted table output

cliSpinner

Animated terminal spinner for tracking multi-step build progress.

const spinner = cliSpinner(options);

spinner.add('task-name', { label: 'Compiling...' });
spinner.success('task-name');
spinner.error('task-name', err);

In production or --nospinner mode, output is buffered and written as plain text lines.


errorClass

Build-time error and warning formatting.

  • createErrorObj(options, obj) — format a structured error with a highlighted code frame
  • handleWarnings(options, obj) — log a build warning
  • handleErrors(options, obj, reject, resolve) — route errors to reject (production) or log (watch/dev mode)

stringManipulation

Simple string helpers.

  • pluralize(str) — append "s" or "S" based on casing
  • isUpperCase(str) — check if a string is all uppercase
  • escapeSpecialChar(content) — JSON-stringify a value
  • replaceSpecialCharWithHTML(str) — replace >, <, >=, <=, " with HTML entities

commonObj

Shared in-process singleton holding build state.

{
  fileOriginalContent: {},   // file content cache
  errorObj: {},              // structured errors by file path
  errorCount: 0,
  warningCount: 0,
  minifyCount: 0,
  fingerPrintMapping: {}     // maps original paths to hashed output paths
}

Note: This is a process-level singleton. For multiple sequential builds in the same process, reset this object between runs.


isSkipFingerPrint(file, skipOptions)

Check whether a file path matches the configured skip list and should be excluded from fingerprinting.

const { isSkipFingerPrint } = require('@slyte/cli-utils');
isSkipFingerPrint('assets/vendor.js', ['vendor/**']); // true

Direct Imports

Some sub-modules can be imported directly:

// Babel AST parse/generate utilities
const { stringToAst, astToString } = require('@slyte/cli-utils/src/astToStr');

// @babel/types wrappers with location info
const nodeExpression = require('@slyte/cli-utils/src/nodeExpression');

License

Copyright 2026 Zoho Corporation Private Limited. Licensed under the Apache License, Version 2.0.