0.2.5 • Published 4 years ago

string-checker v0.2.5

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

Introduction

NPM version Downloads Licence

This is a node application designed to be integrated in a build chain to check for specified strings that you don't want in your releases or repos.

Example usage is to check for console.log().

By default it will warn, bu this can be changed to error using the -e flag.

This is very much in beta at the minute, with no unit testing. If you use, please test before relying on it in your build chain.

Installation

npm install string-checker --D

Running in the command line

string-checker -d ./src -s console.log console.error -x src/tooling/logger.ts -e

This will search the ./src directory for any instances of console.log or console.error. logger.ts has been added to the exclusion list, so won't cause and error in this instance (-e).

Add a script to package.json

Add an entry to the scripts section of package.json

"check:console": "string-ckecker -d ./src -s console.log -e"

Limitations

  • When setting up new scripts you might find that your excluded files are generating errors / warnings, if this does happen copy the file path in the error / warning and use that in the -x option. an example of this is -x ./src/tooling/logger.ts, where the error / warning might output src/tooling/logger.ts. At the minute there is a simple text match to determine if the file being tested is in the exclusion list and an exact match is required. - This will be improved in the future, for now a little testing will ensure that you are excluding things correctly.

  • None of the options support glob patterns. - This will be added in the future

  • Exclusions are files only, you cannot specify a directory. - This should be taken care of by globbing

  • Only one entry point directory can be specified, run once for each directory.

  • If there are string matches in the excluded files, the exclusion will always be logged. - This may be optional in the future

Options

Options:

LongShortDescriptionTypeDefaultRequired
--versionShow version number
--dir-dSpecifies the root directory for file searchstringY
--searchString-sText to search forarrayY
--exclusions-xFiles that are excluded from the searcharrayN
--error-ereturns an error rather than a warningbooleanfalseN
--console-coutput results to consolebooleantrueN
--help-hShow help
0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago