aboutsummaryrefslogtreecommitdiff
path: root/node_modules/hullabaloo-config-manager/lib/hashDependencies.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/hullabaloo-config-manager/lib/hashDependencies.js
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
remove node_modules
Diffstat (limited to 'node_modules/hullabaloo-config-manager/lib/hashDependencies.js')
-rw-r--r--node_modules/hullabaloo-config-manager/lib/hashDependencies.js44
1 files changed, 0 insertions, 44 deletions
diff --git a/node_modules/hullabaloo-config-manager/lib/hashDependencies.js b/node_modules/hullabaloo-config-manager/lib/hashDependencies.js
deleted file mode 100644
index 9587cee1e..000000000
--- a/node_modules/hullabaloo-config-manager/lib/hashDependencies.js
+++ /dev/null
@@ -1,44 +0,0 @@
-'use strict'
-
-const packageHash = require('package-hash')
-const md5Hex = require('md5-hex')
-
-const errors = require('./errors')
-const readSafe = require('./readSafe')
-
-function hashFile (filename, cache) {
- return readSafe(filename, cache)
- .then(contents => {
- if (!contents) throw new errors.BadDependencyError(filename)
-
- return md5Hex(contents)
- })
-}
-
-function hashPackage (filename, fromPackage) {
- return packageHash(`${fromPackage}/package.json`)
- .catch(err => {
- throw new errors.BadDependencyError(filename, err)
- })
-}
-
-function hashDependency (filename, fromPackage, cache) {
- if (cache && cache.dependencyHashes && cache.dependencyHashes.has(filename)) {
- return cache.dependencyHashes.get(filename)
- }
-
- const promise = fromPackage
- ? hashPackage(filename, fromPackage)
- : hashFile(filename, cache)
-
- if (cache && cache.dependencyHashes) {
- cache.dependencyHashes.set(filename, promise)
- }
- return promise
-}
-
-function hashDependencies (dependencies, cache) {
- const promises = dependencies.map(item => hashDependency(item.filename, item.fromPackage, cache))
- return Promise.all(promises)
-}
-module.exports = hashDependencies