Skip to content

Commit

Permalink
Require Node.js 8
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 28, 2019
1 parent 31303d9 commit a31ef18
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '12'
- '10'
- '8'
- '6'
31 changes: 18 additions & 13 deletions cli.js
Expand Up @@ -5,7 +5,7 @@ const cpy = require('cpy');

const cli = meow(`
Usage
$ cpy <source>... <destination>
$ cpy <source …> <destination>
Options
--no-overwrite Don't overwrite the destination
Expand Down Expand Up @@ -41,16 +41,21 @@ const cli = meow(`
}
});

cpy(cli.input, cli.input.pop(), {
cwd: cli.flags.cwd,
rename: cli.flags.rename,
parents: cli.flags.parents,
overwrite: cli.flags.overwrite
}).catch(err => {
if (err.name === 'CpyError') {
console.error(err.message);
process.exit(1);
} else {
throw err;
(async () => {
try {
await cpy(cli.input, cli.input.pop(), {
cwd: cli.flags.cwd,
rename: cli.flags.rename,
parents: cli.flags.parents,
overwrite: cli.flags.overwrite
});
} catch (error) {
if (error.name === 'CpyError') {
console.error(error.message);
process.exit(1);
} else {
throw error;
}
}
});
})();

14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -20,7 +20,7 @@
"cpy": "cli.js"
},
"engines": {
"node": ">=6"
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
Expand Down Expand Up @@ -49,14 +49,14 @@
"contents"
],
"dependencies": {
"cpy": "^7.0.0",
"cpy": "^7.2.0",
"meow": "^5.0.0"
},
"devDependencies": {
"ava": "*",
"execa": "^0.10.0",
"path-exists": "^3.0.0",
"tempfile": "^2.0.0",
"xo": "*"
"ava": "^1.4.1",
"execa": "^1.0.0",
"path-exists": "^4.0.0",
"tempfile": "^3.0.0",
"xo": "^0.24.0"
}
}
7 changes: 1 addition & 6 deletions readme.md
Expand Up @@ -24,7 +24,7 @@ $ npm install --global cpy-cli
$ cpy --help
Usage
$ cpy <source>... <destination>
$ cpy <source …> <destination>
Options
--no-overwrite Don't overwrite the destination
Expand All @@ -46,8 +46,3 @@ $ cpy --help
## Related

- [cpy](https://github.com/sindresorhus/cpy) - API for this module


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)
4 changes: 2 additions & 2 deletions test.js
Expand Up @@ -12,12 +12,12 @@ test.beforeEach(t => {
});

test('missing file operands', async t => {
await t.throws(execa('./cli.js'), /`files` and `destination` required/);
await t.throwsAsync(execa('./cli.js'), /`files` and `destination` required/);
});

// TODO: Blocked by https://github.com/mrmlnc/fast-glob/issues/110
test.failing('source file does not exist', async t => {
await t.throws(execa('./cli.js', [path.join(t.context.tmp, 'nonexistentfile'), t.context.tmp]), /nonexistentfile/);
await t.throwsAsync(execa('./cli.js', [path.join(t.context.tmp, 'nonexistentfile'), t.context.tmp]), /nonexistentfile/);
});

test('cwd', async t => {
Expand Down

0 comments on commit a31ef18

Please sign in to comment.