Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

copyrightizen

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copyrightizen

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

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29
increased by141.67%
Maintainers
1
Weekly downloads
 
Created
Source

Copyrightizen

Travis Status Build status CodeClimate Test Coverage Version License Maintainability

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

  • configuration file to control various features
  • scope management (similar to Intellij IDE's scope concept)
  • custom copyright text or custom file template
    • support dynamic template
  • update strategy to control update or skip update the existing license
  • custom Regexp rule to match custom copyright format
  • full functionality supported in command line
    • 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

Keywords

FAQs

Package last updated on 29 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc