Run a command, watch the filesystem, stop the process on file change and then run the command again...

Overview

hubmon

Run a command, watch the filesystem, stop the process on file change and then run the command again...

Install

You can install this command line tool with npm like this:

npm install -g hubmon

Usage

Basic usage

hubmon must be used as a prefix before the command you want to run.

Here's an example on how to use hubmon with a command like ls -la src:

hubmon ls -la src

In this example, hubmon will:

  • watch the filesystem for changes
  • run the command ls -la src

On each filesystem change, hubmon will:

  • kill the process if it's still running
  • run the command ls -la src again

NOTE: Killing the process if it's still running is very useful if you command runs an HTTP server for example.

Using the --watch option

By default, all files (except dotfiles) are watched (with the **/* glob pattern). If you want to only watch some files, you can use a different glob pattern with the --watch option (or its short -w alias) like this:

hubmon --watch '*.txt' ls -la src

WARNING: the quote around the glob pattern is important.

Using the --watch option with multiple patterns

You can pass multiple patterns by join them with a comma like this:

hubmon --watch '*.txt,*.sql' ls -la src

Ignoring files with the --watch option

If you want to ignore some files, you can use patterns prefixed with !.

Here's an example where you watch all files in src but not the .sql files:

hubmon --watch 'src/**/*,!src/**/*.sql' ls -la src

Under the hood, hubmon uses picomatch for glob patterns, please refer to their docs for more details.

Defining aliases for script runners

If you often use hubmon with commands like node, python or ruby, it can be nice to set some aliases like these:

alias wnode='hubmon node'
alias wpython='hubmon python'
alias wruby='hubmon ruby'

This way, in a few keystrokes, you can add the letter w (like watch) at the beginning of your command to trigger hubmon's watching mechanism:

wnode my-script.js

A note about Volta

If you're using Node.js with volta, we have a special trick for you. By default, the way volta handles automatic version switch would break. We added some special code so the versions you defined for npm, yarn and node are the right one.

You might also like...

A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

Welcome to function-stencil 👋 A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM

Jun 20, 2022

Refresh - Simple browser reload on file change middleware for your Deno web applications.

refresh Simple browser reload on file change middleware for your Deno web applications. Usage To use refresh middleware, just add a few extra lines to

Dec 19, 2022

Serve file server with single zip file as file system in Deno.

zipland Serve file server with one-single zip file in Deno. Support zip just zip32 with deflated or uncompressed serving plaintext deflate Examples Yo

Nov 2, 2022

Feel free to create new file, don't hesitate to pull your code, the most important thing is that the file name here must match your nickname so that file does not conflict with other people.

Hacktoberfest Indonesia Apa Itu Hacktoberfest ? Hacktoberfest adalah acara tahunan yang bertujuan untuk mendorong berkontribusi kedalam ekosistem open

Dec 15, 2022

🌹 Your one stop place for moderation and more.

Azalea Azalea is a advanced moderation bot used. This repo includes, the discord bot: Moderation, server stats, welcome & leave, reaction roles, auto

Sep 13, 2022

radiQL, your one-stop-shop for migrating from a legacy REST backend to an efficient and modern GraphQL API

radiQL, your one-stop-shop for migrating from a legacy REST backend to an efficient and modern GraphQL API

Welcome to radiQL, the one-stop solution for setting up GraphQL on a PostgreSQL database. Check out our Medium article here. At A Glance: Give us your

Nov 14, 2022

A one-stop app to manage and organize your daily reading habits!

A one-stop app to manage and organize your daily reading habits!

Reading Tracker with Local Authorization This is a place where you can write down all the books you plan to read, are currently reading, have finished

Sep 9, 2022

A Node.js HTTP proxy that tracks managed PaaS account applications and auto-stop&start them

A Node.js HTTP proxy that tracks managed PaaS account applications and auto-stop&start them

paastis-engine Features Paastis engine is the heart of the Paastis project. Its goal is to monitor and manage (start & stop) PaaS applications based o

Nov 8, 2022

Stop re-writing thirdweb snippets. Use thirdsnips to make it all snap!

Stop re-writing thirdweb snippets. Use thirdsnips to make it all snap!

🌈 thirdsnips Stop re-writing thirdweb snippets. Use thirdsnips to make it all snap! Thirdsnips is a tool which enhances the developer experience whil

Dec 14, 2022
Owner
Hubert SABLONNIÈRE
😎 Curious and passionate Web developer.
Hubert SABLONNIÈRE
Simple utils to pack arrays, objects and strings to a flat object (and back again).

packrup Simple utils to pack (and unpack) arrays and strings to a flat object. Status: In Development Please report any issues ?? Made possible by my

Harlan Wilton 15 Dec 23, 2022
Timers for Lost Ark bosses, islands, events, wandering merchants and more! Never miss an event again.

Timers for Lost Ark bosses, islands, events, wandering merchants and more! Never miss an event again. LostArkTimer.app Website Website Features Event

Joshua Kuan 28 Oct 17, 2022
A JavaScript library stores the form-data to the localstorage so you don't have to fill the form again.

form-storage A JavaScript library stores the form-data to the localstorage so you don't have to fill the form again. Installation via npm npm install

appleple 159 Dec 10, 2022
An easy way to discover and manage your cloud like a local filesystem

cfs An easy way to discover and manage your cloud like a local filesystem. The swiss army knife for finding any resource in your AWS account. ⏬ instal

Khalid Zoabi 4 Jun 4, 2022
A generative engine that takes various png layers on a sprite sheet format, combines them and then converts them into a .gif file

Welcome to the Generative GIF Engine v2.0.4 ?? [8 minute read] This python and node app generates layered-based gifs to create NFT gif art! It is fast

Jalagar 112 Jan 2, 2023
A generative engine that takes various png layers on a sprite sheet format, combines them and then converts them into a .gif file

Welcome to the Generative Animated Engine v3.0.1 ?? [8 minute read] This repo used to be called jalagar/Generative_Gif_Engine but because it now suppo

Jalagar 47 May 24, 2022
shell script replacement; write shell scripts in js instead of bash, then run them with a single static binary

yavascript YavaScript is a bash-like script runner which is distributed as a single statically-linked binary. Scripts are written in JavaScript. There

Lily Scott 59 Dec 29, 2022
A blazingly fast Bun.js filesystem router, with an unpleasantly smooth experience!

Oily A blazingly fast Bun.js filesystem router, with an unpleasantly smooth experience! Installation · Usage · Examples · Discord Installation Once yo

Aries 22 Dec 19, 2022
Cypress commands are asynchronous. It's a common pattern to use a then callback to get the value of a cypress command

cypress-thenify Rationale Cypress commands are asynchronous. It's a common pattern to use a then callback to get the value of a cypress command. Howev

Mikhail Bolotov 15 Oct 2, 2022