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

copyrightizen

v1.0.3

Published

A tool generates designated copyright notice to target files with scope support like Intellij IDEs.

Downloads

96

Readme

Copyrightizen

this module is a tool to append/update copyright/license notice in target source files, based on scope management.

Usage

For installation, run

npm install copyrightizen -g

to run copyrightizen against some file with glob patterns, run

copyrightizen --paths src/*.ts

to run copyrightizen with config file, just run

copyrightizen [--config custom.config.js]

Features

  • [x] configuration file to control various features
  • [x] scope management (similar to Intellij IDE's scope concept)
  • [x] custom copyright text or custom file template
    • [ ] support dynamic template
  • [x] update strategy to control update or skip update the existing license
  • [x] custom Regexp rule to match custom copyright format
  • [x] full functionality supported in command line
    • [x] seamless support for multi files input from command line (useful for tools like lint-staged)

Configuration

Config File

thanks to cosmiconfig, Copyrightizen support a bunch of config variants:

  • a copyrightizen property in package.json
  • a .copyrightizenrc file in JSON or YAML format
  • a .copyrightizenrc.json file
  • a .copyrightizenrc.yaml, .copyrightizenrc.yml, or .copyrightizenrc.js file
  • a copyrightizen.config.js file exporting a JS object

A sample content of the config should look like this:

//.copyrightizenrc
{
  "licenseText": "Copyright (c) Humans on Mars",
  "updateStrategy": "update",
  "scopes": [
    {
      "name": "scopeA",
      "paths": ["*.ts*"],
      "licenseText": "Copyright (c) Humans on Moon",
      "updateStrategy": "update",
    },
  ]
}

NOTE: For the detail constraints of the supported configurations, see the JSON schema.

NOTE: Configuration uses globby for glob matching, it support glob features what globby supports

Options Precedence order

From lowest to highest

  1. default global Options
  2. global Options from config file(if config is enabled and a config file is found)
  3. command line global options
  4. related scope options if available

Scopes Precedence order

the order of scopes within config file matters.

The global scope (aka default config) has the lowest priority. The later a scope is defined in the scopes list, the higher priority it has.

Command Line Help Message

Options:
  --version               Show version number                          [boolean]
  --config                Use the specific configuration file           [string]
  --detect-rule           regexp expression to detect copyright         [string]
  --paths                 a list of glob string to match desired files   [array]
  --license-text          the license/copyright notice                  [string]
  --license-template-url  the address for license template file         [string]
  --update-strategy       the update strategy when existing copyright is
                          detected in matched source file
                                                     [choices: \\"update\\", \\"skip\\"]
  --follow-gitignore      exclude the files listed as excluded in .gitignore
                                                                       [boolean]
  -h, --help              Show help                                    [boolean]

Examples:
  cli.js --config crn.spec.json
  cli.js --detect-rule /@license/i
  cli.js --license-text \\"@license whatever you want\\"
  cli.js --license-template-url config/license.tpl