https://github.com/borracciablu/banner-cli
CLI tool to add a banner comment to your files.
https://github.com/borracciablu/banner-cli
banner cli comments npm
Last synced: about 1 year ago
JSON representation
CLI tool to add a banner comment to your files.
- Host: GitHub
- URL: https://github.com/borracciablu/banner-cli
- Owner: borracciaBlu
- License: bsd-3-clause
- Created: 2022-03-18T02:40:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-24T12:10:45.000Z (almost 2 years ago)
- Last Synced: 2025-04-07T19:44:26.705Z (over 1 year ago)
- Topics: banner, cli, comments, npm
- Language: JavaScript
- Homepage:
- Size: 762 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
CLI tool to add a comment banner to your files.
```
/*!
* [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:
- [Versioning, banners and why you may consider using it](https://adropincalm.com/blog/versioning-and-banners/)
## 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 override project name
-t, --tag override tag version
-s, --site override homepage
-a, --author override author
-y, --year override year
--template override template
-l, --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:**
```
:= 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](https://www.npmjs.com/package/banner-cli) and is currently a superset.