Skip to content

Commit 1f6daf5

Browse files
committed
1 parent cbee638 commit 1f6daf5

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

node_modules/write-file-atomic/lib/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ function cleanupOnExit (tmpfile) {
3939
return () => {
4040
try {
4141
fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile)
42-
} catch (_) {}
42+
} catch {
43+
// ignore errors
44+
}
4345
}
4446
}
4547

@@ -156,15 +158,20 @@ async function writeFileAsync (filename, data, options = {}) {
156158
}
157159
}
158160

159-
function writeFile (filename, data, options, callback) {
161+
async function writeFile (filename, data, options, callback) {
160162
if (options instanceof Function) {
161163
callback = options
162164
options = {}
163165
}
164166

165167
const promise = writeFileAsync(filename, data, options)
166168
if (callback) {
167-
promise.then(callback, callback)
169+
try {
170+
const result = await promise
171+
return callback(result)
172+
} catch (err) {
173+
return callback(err)
174+
}
168175
}
169176

170177
return promise
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"name": "write-file-atomic",
3-
"version": "4.0.1",
3+
"version": "4.0.2",
44
"description": "Write files in an atomic fashion w/configurable ownership",
55
"main": "./lib/index.js",
66
"scripts": {
77
"test": "tap",
88
"posttest": "npm run lint",
9-
"lint": "eslint '**/*.js'",
10-
"postlint": "npm-template-check",
9+
"lint": "eslint \"**/*.js\"",
10+
"postlint": "template-oss-check",
1111
"preversion": "npm test",
1212
"postversion": "npm publish",
1313
"prepublishOnly": "git push origin --follow-tags",
1414
"lintfix": "npm run lint -- --fix",
1515
"snap": "tap",
16-
"template-copy": "npm-template-copy --force"
16+
"template-oss-apply": "template-oss-apply --force"
1717
},
1818
"repository": {
1919
"type": "git",
20-
"url": "git://github.com/npm/write-file-atomic.git"
20+
"url": "https://github.com/npm/write-file-atomic.git"
2121
},
2222
"keywords": [
2323
"writeFile",
@@ -34,20 +34,22 @@
3434
"signal-exit": "^3.0.7"
3535
},
3636
"devDependencies": {
37-
"@npmcli/template-oss": "^2.7.1",
37+
"@npmcli/eslint-config": "^3.0.1",
38+
"@npmcli/template-oss": "3.5.0",
3839
"mkdirp": "^1.0.4",
3940
"rimraf": "^3.0.2",
40-
"tap": "^15.1.6"
41+
"tap": "^16.0.1"
4142
},
4243
"files": [
43-
"bin",
44-
"lib"
44+
"bin/",
45+
"lib/"
4546
],
4647
"engines": {
47-
"node": "^12.13.0 || ^14.15.0 || >=16"
48+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
4849
},
4950
"templateOSS": {
51+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
5052
"windowsCI": false,
51-
"version": "2.7.1"
53+
"version": "3.5.0"
5254
}
5355
}

package-lock.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9824,15 +9824,16 @@
98249824
"license": "ISC"
98259825
},
98269826
"node_modules/write-file-atomic": {
9827-
"version": "4.0.1",
9827+
"version": "4.0.2",
9828+
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz",
9829+
"integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==",
98289830
"inBundle": true,
9829-
"license": "ISC",
98309831
"dependencies": {
98319832
"imurmurhash": "^0.1.4",
98329833
"signal-exit": "^3.0.7"
98339834
},
98349835
"engines": {
9835-
"node": "^12.13.0 || ^14.15.0 || >=16"
9836+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
98369837
}
98379838
},
98389839
"node_modules/ws": {

0 commit comments

Comments
 (0)