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

react-ode-cash-money

v1.2.2

Published

'cash-money' is a virtual busybox-like framework in pure javascript.

Downloads

18

Readme

cash-money

"cash-money" is a virtual busybox-like framework in pure javascript.

cash-money

usage

install:

npm i react-ode-cash-money

sample:

const { cash, fs } = require("react-ode-cash-money");
// this all happens in-memory!
(async () => {
  console.log(await cash("echo 'hello world'"));
  fs.writeFileSync("sample.txt", "hello file content", "utf8");
  await cash("touch random.log");
  console.log(await cash("cat sample.txt"));
  console.log(await cash("ls -lah"));
})();

output:

hello world

hello file content

total 18
drw-rw-rw- 1 1000 1000  0 May 27 13:22 .
drw-rw-rw- 1 1000 1000  0 May 27 13:22 ..
-rw-rw-rw- 1 1000 1000  0 May 27 13:22 random.log
-rw-rw-rw- 1 1000 1000 18 May 27 13:22 sample.txt
drwxrwxrwx 1 1000 1000  0 May 27 13:22 tmp

api

a single use api is exposed where you can define "programs" for the shell. exec() is program's entrypoint and setup() is like its getopts.

"cash-money" modifies "cash" to accept async exec()s but you still need to make sure exec()s are executed serially asynchronously.

meaning that you cannot call cash commands in the middle of each other. there is no threading or process management.

do a waterfall await cash(<thing 1>); await cash(<thing 2>); and you are good with no race conditions.

const { console: logger, cash, use } = require("react-ode-cash-money");
// this works if you call before 1st execution
use({
  // program's binary name
  name: "sample",
  // help when executed as "help <command>"
  help: "sample help",
  // program's entry point
  exec: async function (argv) {
    // application logic goes here
    if (argv.version) {
      logger.log("Sample 1.0.0"); // or import console from cash-money
      return 0;
    }
  },
  // program's command line parser setup
  setup: function (vorpal, interfacer, preparser) {
    vorpal
      .command("sample")
      .parse(preparser)
      .option("-v, --version", "show version")
      .action(function (args, callback) {
        // this call glues vorpal to cash basically
        return interfacer.call(this, args, callback);
      });
  },
});
// this is how you use the new command:
(async () => {
  console.log(await cash(`sample --version`));
  console.log(await cash(`help sample`));
})();