@messageflow/clean
Quick clean with del
!NPMnodei-badgenodei-url
!Versionversion-badgeversion-url !Downloadsdownloads-badgedownloads-url !MIT Licensemit-license-badgemit-license-url !Code of Conductcoc-badgecoc-url
!Build Statustravis-badgetravis-url !Dependency Statusdaviddm-badgedaviddm-url !NSP Statusnsp-badgensp-url !codecovcodecov-badgecodecov-url !Coverage Statuscoveralls-badgecoveralls-url
!codebeat-badgecodebeat-url !codacy-badgecodacy-url
Yet another opinionated cleaning tool to reset a working directory by deleting files/ folders that are ignored by default via .gitignore
.
Table of contents
- Install - Usage- [Node.js](#nodejs)
- [Native ES modules or TypeScript](#native-es-modules-or-typescript)
- IGNOREPATH
- clean(options)Pre-requisites
- Node.jsnodejs-url >= 8.9.0
- NPMnpm-url >= 5.5.1 (NPMnpm-url comes with Node.jsnodejs-url so there is no need to install separately.)
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
IGNOREPATH
.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
<Objectobject-mdn-url> Optional configuration to delete files/ folders.
gitConfig
<stringstring-mdn-url> Optional path to .gitignore
. Defaults to ./.gitignore
.
- path
<stringstring-mdn-url|stringstring-mdn-url> Optional glob pattern(s) to delete files/ folders. Defaults to IGNOREPATHignore-path-url.
- options
<Objectobject-mdn-url> Optional configuration from the NPMnpm-url package deldel-url. See del optionsdel-options-url.- returns: <Promisepromise-mdn-url<stringstring-mdn-url>> Promise which resolves with a list of deleted files/ folders.