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

glob-runner

v2.1.1

Published

Tiny helper to search and exec js files by glob pattern with optional Node.js version restrictions

Downloads

117

Readme

glob-runner

Tiny helper to search and exec js files by glob pattern with optional Node.js version restrictions

CI Maintainability Test Coverage npm (tag)

Install

yarn add glob-runner -D

Usage

JS/TS API

import { run } from 'glob-runner'

await run({
  pattern: 'src/test/**/*.it.js', // pattern to load
  cwd: '/foo/bar',                // process dir         process.cwd()
  cb: () => {},                   // handler             noop
  nodeVersion: '20.0.0',          // required nodejs     process.version
  parallel: true,                 // run in parallel     false
  silent: true,                   // suppress logs       false
  glob: fg,                       // glob API provider   fast-glob
})

// Skipped /gh/glob-runner/src/test/js/index.cjs.it.js. v16.7.0 does not satisfy ^12.20.0
// Loading /gh/glob-runner/src/test/js/index.mjs.it.js...
// Done

CLI

glob-runner src/test/**/*.it.js
# Loading /gh/glob-runner/src/test/js/index.mjs.it.js...
# Done

Node engine

Any running script can define its own Node.js engine requirements through special annotation at the beginning of the file:

// node-engine ^12.20.0 || ^14.13.1 || >=16.0.0

If current the runtime does not match the pattern, invocation will be skipped. This feature might be useful for writing integration tests for several Node.js versions. For example, require API with node: prefix needs v16.0.0+, so your script may look like:

// node-engine >=16.0.0

const {read} = require('node:fs')

read('/foo/bar')

Alternatives

  • https://github.com/fahad19/glob-run

License

MIT