Skip to content

Messageflow/clean

Repository files navigation

@messageflow/clean

Quick clean with del


NPM

Version Downloads MIT License Code of Conduct

Build Status Dependency Status NSP Status codecov Coverage Status

codebeat-badge codacy-badge

Yet another opinionated cleaning tool to reset a working directory by deleting files/ folders that are ignored by default via .gitignore.

Table of contents

Pre-requisites

Setup

Install

# Install via NPM
$ npm install --save @messageflow/clean

Usage

Node.js

const {
  clean,
  // IGNORE_PATH,
} = require('@messageflow/clean');

void async function main() {
  const d = await clean();

  console.log(d);
  // The output might vary as it depends on the files/ folders that have been actually deleted from your system.
  // [
  //   'coverage',
  //   'dist',
  //   'index.d.ts',
  //   'index.js',
  //   'json.d.ts',
  //   'node_modules',
  //   'test',
  // ]
}();

Native ES modules or TypeScript

// @ts-check

import {
  clean,
  // IGNORE_PATH,
} from '@messageflow/clean';

void async function main() {
  const d = await clean();

  console.log(d);
  // The output might vary as it depends on the files/ folders that have been actually deleted from your system.
  // [
  //   'coverage',
  //   'dist',
  //   'index.d.ts',
  //   'index.js',
  //   'json.d.ts',
  //   'node_modules',
  //   'test',
  // ]
}();

API Reference

IGNORE_PATH

.build/,
.DS_Store,
.esm-cache,
.nyc_output,
.tmp/,
.vscode,
npm-debug.log*,
yarn-error.log*,
coverage*/,
dist*/,
node_modules/,
test*/,
**/*.d.ts*,
**/*.js,
**/*.jsx,
!gulpfile*.js,
!src/demo/*.*,
!src/json.d.ts,
!src/test*/,

clean([options])

  • options <Object> Optional configuration to delete files/ folders.
  • returns: <Promise<string[]>> Promise which resolves with a list of deleted files/ folders.

License

MIT License © Rong Sen Ng