Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rushstack/package-deps-hash

Package Overview
Dependencies
Maintainers
3
Versions
398
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/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](http

  • 4.1.36
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
76K
decreased by-79.42%
Maintainers
3
Weekly downloads
 
Created

What is @rushstack/package-deps-hash?

@rushstack/package-deps-hash is a utility for computing a hash based on the contents of a package and its dependencies. This is particularly useful for build systems and caching mechanisms where you need to determine if a package or its dependencies have changed.

What are @rushstack/package-deps-hash's main functionalities?

Compute Package Hash

This feature allows you to compute a hash for a given package directory. The hash is based on the contents of the package and its dependencies, which can be used to determine if any changes have occurred.

const { getPackageDeps } = require('@rushstack/package-deps-hash');
const path = require('path');

async function computeHash() {
  const packagePath = path.resolve(__dirname, 'path/to/your/package');
  const packageDeps = await getPackageDeps(packagePath);
  console.log(packageDeps);
}

computeHash();

Custom File Globs

This feature allows you to specify custom file globs to include in the hash computation. This can be useful if you want to include or exclude specific files or types of files in the hash calculation.

const { getPackageDeps } = require('@rushstack/package-deps-hash');
const path = require('path');

async function computeHashWithGlobs() {
  const packagePath = path.resolve(__dirname, 'path/to/your/package');
  const customGlobs = ['**/*.js', '**/*.json'];
  const packageDeps = await getPackageDeps(packagePath, { globs: customGlobs });
  console.log(packageDeps);
}

computeHashWithGlobs();

Other packages similar to @rushstack/package-deps-hash

FAQs

Package last updated on 02 Mar 2024

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