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

env-linter

v2.0.0

Published

Ensures that all developers on your project use the same node version, install dependencies in an unambiguous manner and utilize githooks.

Downloads

6,802

Readme

npm Build Status License

Usage example

Feel free to use env-linter in any way that makes sense for your project. Here is an example of how env-linter could be applied as part of your package.json:

{
  "postinstall": "env-linter -s -se -d -vs 'node=16.x.x,npm=8.x.x'",
  "prestart": "env-linter -h -vs 'node=16.x.x,npm=8.x.x'",
  "lint-staged": {
    "**/package.json": ["env-linter -s -d"]
  }
}

You can skip all env-linter checks by using the environment variable ENV_LINTER_SKIP=true. This could be useful on certain CI environments which are not automatically detected by env-linter.

API usage

const { api } = require('env-linter');

await api({
  versions: 'node=16.x.x,npm=8.x.x',
  hooksInstalled: true,
  saveExact: true,
  dependenciesExactVersion: true,
  lts: true,
  security: true,
});

Options

-vs, --versions [string]

Checks the installed versions of global packages or programs like node, npm, yo, etc. against a required version. For example calling env-linter --versions 'node=16.x.x' will ensure that version 16 of node is being used. Multiple versions can be checked by separating them with a comma (eg. --versions 'node=16.x.x,npm=8.x.x,yo=4.x.x'). env-linter will stop any further process-execution if a package or program does not satisfy the required version.

Calling env-linter with --versions but without any arguments will compare the installed node-version with the node-version from the .node-version file.

In any case, the used node version is compared to the list of official node-releases and process-execution is stopped if the used npm version is older than the npm version that node comes with.

-h, --hooksInstalled

Checks if git-hooks are installed (i.e. husky installed). env-linter will stop any further process-execution if git-hooks are not installed.

-se, --security

Checks if the used node version is considered secure according to the current list of node releases. If a newer node-version is available which was released due to a security concern, env-linter will stop any further process-execution. Find out more about the security-flag in this github issue.

-s, --saveExact

Checks if the npm option save-exact is enabled, either through a .npmrc file in the project or in the user-directory. env-linter will stop any further process-execution if save-exact is disabled.

-d, --dependenciesExactVersion

Checks if the version definitions of the dependencies and devDependencies in the package.json (or in a monorepository all available packages) are fitting our standards, which means; no approximate versions eg. tilde ~ or caret ^, no star * wildcard and no tarball embeds via https://*.

-l, --lts

Checks if the used node version is a LTS version. Here is some more information why it might be a good idea to use an LTS version.

Contributing

You want to contribute to the env-linter? That's awesome!

License

MIT License