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

codecap

v0.3.1

Published

A file header standardization tool

Downloads

46

Readme

Codecap

Codecap is a file header standardization tool designed to streamline the process of maintaining consistent headers across diverse file types in your project. It automates the task of updating and unifying essential information such as license details, author credentials, and project descriptions, ensuring a cohesive style throughout your codebase.

Key Features

  • 🔍 Smart Header Inspection: Efficiently detect files with missing or incorrect headers.
  • 🛠️ Automatic Correction: Seamlessly fix and update file headers with a single command.
  • 🎯 Versatile Targeting: Support for multiple file types and patterns, enabling precise rule application.
  • 🚫 Intelligent Exclusions: Respect .gitignore and custom exclusion patterns for granular control.
  • 🔄 Year Range Automation: Automatically update copyright year ranges to stay current.
  • 🧩 Flexible Configuration: Easily customize rules and headers via JSON configuration file.

Getting Started

This section shows how to get Codecap up and running on your local machine.

System Requirements

Ensure the following software is installed on your system before using Codecap:

  • Node.js (v16 or later)

Installation

You can install Codecap either globally or locally in your project.

Global Installation

To install Codecap globally, use the following command:

npm install -g codecap

Local Installation

To install Codecap as a dev dependency in your project, use one of the following commands based on your package manager:

# npm
npm install -D codecap

# pnpm
pnpm add -D codecap

# yarn
yarn add -D codecap

Configuration

Create a .codecaprc.json file at the root level of your project directory to define rules for managing headers. Here's an example configuration:

{
   "useYearRange": true,
   "ruleSet": [
      {
         "target": ["**/*.{js,ts}", "**/*.css"],
         "targetExclude": ["node_modules/**", "dist/**"],
         "headerFile": "path/to/file",
         "headerDelimiter": "^(?![\\/ ]\\*)."
      }
   ]
}

| Key | Type | Description | | :----------------------------- | :----------- | :---------------------------------------------------------------- | | ruleSet | Array | Defines rules for applying headers to different file types. | | target | String/Array | Specifies file patterns to match for each rule. | | headerFile | String | Specifies the path to the file containing the header content. | | headerDelimiter | Regex | Specifies the pattern to identify the end of the header in files. | | useYearRange (Optional) | Boolean | Enables automatic year range updates. | | targetExclude (Optional) | String/Array | Specifies patterns for files/directories to exclude. |

[!TIP]

Use the $YEAR placeholder in your header files to automatically keep copyright years current. Codecap will update this to the latest year when fixing headers.

Usage

Global Usage

If you've installed Codecap globally, you can run it directly from any directory:

codecap --check
codecap --fix

Local Usage

If you've installed Codecap locally in your project, integrate it into your project by adding script entries in your package.json file:

{
   "scripts": {
      "check": "codecap --check",
      "fix": "codecap --fix"
   }
}

Then you can run:

  • npm run check (or pnpm check or yarn check) to inspect your files for correct headers.
  • npm run fix (or pnpm fix or yarn fix) to automatically correct any incorrect headers.

Feel free to modify these scripts as needed to fit your project requirements.

License

Codecap is available under the terms of the MIT license.

© 2024 Mayeku Khisa.