Skip to content

Commit

Permalink
Require Node.js 8 and upgrade to del 4
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 29, 2019
1 parent ac49906 commit 9e7c4eb
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 90 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
node_modules
yarn.lock
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
package-lock=false
4 changes: 2 additions & 2 deletions .travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '12'
- '10'
- '8'
- '6'
- '4'
33 changes: 16 additions & 17 deletions 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');

Expand All @@ -9,35 +8,35 @@ const cli = meow(`
$ del <path|glob> …
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'));
}
});
})();

118 changes: 58 additions & 60 deletions 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"
}
}
11 changes: 3 additions & 8 deletions readme.md
Expand Up @@ -23,24 +23,19 @@ $ del --help
$ del <path|glob> …
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

- [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)
2 changes: 1 addition & 1 deletion test.js
Expand Up @@ -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));
Expand Down

0 comments on commit 9e7c4eb

Please sign in to comment.