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

shamus

v0.0.6

Published

node-webkit app that watches a directory and runs tasks when files change

Downloads

8

Readme

Shamus

Shamus is a desktop application that watches a directory and runs tasks when specified files change. Built with javascript and node-webkit, it should work on OS X, Linux, and Windows. (Note that only OS X is tested at this time, please file an issue if you have problems on other platforms)

Example Uses

  • Run your tests automatically when your code changes, and get instant feedback without leaving your editor.

  • Run build tasks effortlessly when your code changes.

  • Unlike CLI-based watchers and test/task runners, feedback is provided instantly through a dedicated app, which you can set to always be "on top" if you like. This is in contrast to keep separate console sessions open for every watcher and/or manually triggering build tasks in the shell.

Installing and Running the app

  1. Install the app with npm install -g shamus

  2. In your project's directory, run shamus init, which will create a .shamus.json file that holds the task declarations for this directory. You will want to customize this for your use, but by default it should look something like:

    {
       "window": {
           "alwaysOnTop": true,
           "top": 0,
           "right": 0
       },
    
       "watcher": {
           "paths": ["."]
       },
    
       "tasks": [
           {
               "name": "JSHint",
               "command": "jshint .",
               "parser": "exitcode",
               "fileMatcher": "\\.js$"
           }
       ]
    }

    This config will have shamus run jshint (assuming you have it installed) every time a javascript file in your project directory changes.

    You'll also notice the window settings that will align shamus's window to the top-right of your screen, and keep it on top of other windows on your desktop.

  3. Still in your project's root directory, enter shamus from the terminal. Shamus should start and report jshint's results.

JSON Config Format

A .shamus.json config file tells Shamus which tasks to run (the "tasks" section, which should contain an array of task objects), and how to display the app on the desktop (the optional "window" section). The following keys are supported

task objects

  • command - The command to run when a matched file changes
  • fileMatcher - A regular expression string that matches files that, when they change, trigger the task run
  • parser - (optional) How to parse the output of the task, and determine whether it succeeded or failed. See the Parsers section below.
  • name - (optional) The name of the task, as displayed in the shamus app.

window parameters

All window parameters are optional, and you can omit the section entirely

  • alwaysOnTop - The shamus window will always be on top of all other windows
  • width - The width of shamus's window, in pixels. Defaults to 400.
  • top, bottom, left, right - Similar to CSS's properties, these parameters let you set where shamus should sit on your desktop. For example, using "right": 0, "top": 0 will put the window in the top right corner of your desktop.

watcher parameters

By default, shamus recursively watches all files in the project's root directory. If there are a lot of files in your project, this can lead to the dreaded EMFILE error. To combat this, set your config's watcher.paths to an array of the files/dirs you want shamus to monitor.

Note: if you change watcher.paths, you'll need to restart shamus for it to take effect (refreshing the app will not pick up the change).

Parsers

Shamus ships with a couple of simple parsers, which check the results of your task process and report a success or failure to the app. If no parser is specified for a task, "exitcode" will be used.

  • "exitcode" - Detects a success if the task process has an exit code of 0.
  • "tap" - Parses TAP output and reports success if there are 0 failures.

Tips and Tricks

  • Ctrl-r refreshes the app (and detects changes to .shamus.json)
  • Ctrl-d opens the node-webkit devtools
  • If you’re hacking on shamus, use npm start to launch the app, instead of the shamus script. This will ensure that all app logging and tracebacks will be dumped to the terminal where the app was launched.

Screenshots

Examples of the app running on its own codebase:

Success Failure

License

MIT