adrianogil / nodeutils

Utilities functions for NodeJS development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NodeUtils

A suite of Bash utilities tailored for Node.js developers, NodeUtils harnesses the power of fuzzy-finding to streamline and enhance your Node.js development workflow.

Table of Contents

Prerequisites

  • fzf - Command-line fuzzy finder.
  • jq - Lightweight and flexible command-line JSON processor.

Ensure these are installed and accessible from your shell.

You should also define an alias for your preferred fuzzy finder. Here's an example using fzf:

alias default-fuzzy-finder="fzf"

Installation

  1. Copy the provided Bash functions from nodeutils into your .bashrc, .bash_profile, or similar shell configuration file.
  2. Restart your terminal or source the configuration file.
  3. Navigate to any Node.js project directory and use the provided functions and aliases.

Features

Run JavaScript Files

Invoke with:

node-fz [directory]
  • Provides a fuzzy-finding interface to select and run a .js file from the specified directory.
  • Alias: nfz

Run Node.js Test Files

Invoke with:

npm-test-fz [directory]
  • Fuzzy-find and run a test file with npm test.
  • Alias: ntest-fz

List Jest Tests from a File

Invoke with:

node-list-jest-tests [file-path]
  • Lists descriptions of tests (based on it() blocks) from a Jest test file.

Run Specific Jest Test

Invoke with:

npm-test-fz-it [directory]
  • Fuzzy-find a test file and then a specific test within it to run with npm test.
  • Alias: ntest-fz-it

Summarize Node.js Project

Invoke with:

node-summarize-project
  • Provides a summary of the Node.js project, including the number of JavaScript files, the total lines of code, and details about installed packages.
  • Alias: nsummarize

Run Script from package.json

Invoke with:

npm-run-fz
  • Fuzzy-finding interface to select and run a script from package.json.
  • Alias: nrun

Usage Notes

  • For most functions, you can provide a directory as an argument. If no directory is provided, the current directory is used.
  • NodeUtils assumes the existence of a package.json in the directory where the commands are run.

Contribution

Your contributions are welcome! Feel free to extend nodeutils by adding new commands or tweaking the existing ones. Ensure you test any changes to maintain the integrity of the utility.

About

Utilities functions for NodeJS development

License:MIT License


Languages

Language:Shell 100.0%