
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@beemo/dependency-graph
Advanced tools
Generate a dependency graph for a list of packages, based on their defined `dependencies` and `peerDependencies`.
Generate a dependency graph for a list of packages, based on their defined dependencies
and
peerDependencies
.
yarn add @beemo/dependency-graph
// Or
npm install @beemo/dependency-graph --save
To begin, instantiate an instance of Graph
, which accepts a list of optional package.json
objects as the first argument.
import Graph from '@beemo/dependency-graph';
const graph = new Graph([
{
name: '@beemo/core',
},
{
name: '@beemo/cli',
dependencies: {
'@beemo/core': '^1.0.0',
},
},
]);
Alternatively, package.json
objects can be added dynamically using Graph#addPackage
or
Graph#addPackages
.
graph.addPackage({
name: '@beemo/driver-jest',
peerDependencies: {
'@beemo/core': '^1.0.0',
'@beemo/driver-babel': '^1.0.0',
},
});
Once all packages have been defined, we can generate a graph using these Graph
methods:
resolveList
- Returns an array of packages in order of most depended on.resolveBatchList
- Like the previous, but returns the array batched based on depth.resolveTree
- Returns a tree of nodes based on the graph.// List of packages
graph.resolveList().forEach((pkg) => {
console.log(pkg.name);
});
// List of list of packages
graph.resolveBatchList().forEach((pkgs) => {
pkgs.forEach((pkg) => {
console.log(pkg.name);
});
});
// Tree of nodes
graph.resolveTree().nodes.forEach((node) => {
console.log(node.package.name);
if (node.nodes) {
// Dependents
}
});
Will only resolve and return packages that have been defined. Will not return non-defined packages found in
dependencies
andpeerDependencies
.
FAQs
Generate a dependency graph for a list of packages, based on their defined `dependencies` and `peerDependencies`.
We found that @beemo/dependency-graph demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.