Skip to content

Commit

Permalink
fixes creation of CLI and extends README
Browse files Browse the repository at this point in the history
  • Loading branch information
ArquintL committed Oct 16, 2020
1 parent 66deaca commit d05901c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ This is an example for a config file:
```
Multiple config 'blocks' can be declared. A config block has to have the `include` field specifying an array of glob patterns.
`exclude` optionally defines glob patterns for files that would be included but should be ignored.
`license` is another optional field specifying the path to the file containing the license header that the specified files should have. The path can either be absolute or relative to the input argument `path`.
`license` is another optional field specifying the path to the file containing the license header that the specified files should have.
The path can either be absolute or relative to the input argument `path`.
Specifying no `license` field means that the licenses for these filed do not matter.
In particular, warnings are emitted for files that are not covered by any pattern.
In the example above, no header check is performed for files in the folder "node_modules" and in addition no warning is emitted for them.

Currently, two special patterns are supported in files containing a license header:
- `%regexp:\d{x}%` gets translated to a regex that matches 'x' digits. This can for example be used to specify the year in which the file was created.
- `%year%` is similar and will be translated to a regex matching 4 digits. Although it's typically used to express the current year, the checks do not enforce that the actual headers contain the current year. Therefore, this is currently equivalent to `%regexp:\d{4}%`

## Run with CLI
`npx github:viperproject/check-license-header#v1 check --config <path to config>` can be used to locally run the checks.

## Create a new Release
1. Checkout this repository
2. Create a new release branch (replace `v1`): `git checkout -b releases/v1`
Expand Down
38 changes: 37 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"package-main": "ncc build src/main.ts --source-map --license licenses.txt --out dist/main",
"package-bin": "ncc build src/bin.ts --source-map --license licenses.txt --out dist/bin",
"package-bin": "ncc build src/bin.ts --source-map --license licenses.txt --out dist/bin && prepend dist/bin/index.js '#!/usr/bin/env node\n\n'",
"package": "npm run package-main && npm run package-bin",
"test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
Expand Down Expand Up @@ -50,6 +50,7 @@
"jest": "^26.5.2",
"jest-circus": "^26.5.2",
"js-yaml": "^3.14.0",
"prepend-file-cli": "^1.0.6",
"prettier": "2.1.2",
"tmp": "^0.2.1",
"ts-jest": "^26.4.1",
Expand Down

0 comments on commit d05901c

Please sign in to comment.