
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
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.
It is used by platforms like DoltHub to visualize database commit log histories.
Explore the demo for sample commit data and real GitHub repository graphs.
CommitGraph.WithInfiniteScroll
dynamically loads new content as users scroll through large commit histories.getDiff
function is provided, clicking a commit will display additional file change stats, including additions, deletions, and file modifications.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,
}}
getDiff={async (base, head) => {
// Your implementation to fetch diff stats
return {
files: [
{
filename: "example.txt",
status: "modified",
additions: 10,
deletions: 2,
},
],
};
}}
/>
);
};
export default MyComponent;
CommitGraph.WithInfiniteScroll
For large commit histories requiring infinite scroll:
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;
commits (array): An array of Commit
objects representing the commit history.
branchHeads (array): An array of Branch
objects representing the branch heads.
getDiff (function, optional): A function that returns a Promise
resolving to a Diff
object. Fetches file changes for clicked commits.
currentBranch (string, optional): The name of the current branch.
fullSha (boolean, optional): Displays the full SHA of a commit instead of the shortened SHA.
onCommitClick (function, optional): Function to be called when a commit is clicked, receiving the clicked commit as an argument.
dateFormatFn (function, optional): Formats the commit dates. Accepts a string, number, or Date and returns a formatted 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}
/>
);
};
const graphStyle = {
commitSpacing: 60,
branchSpacing: 20,
nodeRadius: 2,
branchColors: ["#FF0000", "#00FF00", "#0000FF"],
};
loadMore (function): Function to load more commits as the user scrolls.
hasMore (boolean): Boolean flag indicating whether more commits are available to load.
Commit
TypeRepresents individual commits:
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)
};
Branch
TypeDefines repository branches, each associated with a 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)
};
Diff
TypeRepresents changes between two commits:
export type Diff = {
files: ChangedItem[];
};
ChangedItem
TypeDetails of files changed between commits:
export type ChangedItem = {
filename: string;
status: string; // "added", "modified", or "deleted"
additions: number;
deletions: number;
patch?: string; // Optional patch data for the changes
blob_url?: string; // Optional URL to the file blob
};
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 commit-graph receives a total of 434 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.