pkg-hash
v3.0.1
Published
Generates an MD5 hash based on your local source code using package.json "main" as entry and hashing every local require sources using Acorn and a proper AST
Downloads
33
Readme
pkg-hash
Generates an MD5 hash of a CommonJS module using detective
(JavaScript Acorn parser) to get a list of all the require's
and hash only
the local sources, starting with the "main" field in package.json
.
Example
const pkgHash = require('pkg-hash');
const hash = pkgHash('/path/to/a/commonjs/module');
console.log('Hash:', hash);
Purpose
The purpose of pkg-hash
is to make integrity checks between different versions/installations of an npm module.
I know that npm already gives a hash of your module when you install it, but it does not take source code into account.
Kevoree needs to be able to check whether or not a change in the source code has happen in order to update or not a module.
Well, here it is.