mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2024-12-22 05:12:11 +01:00
1.2 KiB
1.2 KiB
Migration
This document contains information about how to smoothly migrate the things from a version to another version.
1.x.x
to 2.x.x
The big change is the the data schema -- which should be migrated.
The old ~/.git-stats
format was:
{
"<date>": {
"<remote-url>": {
"<hash>": "<date>"
}
}
}
In the new version, the remote url is not mandatory anymore. The new format is:
{
"commits": {
"<date>": {
"<hash>": 1
}
}
}
This is supposed to change when users install the 2.x.x
versions. However, if
the migration script fails, you can always run it manually:
./scripts/migration/2.0.0.js
This will modify the ~/.git-stats
file.
When using git-stats
as library, things changed too. The old way was:
var GitStats = require("git-stats");
GitStats.ansiCalendar(opts, fn);
In 2.x.x
, GitStats
is a constructor. That allows us to create as many git-stats
instances we want.
var GitStats = require("git-stats");
// Provide a custom data path
var gs1 = new GitStats("path/to/some/data.json");
// Use the default (~/.git-stats)
var gs2 = new GitStats();