New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/package-deps-hash

Package Overview
Dependencies
Maintainers
2
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/package-deps-hash

The `package-deps-hash` library generates a JSON object containing the git hashes of all files used to produce a given package. This is useful for scenarios where you want to define a "change receipt" file to be published with a package. The [Rush](ht

  • 2.3.17
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
decreased by-31.03%
Maintainers
2
Weekly downloads
 
Created
Source

@microsoft/package-deps-hash

The package-deps-hash library generates a JSON object containing the git hashes of all files used to produce a given package. This is useful for scenarios where you want to define a "change receipt" file to be published with a package. The Rush tool uses this library to implement incremental build detection.

Only files in a git repo that are not in .gitignore will be considered in building the hash. The file content and the current state of the package can be compared then to determine whether the package needs to be rebuilt.

Internally it uses the GIT hashes to derive the hashes for package content. This allows the process to leverage Git's hash optimizations, as opposed to creating a more elaborate diffing scheme.

NOTE: Git is required to be accessible in the command line path.

Usage

let _ = require('lodash');
let { getPackageDeps } = require('@microsoft/package-deps-hash');

// Gets the current deps object for the current working directory
let deps = getPackageDeps();
let existingDeps = JSON.parse(fs.readFileSync('package-deps.json'));

if (_.isEqual(deps, existingDeps)) {
  // Skip re-building package.
} else {
  // Rebuild package.
}

API documentation for this package: https://rushstack.io/pages/api/package-deps-hash/

FAQs

Package last updated on 11 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc