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

@fordi-org/scripting

v1.0.2

Published

Tiny lib for doing shell-scripty stuff

Downloads

1

Readme

@fordi-org/scripting

Tiny lib for doing shell-scripty stuff

cleanExit

Exit with an errorLevel of 0

throw cleanExit("Everything is OK; we're just done");

exec

Promisified child_process.exec

const { stdout } = await exec("ls");

readJson / writeJson

Convenience for JSON interaction

const pkg = await readJson("package.json");
pkg.newProp = value;
await writeJson("package.json", pkg);

exists

Convenience for verifying a file exists

if (await exists("package.json")) {
  doStuffWithPackage();
}

findRoot

Find the npm project root for a path.

const packageFile = resolve(await findRoot(searchPath), "package.json");

inLocalPrefix

For a project that's expected to be run via npx, change the working directory to the local prefix, and run an async function.

await inLocalPrefix(async () => {
  console.log((await exec('ls')).stdout);
});

runJobs

Run a list of Jobs, with supported rollback. A Job is of the structure:

| Key | Type | Req? | Description | |-----------:|----------------------|:----:|--------------------------------------------------------------------------------------------| | name | string | √ | Task name | | if | async () => boolean | | Return true if the task should run; task always runs if undefined | | willChange | async () => string[] | | For rollback; files that should be stored before the task is run, and restored if it fails | | do | async () => void | √ | Task to execute | | undo | async () => void | | Executed for rollback |

await runJobs([
  {
    name: "Install myDependency",
    if: async () =>
      !("myDependency" in ((await readJson("package.json")).devDependencies ?? {})),
    do: () => exec("npm i myDependency"),
    undo: () => exec("npm r myDependency"),
  },
  {
    name: "Create basic config",
    if: async () => !(await exists(".my-dependency.rc")),
    do: () => writeJson(".my-dependency.rc", {
      projectName: (await readJson("package.json")).name ?? "my-project"
    }),
    willChange: [".my-dependency.rc"]
  },
]);