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

@appku/fairu

v1.0.6

Published

Provides a CLI and layer of functionality to work with generated model types from stashku OPTIONS requests, letting you maintain models of your stashku-accessible data.

Downloads

38

Readme

@AppKu/Fairu

Fairu is an asynchronous utility library that provides fast and reliable file-system operations that can be daisy chained together and leverage glob patterns, and serialization to toml, json, and yaml. This is a library built within the AppKu ecosystem of tools and utilities to help build apps. Specifically Fairu provides file and directory read/write operations for regular, YAML, TOML, and env files.

You can find formal documentation here.

Usage

Fairu is designed to be usable through a series of chained methods. These methods define how Fairu will perform the final action, either discovery, reading, writing, appending, touching, or unlinking.

Your Fairu usage should almost always begin with a .with call to specify the paths (which may be glob patterns). You then can follow up with methods to define how Fairu will behave, such as specifying .throw(false) to have Fairu avoid throwing errors and instead continue processing.

Returned Value

In Fairu operations (discover, touch, read, write, delete) the returned value will be a promise of an Array of PathState objects.

Example Discovering Files

let found = await Fairu
    .with('./**/*')
    .discover();
//found = [...PathState]

Example Reading Files

let readFiles = await Fairu
    .with('./path/to/files.*')
    .throw(false)
    .read();
//found = [...ReadPathState]

Example Writing Files

let writeResults = await Fairu
    .with('./hello.txt')
    .write('hello world!');
//found = [...PathState]

Example Appending Files

let appendResults = await Fairu
    .with('./hello.txt', 'only-mars.txt')
    .append('\nalso, hello Mars!');
//found = [...PathState]

Example Touching Files

let writeResults = await Fairu
    .with('./hello.txt')
    .touch();
//found = [...PathState]

Other Utilities

Fairu also provides a number of static utility functions to make your life easier:

  • mv: Move a file or directory (recursively) to another.
  • cp: Copy a file or directory (recursively) to another.
  • stringify: Stringify a JavaScript object into a json, toml, or yaml string.
  • parse: Parse json, toml, or yaml string content into a JavaScript object.
  • packageJSON: Read a package.json file synchronously from a specific directory.

Configuration

By default, Fairu works out of the box without needing any adjustment. You can tweak the behavior of path discovery though by setting the options property on the Fairu instance you create. This affects the path matching and discovery prior to taking action on defined paths.

Example

let f = new Fairu();
f.options = {
    absolute: true,
    debug: true
};
//f.with(...paths) etc.

You can find the full documentation on these options on the glob package's README.

Documentation

You can find examples and the fully published documentation at appku.github.io/fairu.

If you'd like to generate the documentation locally, you can do so by running npm run docs and the site will be statically generated under the docs/ path.

Installing

npm i @appku/fairu

Testing

This project uses jest to perform unit tests.

Running Tests

Run npm test to run jest unit tests.

Run npm run lint to run ESLint, optionally install the Visual Studio Code ESLint extension to have linting issues show in your "Problems" tab and be highlighted.

If you are writing unit tests, you may need to npm install @types/jest to get intellisense in Visual Studio Code if for some reason it did not get installed.

Publishing

Only maintainers with proper access can publish this package to npm. To do so as maintainers, you can publish by running the following command:

npm publish --registry=https://registry.npmjs.org --access=public