Skip to content

Commit a31ef18

Browse files
committedMay 28, 2019
Require Node.js 8
1 parent 31303d9 commit a31ef18

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed
 

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: node_js
22
node_js:
3+
- '12'
34
- '10'
45
- '8'
5-
- '6'

‎cli.js

+18-13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const cpy = require('cpy');
55

66
const cli = meow(`
77
Usage
8-
$ cpy <source>... <destination>
8+
$ cpy <source …> <destination>
99
1010
Options
1111
--no-overwrite Don't overwrite the destination
@@ -41,16 +41,21 @@ const cli = meow(`
4141
}
4242
});
4343

44-
cpy(cli.input, cli.input.pop(), {
45-
cwd: cli.flags.cwd,
46-
rename: cli.flags.rename,
47-
parents: cli.flags.parents,
48-
overwrite: cli.flags.overwrite
49-
}).catch(err => {
50-
if (err.name === 'CpyError') {
51-
console.error(err.message);
52-
process.exit(1);
53-
} else {
54-
throw err;
44+
(async () => {
45+
try {
46+
await cpy(cli.input, cli.input.pop(), {
47+
cwd: cli.flags.cwd,
48+
rename: cli.flags.rename,
49+
parents: cli.flags.parents,
50+
overwrite: cli.flags.overwrite
51+
});
52+
} catch (error) {
53+
if (error.name === 'CpyError') {
54+
console.error(error.message);
55+
process.exit(1);
56+
} else {
57+
throw error;
58+
}
5559
}
56-
});
60+
})();
61+

‎package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"cpy": "cli.js"
2121
},
2222
"engines": {
23-
"node": ">=6"
23+
"node": ">=8"
2424
},
2525
"scripts": {
2626
"test": "xo && ava"
@@ -49,14 +49,14 @@
4949
"contents"
5050
],
5151
"dependencies": {
52-
"cpy": "^7.0.0",
52+
"cpy": "^7.2.0",
5353
"meow": "^5.0.0"
5454
},
5555
"devDependencies": {
56-
"ava": "*",
57-
"execa": "^0.10.0",
58-
"path-exists": "^3.0.0",
59-
"tempfile": "^2.0.0",
60-
"xo": "*"
56+
"ava": "^1.4.1",
57+
"execa": "^1.0.0",
58+
"path-exists": "^4.0.0",
59+
"tempfile": "^3.0.0",
60+
"xo": "^0.24.0"
6161
}
6262
}

‎readme.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $ npm install --global cpy-cli
2424
$ cpy --help
2525
2626
Usage
27-
$ cpy <source>... <destination>
27+
$ cpy <source …> <destination>
2828
2929
Options
3030
--no-overwrite Don't overwrite the destination
@@ -46,8 +46,3 @@ $ cpy --help
4646
## Related
4747

4848
- [cpy](https://github.com/sindresorhus/cpy) - API for this module
49-
50-
51-
## License
52-
53-
MIT © [Sindre Sorhus](https://sindresorhus.com)

‎test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ test.beforeEach(t => {
1212
});
1313

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

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

2323
test('cwd', async t => {

0 commit comments

Comments
 (0)
Please sign in to comment.