
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
commit-graph
Advanced tools
The Commit Graph package is a React component that allows you to visualize a commit graph based on provided commit and branch head data. It provides an interactive and informative representation of commit history within a repository.
You can install the Commit Graph package via npm:
npm install commit-graph
Import the CommitGraph component and use it in your React application as follows:
import React from "react";
import CommitGraph from "commit-graph";
const MyComponent = () => {
// Array of commit objects
// Example commit object:
const commits = [
{
hash: 'commit-hash',
ownerName: 'repository-owner',
repoName: 'repository-name',
committer:
{
displayName: 'committer-displayName',
}
message: 'commit-message',
parents: ['parent-commit-hash-1', 'parent-commit-hash-2'],
committedAt: timestamp,
commitLink: 'https://github.com/repository-owner/repository-name/main/commit-hash',
}
];
// Array of branch head objects
// Example branch head object:
const branchHeads = [
{
branchName: "branch-name-1",
headCommitHash: "commit-hash-1",
},
{
branchName: "branch-name-2",
headCommitHash: "commit-hash-2",
branchLink:"https://github.com/repository-owner/repository-name/main",
},
];
return (
<CommitGraph
commits={commits}
branchHeads={branchHeads}
style={{
commitSpacing: 50,
branchSpacing: 20,
branchColors: ["#FF0000", "#00FF00", "#0000FF"],
nodeRadius: 2,
}}
/>
);
};
export default MyComponent;
The CommitGraph
component accepts the following props:
commits
(array)An array of commit objects representing the commit history. Each commit object should have the following properties:
hash
(string): The unique hash identifier of the commit.ownerName
(string): The name of the repository owner.repoName
(string): The name of the repository.committer
(object): The person who made the commit, it has following properties:
username
(string)displayName
(string)emailAddress
(string)message
(string): The commit message.parents
(array of strings): An array of commit hashes representing the parent commits.committedAt
(timestamp): The timestamp when the commit was made.commitLink
(string, optional): the external link to the commit.branchHeads
(array)An array of branch head objects representing the branch heads in the commit graph. Each branch head object should have the following properties:
branchName
(string): The name of the branch.headCommitHash
(string): The commit hash at the head of the branch.branchLink
(string, optional): The link to the branch.style
(object, optional)An optional object specifying the styling options for the commit graph. The style
object should have the following properties:
commitSpacing
(number): The vertical spacing between commits.branchSpacing
(number): The horizontal spacing between branches.branchColors
(array of strings): An array of colors to be used for different branches. Default: ['#FF0000', '#00FF00', '#0000FF']
.nodeRadius
(number): The radius of the commit node circles.You can view the demo by running storybook:
npm run storybook
FAQs
A React component to visualize a commit graph.
The npm package commit-graph receives a total of 131 weekly downloads. As such, commit-graph popularity was classified as not popular.
We found that commit-graph demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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 browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.