diff --git a/lib/hash.js b/lib/hash.js index 2db21e8..ef625f0 100644 --- a/lib/hash.js +++ b/lib/hash.js @@ -5,17 +5,6 @@ import path from 'path' // Packages import {readFile} from 'fs-promise' -const listPackage = { - name: 'static', - version: '0.0.0', - scripts: { - start: 'list ./content' - }, - dependencies: { - list: 'latest' - } -} - /** * Computes hashes for the contents of each file given. * @@ -23,14 +12,15 @@ const listPackage = { * @return {Map} */ -export default async function hashes(files, isStatic) { +export default async function hashes(files, isStatic, pkg) { const map = new Map() + await Promise.all(files.map(async name => { const filename = path.basename(name) let data if (isStatic && filename === 'package.json') { - const packageString = JSON.stringify(listPackage, null, 2) + const packageString = JSON.stringify(pkg, null, 2) data = Buffer.from(packageString) } else { data = await readFile(name) diff --git a/lib/index.js b/lib/index.js index c2f55c0..1961635 100644 --- a/lib/index.js +++ b/lib/index.js @@ -102,7 +102,12 @@ export default class Now extends EventEmitter { console.time('> [debug] Computing hashes') } - const hashes = await hash(files, isStatic) + const pkgDetails = {} + pkgDetails.name = name + + Object.assign(pkgDetails, pkg) + + const hashes = await hash(files, isStatic, pkgDetails) if (this._debug) { console.timeEnd('> [debug] Computing hashes')