mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 03:06:38 +00:00
test: Remove unnecessary file-exists
dependency
Change-Type: patch
This commit is contained in:
parent
c3600ee8fc
commit
04352494a0
5
npm-shrinkwrap.json
generated
5
npm-shrinkwrap.json
generated
@ -2512,11 +2512,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"file-exists": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/file-exists/-/file-exists-1.0.0.tgz",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"file-name": {
|
"file-name": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/file-name/-/file-name-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/file-name/-/file-name-0.1.0.tgz",
|
||||||
|
@ -106,7 +106,6 @@
|
|||||||
"eslint-plugin-node": "6.0.0",
|
"eslint-plugin-node": "6.0.0",
|
||||||
"eslint-plugin-promise": "3.6.0",
|
"eslint-plugin-promise": "3.6.0",
|
||||||
"eslint-plugin-standard": "3.0.1",
|
"eslint-plugin-standard": "3.0.1",
|
||||||
"file-exists": "1.0.0",
|
|
||||||
"html-angular-validate": "0.1.9",
|
"html-angular-validate": "0.1.9",
|
||||||
"mocha": "3.2.0",
|
"mocha": "3.2.0",
|
||||||
"mochainon": "1.0.0",
|
"mochainon": "1.0.0",
|
||||||
|
@ -19,8 +19,7 @@
|
|||||||
const m = require('mochainon')
|
const m = require('mochainon')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const Bluebird = require('bluebird')
|
const Bluebird = require('bluebird')
|
||||||
const fileExists = require('file-exists')
|
const fs = require('fs')
|
||||||
const fs = Bluebird.promisifyAll(require('fs'))
|
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const imageStream = require('../../lib/image-stream/index')
|
const imageStream = require('../../lib/image-stream/index')
|
||||||
@ -35,9 +34,14 @@ const doFilesContainTheSameData = (file1, file2) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const deleteIfExists = (file) => {
|
const deleteIfExists = (file) => {
|
||||||
return Bluebird.try(function () {
|
return Bluebird.try(() => {
|
||||||
if (fileExists(file)) {
|
try {
|
||||||
return fs.unlinkAsync(file)
|
fs.accessSync(file)
|
||||||
|
fs.unlinkSync(file)
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== 'ENOENT') {
|
||||||
|
return Bluebird.reject(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Bluebird.resolve()
|
return Bluebird.resolve()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user