Comparing version 1.0.0 to 2.0.0
{ | ||
"name": "premove", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"repository": "lukeed/premove", | ||
"description": "A tiny (247B) utility to remove items recursively", | ||
"module": "dist/premove.mjs", | ||
"main": "dist/premove.js", | ||
"types": "premove.d.ts", | ||
"module": "dist/index.mjs", | ||
"main": "dist/index.js", | ||
"types": "index.d.ts", | ||
"license": "MIT", | ||
@@ -13,16 +13,31 @@ "author": { | ||
"email": "luke.edwards05@gmail.com", | ||
"url": "lukeed.com" | ||
"url": "https://lukeed.com" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./sync": { | ||
"import": "./sync/index.mjs", | ||
"require": "./sync/index.js" | ||
} | ||
}, | ||
"files": [ | ||
"*.d.ts", | ||
"dist", | ||
"sync" | ||
], | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=6" | ||
}, | ||
"modes": { | ||
"sync": "src/sync.js", | ||
"default": "src/async.js" | ||
}, | ||
"scripts": { | ||
"build": "bundt", | ||
"pretest": "npm run build", | ||
"test": "tape test/*.js | tap-spec" | ||
"test": "uvu -r esm test" | ||
}, | ||
"files": [ | ||
"*.d.ts", | ||
"dist" | ||
], | ||
"keywords": [ | ||
@@ -34,6 +49,7 @@ "del", | ||
"devDependencies": { | ||
"bundt": "^0.4.0", | ||
"tap-spec": "^5.0.0", | ||
"tape": "^4.9.1" | ||
"bundt": "1.0.1", | ||
"esm": "3.2.25", | ||
"mk-dirs": "2.0.0", | ||
"uvu": "0.0.14" | ||
} | ||
} |
@@ -1,16 +0,9 @@ | ||
# premove [![Build Status](https://badgen.now.sh/travis/lukeed/premove)](https://travis-ci.org/lukeed/premove) | ||
# premove [![CI](https://github.com/lukeed/premove/workflows/CI/badge.svg)](https://github.com/lukeed/premove/actions) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/premove)](https://codecov.io/gh/lukeed/premove) | ||
> A tiny (247B) utility to remove items recursively | ||
> A tiny (201B to 247B) utility to remove items recursively | ||
This is a `Promise`-based utility that recursively removes files and directories.<br> | ||
It's effectively `rm -rf` for Node.js | ||
This is a `Promise`-based utility that recursively removes files and directories. It's effectively `rm -rf` for Node.js. | ||
Available in these formats: | ||
> **Notice:** Node v12.10.0 includes the `recursive` option for [`fs.rmdir`](https://nodejs.org/api/fs.html#fs_fs_rmdir_path_options_callback) and [`fs.rmdirSync`](https://nodejs.org/api/fs.html#fs_fs_rmdirsync_path_options). | ||
* **ES Module**: `dist/premove.mjs` | ||
* **CommonJS**: `dist/premove.js` | ||
> **Important:** Requires Node 8.x or later – uses `async` functions. | ||
## Install | ||
@@ -23,7 +16,30 @@ | ||
## Modes | ||
There are two "versions" of `premove` available: | ||
#### "async" | ||
> **Node.js:** >= 8.x<br> | ||
> **Size (gzip):** 247 bytes<br> | ||
> **Availability:** [CommonJS](https://unpkg.com/premove/dist/index.js), [ES Module](https://unpkg.com/premove/dist/index.mjs) | ||
This is the primary/default mode. It makes use of `async`/`await` and [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original). | ||
#### "sync" | ||
> **Node.js:** >= 6.x<br> | ||
> **Size (gzip):** 201 bytes<br> | ||
> **Availability:** [CommonJS](https://unpkg.com/premove/sync/index.js), [ES Module](https://unpkg.com/premove/sync/index.mjs) | ||
This is the opt-in mode, ideal for scenarios where `async` usage cannot be supported.<br>In order to use it, simply make the following changes: | ||
```diff | ||
-import premove from 'premove'; | ||
+import premove from 'premove/sync'; | ||
``` | ||
## Usage | ||
```js | ||
import premove from 'premove'; | ||
import { resolve } from 'path'; | ||
import premove from 'premove'; | ||
@@ -58,2 +74,4 @@ // Async/await | ||
> **Important:**<br>The `sync` and `async` versions share the same API.<br>The **only** difference is that `sync` is not Promise-based. | ||
#### str | ||
@@ -78,4 +96,5 @@ Type: `String` | ||
- [`mk-dirs`](https://github.com/lukeed/mk-dirs) – Create directories recursively | ||
- [`del`](https://www.npmjs.com/package/del) - Delete files and folders using globs | ||
- [totalist](https://github.com/lukeed/totalist) - A tiny (195B to 224B) utility to recursively list all (total) files in a directory | ||
- [mk-dirs](https://github.com/lukeed/mk-dirs) - A tiny (420B) utility to make a directory and its parents, recursively | ||
- [escalade](https://github.com/lukeed/escalade) - A tiny (183B) and fast utility to ascend parent directories | ||
@@ -82,0 +101,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7712
8
80
102
4
5