Skip to content

borracciaBlu/banner-cli

Repository files navigation

banner-cli
CLI tool to add a comment banner to your files.

npm version Coverage Status Build Status License


    /*! 
     * [name] v[tag]
     * [homepage]
     *
     * Copyright (c) [year] [author]
     * [license]
     */


By default it will use the values in package.json.
All values are overridable.

If you are evaluating the use of banners please read:

Installing

npm install @borracciablu/banner-cli

API Reference

Usage: banner-cli [options] [source]

CLI tool to add a banner comment to your files.

Arguments:
  source                   Files to bannerize

Options:
  -V, --version            output the version number
  -n, --name <name>        override project name
  -t, --tag <tag>          override tag version
  -s, --site <site>        override homepage
  -a, --author <author>    override author
  -y, --year <year>        override year
  --template <template>    override template
  -l, --license <license>  override license
  -d, --debug              debug options and args
  --dry-run                test the command, simulate without actually doing it
  -h, --help               display help for command

Template feature

The --template option allows you to inject tags.

The avalable tags are:

<br>      := new line. Like using \n. 
[name]    := project name
[tag]     := project tag version
[site]    := project homepage
[author]  := project author
[year]    := copyright year
[license] := license
[time]    := unix timestamp in seconds

Examples

Basic:

# add banner to each js file
$ banner-cli 'dist/**/*.js'

# add banner to each css file
# override author, license, site
$ banner-cli 'dist/**/*.css' --author 'Mr Developer' --license MIT --site https://project.js.org

# use template 
$ banner-cli 'dist/**/*.css' --template '/*! v[tag] :: [time] */'

Advanced:

// in package.json 
// inject next tag 
{
    "scripts" : {
        "banner:patch": "NEXT_TAG=$(semver $npm_package_version -i patch) banner-cli 'dist/*.js' --template='/*! v[tag] :: [time] */' --tag=$NEXT_TAG"
    }
}

Notes

This package is highly inspired by banner-cli and is currently a superset.

About

CLI tool to add a banner comment to your files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published