Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit dd65a65

Browse files
author
Cdok
committed
Updated readme and --help to reflect glob bug
After npm installing and running `npm run copyright:fix` with "copyright:fix": "copyright src/**/*.js --fix", in the `package.json`, it was only hitting `.js` files 1 folder deep. This was only occuring when run as an npm task, not when run with `node copyright.js some_glob --fix`. After wrapping the glob in single quotes, it was hitting all of the nested directories as well.
1 parent a8b7b6f commit dd65a65

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

copyright/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ This tool reads from the `headers/copyright-header.extension` files to select wh
77
Add the following to your `package.json`
88

99
```json
10-
"copyright:lint": "copyright glob",
11-
"copyright:fix" "copyright glob --fix",
10+
"copyright:lint": "copyright 'glob'",
11+
"copyright:fix" "copyright 'glob' --fix",
1212
```
1313

1414
```bash
@@ -21,7 +21,7 @@ npm run copyright:lint
2121
Add the following to your `package.json` file
2222

2323
```json
24-
"copyright:fix": "copyright ./src/**/*.js --fix",
24+
"copyright:fix": "copyright './src/**/*.js' --fix",
2525
```
2626

2727
Then run
@@ -42,4 +42,4 @@ In fix mode, the tool will add the copyright headers to any targetted files.
4242

4343
### Developing
4444

45-
`node --inspect --debug-brk copyright.js ../../some-project/source-folder/**/*.js`
45+
`node --inspect --debug-brk copyright.js '../../some-project/source-folder/**/*.js'`

copyright/copyright.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const copyright = {
2727
run() {
2828
this.buildSupportedExtensions()
2929
let error = false
30-
3130
args
3231
.map((folder) => glob.sync(folder))
3332
.reduce((a, b) => a.concat(b))
@@ -79,10 +78,12 @@ const copyright = {
7978
if (args.length === 0 || args.indexOf('--help') >= 0) {
8079

8180
console.log(`
82-
Usage: node copyright.js [options] glob [additional globs]
81+
Usage: node copyright.js [options] 'glob' ['additional globs']
82+
83+
If your glob is not targetting all nested directories, ensure that the glob string is wrapped in quotes
8384
8485
Example:
85-
${yellow}node copyright.js --fix${defaultFG} src/**/*.js
86+
${yellow}node copyright.js --fix${defaultFG} 'src/**/*.js'
8687
8788
Options:
8889

0 commit comments

Comments
 (0)