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 🙏

© 2025 – Pkg Stats / Ryan Hefner

prevent-file-changes

v1.0.2

Published

A CLI tool designed to prevent specific files or patterns from being modified and committed, ensuring better control over sensitive or protected files in your repository.

Readme

prevent-file-changes

A CLI tool designed to prevent specific files or patterns from being modified and committed, ensuring better control over sensitive or protected files in your repository.

Characteristics

  • 🚫 Blocks changes to protected files during commits: Prevents committing files or patterns defined in your configuration.
  • 🎯 Supports file patterns with regular expressions: Allows advanced configurations for targeting groups of files.
  • 🔗 Integrates with Git hooks: Can be easily set up in pre-commit hooks for seamless protection.
  • 💻 CLI-friendly: Configure file paths or patterns directly via command-line options.
  • 🔧 Customizable and extensible: Provides flexibility to adapt to your repository’s needs.
  • 🌍 Works with all Git-managed projects: Compatible across repositories and workflows.

Content

Installation

npm: npm install --save-dev prevent-file-changes

pnpm: pnpm add -D prevent-file-changes

yarn: yarn add -D prevent-file-changes

Usage

Git hook

To set it up in a Git hook, add it to your pre-commit hook. For example, using Husky, add this line to your .husky/pre-commit file:

prevent-file-changes -f README.md sensible.sh -p ".\*\\.env" ".*\\.log"

CLI

You can run it as CLI if globally installed:

prevent-file-changes -f README.md sensible.sh -p ".\*\\.env" ".\*\\.log"

Or using npx if locally installed:

npx prevent-file-changes -f README.md sensible.sh -p ".\*\\.env" ".\*\\.log"

Command-line options:

  • --filesPaths or -f: A list of specific files to protect.
  • --filesPatterns or -p: A list of regular expressions defining patterns of files to protect.

Library module

Or you can use it as a script importing it as a module and passing to it as arguments the files or regex's to protect:

import { preventFileChanges } from 'prevent-file-changes';

preventFileChanges({ files: ['file1.js'], patterns: ['.*\\.env'] });

Collaborate

In order to collaborate with the project you should:

  1. Fork the repo.
  2. Clone the repo to work locally with git clone repo-url.
  3. Install dependencies with pnpm install.
  4. Develop suggested changes in a new branch (make sure you are using the prettier config, you can run pnpm format or install the prettier extension if you are using vsc editor to format on save).
  5. Run pnpm test to verify your changes doesn't have major bugs.
  6. Push your changes to your repo git push [remote-repo-alias] [branch-name].
  7. Make a pull request to the original repo.

License

The MIT License. Full License here