Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 13, 2021
1 parent 4eb8f47 commit bedd8ce
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
2 changes: 2 additions & 0 deletions index.d.ts
Expand Up @@ -10,6 +10,8 @@ declare namespace cpFile {
/**
[Permissions](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) for created directories.
It has no effect on Windows.
@default 0o777
*/
readonly directoryMode?: number;
Expand Down
7 changes: 6 additions & 1 deletion package.json
Expand Up @@ -54,6 +54,11 @@
"sinon": "^9.0.0",
"tsd": "^0.11.0",
"uuid": "^7.0.2",
"xo": "^0.27.2"
"xo": "^0.28.2"
},
"xo": {
"rules": {
"unicorn/string-content": "off"
}
}
}
4 changes: 3 additions & 1 deletion readme.md
Expand Up @@ -64,7 +64,9 @@ Overwrite existing destination file.
Type: `number`\
Default: `0o777`

[Permissions](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) for created directories. Not supported on Windows.
[Permissions](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) for created directories.

It has no effect on Windows.

### cpFile.on('progress', handler)

Expand Down
10 changes: 5 additions & 5 deletions test/async.js
Expand Up @@ -110,16 +110,16 @@ test('do not create `destination` directory on unreadable `source`', async t =>
test('preserve timestamps', async t => {
await cpFile('license', t.context.destination);
const licenseStats = fs.lstatSync('license');
const tempStats = fs.lstatSync(t.context.destination);
assertDateEqual(t, licenseStats.atime, tempStats.atime);
assertDateEqual(t, licenseStats.mtime, tempStats.mtime);
const temporaryStats = fs.lstatSync(t.context.destination);
assertDateEqual(t, licenseStats.atime, temporaryStats.atime);
assertDateEqual(t, licenseStats.mtime, temporaryStats.mtime);
});

test('preserve mode', async t => {
await cpFile('license', t.context.destination);
const licenseStats = fs.lstatSync('license');
const tempStats = fs.lstatSync(t.context.destination);
t.is(licenseStats.mode, tempStats.mode);
const temporaryStats = fs.lstatSync(t.context.destination);
t.is(licenseStats.mode, temporaryStats.mode);
});

test('throw an Error if `source` does not exists', async t => {
Expand Down
10 changes: 5 additions & 5 deletions test/sync.js
Expand Up @@ -125,16 +125,16 @@ test('do not create `destination` directory on unreadable `source`', t => {
test('preserve timestamps', t => {
cpFile.sync('license', t.context.destination);
const licenseStats = fs.lstatSync('license');
const tempStats = fs.lstatSync(t.context.destination);
assertDateEqual(t, licenseStats.atime, tempStats.atime);
assertDateEqual(t, licenseStats.mtime, tempStats.mtime);
const temporaryStats = fs.lstatSync(t.context.destination);
assertDateEqual(t, licenseStats.atime, temporaryStats.atime);
assertDateEqual(t, licenseStats.mtime, temporaryStats.mtime);
});

test('preserve mode', t => {
cpFile.sync('license', t.context.destination);
const licenseStats = fs.lstatSync('license');
const tempStats = fs.lstatSync(t.context.destination);
t.is(licenseStats.mode, tempStats.mode);
const temporaryStats = fs.lstatSync(t.context.destination);
t.is(licenseStats.mode, temporaryStats.mode);
});

test('throw an Error if `source` does not exists', t => {
Expand Down

0 comments on commit bedd8ce

Please sign in to comment.