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

immutable-file

v1.1.0

Published

A tool to audit your commits and ensurce some files are immutable

Readme

immutable-file

A tool to lock down commits against project files you don't want touched.

Purpose

This tool allows files to be marked as "immutable" by storing their paths in a config file, these will then be checked against any staged git changes.

This is useful to add a precommit check for collaborative projects (or even just you!), where you want to guarantee things like database migrations don't get edited.

Getting Started

Installation

You can install immutable-file directly into your project with:

npm i immutable-file --save-dev or yarn add immutable-file --dev

If you also install globally, there is other useful CLI functionality

npm i -f immutable-file or yarn global add immutable-file

If you have the global install above, you can now run immutable-file --init in your project to automatically create a immutable-file.json in your root.

Alternatively, you can just make an immutable-file.json in your project (And configure as explained in the next section)

Configuration

Immutable-file config is JSON in the following shape:

{
  "error": "These migrations should not be edited!",
  "lock": [
    "./relative/path/to/file/you/want/locked"
  ]
}

This config file should be kept in your project version control to allow the auditing between collaborators.

The error key is a string that will get cited as the reason for failing an immutable-file audit (They've tried to commit with a file in the lock array staged).

The lock key is just an array of relative paths to the files you want to block commits against.

Precommit git hook

This library best used as a precommit hook, so that the audit is run automatically. To do this, install Husky to your project and add the following to your package.json

"scripts": {
  "precommit": "immutable-file"
}

Marking a file as immutable

If you have immutable-file installed globally, you can just run immutable-file -f <path> to have it automatically inserted into the immutable-file.json file, or you can do this manually of course.

If you'd like to add multiple files, you can add them by calling immutable-file --glob <glob> flag. This will calculate the relevant paths to add at that point in time and add them seperately to the lock list.