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.2.0

Published

A file header standardization tool

Downloads

38

Readme

Codecap

Codecap is a file header standardization tool that simplifies the updating and uniformity of headers across various file types within a project. It ensures consistent presentation of details like license information, author credentials, or project descriptions, promoting a harmonized style throughout your codebase.

Features

  • Header Inspection: Check if files have the correct header.
  • Header Correction: Automatically fix files with incorrect headers.
  • Flexible Targeting: Apply rules to a wide range of file types, with support for both individual and multiple patterns.
  • Exclusion Patterns: Exclude specific files or directories from being processed, with support for single or multiple exclusion patterns.

Getting Started

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

System requirement

To use this tool, ensure the following software is installed on your system:

  • Node.js 16 or newer

Installation

  1. Open your terminal.

  2. Navigate to your node project's directory.

  3. Execute the following command:

    npm install -D codecap

Configuration

Set up a .codecaprc.json file at the root level of your project directory as shown in the example below:

{
   "useYearRange": true,
   "ruleSet": [
      {
         "target": ["**/*.{js,ts}", "**/*.css"],
         "targetExclude": ["node_modules/**", "dist/**"],
         "headerFile": "path/to/file",
         "headerDelimiter": "^(?![\\/ ]\\*)."
      }
   ]
}
  • useYearRange (optional): A boolean that enables automatic year range updates, from file creation to current year.
  • ruleSet: An array of rules defining how headers should be applied. Each rule can handle different file types uniquely.
  • target: A pattern or an array of patterns for matching files. It specifies which files the rule should apply to.
  • targetExclude (optional): A pattern or an array of patterns for files or directories to exclude from the rule.
  • headerFile: The path to a file containing the header content to be prepended to each matched file.
  • headerDelimiter: A regex pattern that helps identify where the header ends in a file for correct insertion or replacement.

To ensure your file headers remain up-to-date with the current year, use the $YEAR placeholder within your header file content.

Usage

Integrate the tool into your project by adding script entries in your package.json file:

{
   "scripts": {
      "check-headers": "codecap --check",
      "fix-headers": "codecap --fix"
   }
}
  • Run npm run check-headers to inspect your files for correct headers.
  • Use npm run fix-headers to automatically correct any incorrect headers.

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

License

This tool is available under the terms of the MIT license.

© 2024 Mayeku Khisa.