npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

string-checker

v0.2.5

Published

Build tool that checks for specified strings in files

Downloads

5

Readme

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:

| Long | Short | Description | Type | Default | Required | |------|-------|-------------|------|---------|----------| | --version | | Show version number| | | | | --dir| -d | Specifies the root directory for file search | [string] | | Y | --searchString | -s | Text to search for | [array] [String] | |Y| | --exclusions| -x | Files that are excluded from the search | [array] [String] | | N | | --error | -e | returns an error rather than a warning | [boolean] | false | N | | --console | -c | output results to console | [boolean] | true | N | | --help | -h | Show help | | | |