diff --git a/.gitattributes b/.gitattributes index 391f0a4..6313b56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ -* text=auto -*.js text eol=lf +* text=auto eol=lf diff --git a/.gitignore b/.gitignore index 3c3629e..239ecff 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +yarn.lock diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/.travis.yml b/.travis.yml index 7d69d74..f98fed0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: + - '12' + - '10' - '8' - - '6' - - '4' diff --git a/cli.js b/cli.js index 88d5c2f..e0822b5 100755 --- a/cli.js +++ b/cli.js @@ -1,6 +1,5 @@ #!/usr/bin/env node 'use strict'; -const updateNotifier = require('update-notifier'); const meow = require('meow'); const del = require('del'); @@ -9,35 +8,35 @@ const cli = meow(` $ del … Options - -f, --force Allow deleting the current working directory and outside - -d, --dry-run List what would be deleted instead of deleting + --force, -f Allow deleting the current working directory and outside + --dry-run, -d List what would be deleted instead of deleting Examples $ del unicorn.png rainbow.png $ del '*.png' '!unicorn.png' `, { - string: [ - '_' - ], - boolean: [ - 'force', - 'dry-run' - ], - alias: { - f: 'force', - d: 'dry-run' + flags: { + force: { + type: 'boolean', + alias: 'f' + }, + dryRun: { + type: 'boolean', + alias: 'd' + } } }); -updateNotifier({pkg: cli.pkg}).notify(); - if (cli.input.length === 0) { console.error('Specify at least one path'); process.exit(1); } -del(cli.input, cli.flags).then(files => { +(async () => { + const files = await del(cli.input, cli.flags); + if (cli.flags.dryRun) { console.log(files.join('\n')); } -}); +})(); + diff --git a/package.json b/package.json index 4e1f7c6..5e0a3a1 100644 --- a/package.json +++ b/package.json @@ -1,62 +1,60 @@ { - "name": "del-cli", - "version": "1.1.0", - "description": "Delete files and directories - Cross-platform", - "license": "MIT", - "repository": "sindresorhus/del-cli", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bin": { - "del": "cli.js", - "del-cli": "cli.js" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "cli.js" - ], - "keywords": [ - "cli-app", - "cli", - "delete", - "del", - "remove", - "destroy", - "trash", - "unlink", - "clean", - "cleaning", - "cleanup", - "rm", - "rmrf", - "rimraf", - "rmdir", - "glob", - "file", - "files", - "folder", - "dir", - "directory", - "fs", - "filesystem", - "cross-platform" - ], - "dependencies": { - "del": "^3.0.0", - "meow": "^3.6.0", - "update-notifier": "^2.1.0" - }, - "devDependencies": { - "ava": "*", - "execa": "^0.7.0", - "temp-write": "^3.2.0", - "xo": "*" - } + "name": "del-cli", + "version": "1.1.0", + "description": "Delete files and directories - Cross-platform", + "license": "MIT", + "repository": "sindresorhus/del-cli", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bin": { + "del": "cli.js", + "del-cli": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "cli.js" + ], + "keywords": [ + "cli-app", + "cli", + "delete", + "del", + "remove", + "destroy", + "trash", + "unlink", + "clean", + "cleaning", + "cleanup", + "rm", + "rmrf", + "rimraf", + "rmdir", + "glob", + "file", + "files", + "folder", + "directory", + "fs", + "filesystem", + "cross-platform" + ], + "dependencies": { + "del": "^4.1.1", + "meow": "^5.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "execa": "^1.0.0", + "temp-write": "^4.0.0", + "xo": "^0.24.0" + } } diff --git a/readme.md b/readme.md index 9e13dab..c4aa87b 100644 --- a/readme.md +++ b/readme.md @@ -23,15 +23,15 @@ $ del --help $ del … Options - -f, --force Allow deleting the current working directory and outside - -d, --dry-run List what would be deleted instead of deleting + --force, -f Allow deleting the current working directory and outside + --dry-run, -d List what would be deleted instead of deleting Examples $ del unicorn.png rainbow.png $ del '*.png' '!unicorn.png' ``` -Since `$ del` is already a builtin command on Windows you need to use `$ del-cli` there. +Since `$ del` is already a builtin command on Windows, you need to use `$ del-cli` there. ## Related @@ -39,8 +39,3 @@ Since `$ del` is already a builtin command on Windows you need to use `$ del-cli - [del](https://github.com/sindresorhus/del) - API for this module - [trash-cli](https://github.com/sindresorhus/trash-cli) - Move files and directories to the trash - [make-dir-cli](https://github.com/sindresorhus/make-dir-cli) - Make directories and their parents if needed - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/test.js b/test.js index 8617af0..fefece6 100644 --- a/test.js +++ b/test.js @@ -3,7 +3,7 @@ import test from 'ava'; import tempWrite from 'temp-write'; import execa from 'execa'; -test(async t => { +test('main', async t => { const filename = tempWrite.sync('foo'); await execa('./cli.js', ['--force', filename]); t.false(fs.existsSync(filename));