Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxleiko/pkg-hash
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
https://github.com/maxleiko/pkg-hash
Last synced: 7 days ago
JSON representation
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
- Host: GitHub
- URL: https://github.com/maxleiko/pkg-hash
- Owner: maxleiko
- License: mit
- Created: 2016-07-25T10:07:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-24T15:45:48.000Z (almost 8 years ago)
- Last Synced: 2024-10-13T01:36:56.870Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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
```js
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](http://kevoree.org) 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.### Related
[pkg-hash-cli](https://github.com/maxleiko/pkg-hash-cli)