
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@dreamcatcher-tech/commit-graph
Advanced tools
The Commit Graph package is a React component suite designed to visualize commit graphs in an interactive and informative way. It showcases commit history within a repository with support for infinite scroll loading. See this post for the implementation details.
CommitGraph
is utilized by platforms like DoltHub to visualize database commit log histories.
The demo features sample commit data and real GitHub repository graphs.
CommitGraph.WithInfiniteScroll
enhances the user experience for large commit histories by dynamically loading new content as users scroll.npm install commit-graph
For a basic implementation without infinite scroll:
import React from "react";
import { CommitGraph } from "commit-graph";
const MyComponent = () => {
const commits = [
// Commits data according to the new Commit type
];
const branchHeads = [
// Branch heads data according to the new Branch type
];
return (
<CommitGraph
commits={commits}
branchHeads={branchHeads}
graphStyle={{
commitSpacing: 50,
branchSpacing: 20,
branchColors: ["#FF0000", "#00FF00", "#0000FF"],
nodeRadius: 2,
}}
/>
);
};
export default MyComponent;
For implementations requiring infinite scroll to handle large commit histories:
import React from "react";
import { CommitGraph } from "commit-graph";
const MyComponent = () => {
// Your commit and branch head data, loadMore function, and hasMore flag
return (
<CommitGraph.WithInfiniteScroll
commits={/* Your commits data */}
branchHeads={/* Your branch heads data */}
loadMore={/* Your loadMore function */}
hasMore={/* hasMore flag */}
/>
);
};
export default MyComponent;
Commit
objects representing the commit history.Branch
objects representing the branch heads in the commit-graph.These type definitions should be used to structure the data passed to the commits and branchHeads props of both CommitGraph and CommitGraph.WithInfiniteScroll components, ensuring proper visualization of commit history and branch information.
Commit
TypeThe Commit
type represents individual commits in the commit history. Each Commit
object should conform to the following structure:
type ParentCommit = {
sha: string;
};
export type Commit = {
sha: string;
commit: {
author: {
name: string; // The name of the commit author
date: string | number | Date; // The date of the commit
email?: string; // The email of the commit author (optional)
};
message: string; // The commit message
};
parents: ParentCommit[]; // An array of parent commits
html_url?: string; // The URL to view the commit (optional)
};
This type definition includes the commit's SHA, author information, commit message, an array of parent commits, and an optional URL to the commit.
Branch
TypeThe Branch
type defines the structure for branches in the repository, each associated with a particular commit:
export type Branch = {
name: string; // The name of the branch
commit: {
sha: string; // The SHA of the latest commit on the branch
};
link?: string; // A URL to the branch on GitHub (optional)
};
Each Branch object should include the branch's name, the SHA of the latest commit on the branch, and an optional link to the branch.
graphStyle
(object, optional)An optional object specifying the styling options for the commit-graph. The graphStyle
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.dateFormatFn
(function, optional)An optional function to format commit dates. Takes a Date, number, or string as input and returns a string.
dateFormatFn?: (d: string | number | Date) => string;
example:
const customDateTimeFormatFn = (d: string | number | Date): string => {
return new Date(d).toLocaleString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
});
};
const MyComponent = () => {
// Your commit and branch head data, loadMore function, and hasMore flag
return (
<CommitGraph.WithInfiniteScroll
commits={/* Your commits data */}
branchHeads={/* Your branch heads data */}
loadMore={/* Your loadMore function */}
hasMore={/* hasMore flag */}
dateFormatFn={customDateTimeFormatFn}
/>
);
};
currentBranch
(string, optional)The name of the current branch.
fullSha
(boolean, optional)Instead of the default shortened SHA, display the full SHA of the commit.
Explore the Commit Graph component and its features by running storybook:
npm run storybook
FAQs
A React component to visualize a commit graph.
The npm package @dreamcatcher-tech/commit-graph receives a total of 1 weekly downloads. As such, @dreamcatcher-tech/commit-graph popularity was classified as not popular.
We found that @dreamcatcher-tech/commit-graph demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.