![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@gitgraph/js
Advanced tools
Readme
@gitgraph/js
Draw pretty git graphs with vanilla JS.
This is the vanilla JS rendering library of GitGraph.js.
You have 2 options:
Get the bundle from one of the following sources:
Create an index.html
file and start coding:
<!DOCTYPE html>
<html>
<head>
<!-- Load the JS file -->
<script src="https://cdn.jsdelivr.net/npm/@gitgraph/js"></script>
</head>
<body>
<!-- DOM element in which we'll mount our graph -->
<div id="graph-container"></div>
<!-- Use the `GitgraphJS` global variable to create your graph -->
<script>
// Get the graph container HTML element.
const graphContainer = document.getElementById("graph-container");
// Instantiate the graph.
const gitgraph = GitgraphJS.createGitgraph(graphContainer);
// Simulate git commands with Gitgraph API.
const master = gitgraph.branch("master");
master.commit("Initial commit");
const develop = gitgraph.branch("develop");
develop.commit("Add TypeScript");
const aFeature = gitgraph.branch("a-feature");
aFeature
.commit("Make it work")
.commit("Make it right")
.commit("Make it fast");
develop.merge(aFeature);
develop.commit("Prepare v1");
master.merge(develop).tag("v1.0.0");
</script>
</body>
</html>
Serve your files—with npm, you can run npx serve .
You should see the following graph:
You need to have npm installed.
Create a new folder for your project and go there: mkdir your-project && cd your-project
Initialize your npm project: npm init -y
Install the package with npm: npm i --save @gitgraph/js
Install Parcel bundler: npm i --save-dev parcel-bundler
Now you can use createGitgraph
to render your graph in a DOM element:
Create an index.html
file:
<!DOCTYPE html>
<html>
<head>
<!-- … -->
</head>
<body>
<!-- DOM element in which we'll mount our graph -->
<div id="graph-container"></div>
<!-- This is for ParcelJS bundler -->
<script src="./index.js"></script>
</body>
</html>
Create an index.js
file:
import { createGitgraph } from "@gitgraph/js";
// Get the graph container HTML element.
const graphContainer = document.getElementById("graph-container");
// Instantiate the graph.
const gitgraph = createGitgraph(graphContainer);
// Simulate git commands with Gitgraph API.
const master = gitgraph.branch("master");
master.commit("Initial commit");
const develop = gitgraph.branch("develop");
develop.commit("Add TypeScript");
const aFeature = gitgraph.branch("a-feature");
aFeature
.commit("Make it work")
.commit("Make it right")
.commit("Make it fast");
develop.merge(aFeature);
develop.commit("Prepare v1");
master.merge(develop).tag("v1.0.0");
Add start command in your package.json
:
{
"name": "your-project",
"version": "1.0.0",
"scripts": {
+ "start": "parcel index.html"
}
Run npm start
. You should see the following graph:
A bunch of scenarios has been simulated in our Storybook. Give them a look 👀
gitgraph.js
packageHere's a guide to help you migrate to @gitgraph/js
.
FAQs
Draw pretty git graphs in the browser
The npm package @gitgraph/js receives a total of 450 weekly downloads. As such, @gitgraph/js popularity was classified as not popular.
We found that @gitgraph/js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.