Giter Club home page Giter Club logo

manage-licence-header's Introduction

Purpose

The purpose of this package is to add licence headers to source code files.

Requirements

  • Node (preferably the latest LTS).

How to use

(Optional) create a tarball

  • Create a package with npm pack.

Install the package locally

  • Install the package (npm install <path to directory with source code or to tarball>)
  • Run node_modules/.bin/manage-licence-header in the console or write npm run manage-licence-header in the scripts field of package.json and pass relevant options to it.

Run with npx without installing

npx --p <repo url> manage-licence-header command options

Commands

Add

Adds licence header to files

Usage: manage-licence-header add options file_path_patterns

Options:

  • config – path to config
  • template — path to licence header template

Remove

Removes licence header (as specified in the template file) from files

Usage: manage-licence-header remove options file_path_patterns

Options:

  • config – path to config
  • template — path to licence header template

Replace

Removes licence header (as specified in the template file) from files

Usage: manage-licence-header replace options file_path_patterns

Options:

  • config – path to config
  • oldTemplate — path to licence header template to remove
  • newTemplate — path to licence header template to add

File path patterns

The package uses globby and understands all file patterns that are valid for globby

Examples

  • simple path to file: manage-licence-header add ./example.ts
  • simple paths to multiple files: manage-licence-header add ./example1.ts example2.ts
  • all files in a directory (recursively): manage-licence-header add "src/**/*.ts" (notice the quotation marks around the glob path; without them bash will likely try to expand the pattern itself, which is likely not what you want)
  • all files in a directory except for test files: E=! && manage-licence-header add "src/**/*.ts" "${E}src/**/*.test.ts" (the negation marker is an exclamation point; but note the trick with assigning it to a variable — E=! — to prevent bash from interpreting it as the beginning of a shell command)

Prior art

https://github.com/awjh/license-check-and-add

manage-licence-header's People

Contributors

azangru avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.