Skip to content

Commit

Permalink
v1.4.0 - fix deleteFile throwing ENOENT errors
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Nov 2, 2023
1 parent 9e35b0c commit 42c5f40
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 30 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

## v1.4.0 2023 November 1

- Fix `deleteFile` throwing `ENOENT` errors

## v1.3.0 2023 November 1

- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ Helpers for reading, writing, deleting, and accessing a file.

``` html
<script type="module">
import * as pkg from '//cdn.skypack.dev/@bevry/file@^1.3.0'
import * as pkg from '//cdn.skypack.dev/@bevry/file@^1.4.0'
</script>
```

<a href="https://unpkg.com" title="unpkg is a fast, global content delivery network for everything on npm"><h3>unpkg</h3></a>

``` html
<script type="module">
import * as pkg from '//unpkg.com/@bevry/file@^1.3.0'
import * as pkg from '//unpkg.com/@bevry/file@^1.4.0'
</script>
```

<a href="https://jspm.io" title="Native ES Modules CDN"><h3>jspm</h3></a>

``` html
<script type="module">
import * as pkg from '//dev.jspm.io/@bevry/file@1.3.0'
import * as pkg from '//dev.jspm.io/@bevry/file@1.4.0'
</script>
```

Expand Down
38 changes: 14 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bevry/file",
"version": "1.3.0",
"version": "1.4.0",
"description": "Helpers for reading, writing, deleting, and accessing a file.",
"homepage": "https://github.com/bevry/file",
"license": "Artistic-2.0",
Expand Down Expand Up @@ -154,7 +154,7 @@
"@typescript-eslint/parser": "^6.9.1",
"assert-helpers": "^8.4.0",
"eslint": "^8.52.0",
"eslint-config-bevry": "^3.27.0",
"eslint-config-bevry": "^3.28.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"kava": "^5.15.0",
Expand All @@ -165,7 +165,7 @@
"typedoc": "^0.25.3",
"typescript": "5.2.2",
"valid-directory": "^4.0.0",
"valid-module": "^1.17.0"
"valid-module": "^2.0.0"
},
"scripts": {
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next",
Expand Down
12 changes: 12 additions & 0 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ export async function deleteFile(path: string): Promise<void> {
try {
await writable(path)
} catch (err: any) {
if (err.code === 'ENOENT') {
// if it doesn't exist, then we don't care
// this may not seem necessary, however it is
// testen would fail on @bevry/json otherwise
return
}
throw new Errlop(
`no write permission to delete the existing file: ${path}`,
err,
Expand All @@ -189,6 +195,12 @@ export async function deleteFile(path: string): Promise<void> {
try {
await unlink(path)
} catch (err: any) {
if (err.code === 'ENOENT') {
// if it didn't exist, then we don't care
// this may not seem necessary, however it is
// testen would fail on @bevry/json otherwise
return
}
throw new Errlop(
`failed to delete the existing and writable file: ${path}`,
err,
Expand Down

0 comments on commit 42c5f40

Please sign in to comment.