file-loggers

File logger

Run tasks over a group of files with progress logs and spinner

Review Version Downloads Size Quality Coverage

Motivation

It's a common requirement to run asynchronous tasks over group of files:

Example

This package allows you to simply provide a glob pattern for the files and a callback for each file:

import { logger } from "file-loggers";

logger(
"src/**/*.ts",
async () => {
await sleep(1000);
return Math.random() > 0.5 ? "Passing checks ✓" : "Failing checks ✕";
},
{
trail: true,
count: true,
timer: true,
},
);

Installing

npm install file-loggers

Documentation

Documentation and more detailed examples are hosted on Github Pages.

Usage

In the example above all the options are enabled:

  • trail - Show the output from the previous files.
  • count - Show the index of the current file.
  • timer - Show the time spent on each file.

They can be independently set to false.

Tooling

Dependencies

To install dependencies:

yarn install

Tests

To run tests:

yarn test

Documentation

To generate the documentation locally:

yarn docs

Linters

To run linters:

yarn lint

Formatters

To run formatters:

yarn format

Contributing

Please read this repository's Code of Conduct which outlines our collaboration standards and the Changelog for details on breaking changes that have been made.

This repository adheres to semantic versioning standards. For more information on semantic versioning visit SemVer.

Bump2version is used to version and tag changes. For example:

bump2version patch

Contributors

Remarks

Lots of love to the open source community!

Be kind to your mind Love each other It's ok to have a bad day