Skip to content

Commit d51db04

Browse files
chore(deps): update dependency hasha to v5.2.2 (#31880)
* chore(deps): update dependency hasha to v5.2.2 * use hashs instead of copied code * chore(deps): update dependency hasha to v5.2.2 * move to dep instead of devDep --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jennifer Shehane <[email protected]> Co-authored-by: Jennifer Shehane <[email protected]>
1 parent 0fbb215 commit d51db04

File tree

4 files changed

+4
-37
lines changed

4 files changed

+4
-37
lines changed

cli/lib/util.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const _ = require('lodash')
22
const arch = require('arch')
33
const os = require('os')
44
const ospath = require('ospath')
5-
const crypto = require('crypto')
5+
const hasha = require('hasha')
66
const la = require('lazy-ass')
77
const is = require('check-more-types')
88
const tty = require('tty')
@@ -30,31 +30,11 @@ const getosAsync = Promise.promisify(getos)
3030

3131
/**
3232
* Returns SHA512 of a file
33-
*
34-
* Implementation lifted from https://github.com/sindresorhus/hasha
35-
* but without bringing that dependency (since hasha is Node v8+)
3633
*/
3734
const getFileChecksum = (filename) => {
3835
la(is.unemptyString(filename), 'expected filename', filename)
3936

40-
const hashStream = () => {
41-
const s = crypto.createHash('sha512')
42-
43-
s.setEncoding('hex')
44-
45-
return s
46-
}
47-
48-
return new Promise((resolve, reject) => {
49-
const stream = fs.createReadStream(filename)
50-
51-
stream.on('error', reject)
52-
.pipe(hashStream())
53-
.on('error', reject)
54-
.on('finish', function () {
55-
resolve(this.read())
56-
})
57-
})
37+
return hasha.fromFile(filename, { algorithm: 'sha512' })
5838
}
5939

6040
const getFileSize = (filename) => {

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"figures": "^3.2.0",
4747
"fs-extra": "^9.1.0",
4848
"getos": "^3.2.1",
49+
"hasha": "5.2.2",
4950
"is-installed-globally": "~0.4.0",
5051
"lazy-ass": "^1.6.0",
5152
"listr2": "^3.8.3",
@@ -91,7 +92,6 @@
9192
"dependency-check": "4.1.0",
9293
"dtslint": "4.2.1",
9394
"execa-wrap": "1.4.0",
94-
"hasha": "5.2.2",
9595
"mocha": "6.2.2",
9696
"mock-fs": "5.4.0",
9797
"mocked-env": "1.3.2",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"gulp-awspublish": "8.0.0",
166166
"gulp-debug": "4.0.0",
167167
"gulp-rename": "1.4.0",
168-
"hasha": "5.0.0",
168+
"hasha": "5.2.2",
169169
"human-interval": "1.0.0",
170170
"husky": "7.0.2",
171171
"inquirer": "8.2.4",

yarn.lock

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18521,14 +18521,6 @@ hash.js@^1.0.0, hash.js@^1.0.3:
1852118521
inherits "^2.0.3"
1852218522
minimalistic-assert "^1.0.1"
1852318523

18524-
18525-
version "5.0.0"
18526-
resolved "https://registry.yarnpkg.com/hasha/-/hasha-5.0.0.tgz#fdc3785caea03df29535fc8adb512c3d3a709004"
18527-
integrity sha512-PqWdhnQhq6tqD32hZv+l1e5mJHNSudjnaAzgAHfkGiU0ABN6lmbZF8abJIulQHbZ7oiHhP8yL6O910ICMc+5pw==
18528-
dependencies:
18529-
is-stream "^1.1.0"
18530-
type-fest "^0.3.0"
18531-
1853218524
1853318525
version "5.2.2"
1853418526
resolved "https://registry.yarnpkg.com/hasha/-/hasha-5.2.2.tgz#a48477989b3b327aea3c04f53096d816d97522a1"
@@ -30870,11 +30862,6 @@ type-fest@^0.21.3:
3087030862
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
3087130863
integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==
3087230864

30873-
type-fest@^0.3.0:
30874-
version "0.3.1"
30875-
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1"
30876-
integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==
30877-
3087830865
type-fest@^0.4.1:
3087930866
version "0.4.1"
3088030867
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.4.1.tgz#8bdf77743385d8a4f13ba95f610f5ccd68c728f8"

0 commit comments

Comments
 (0)