-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-release-data.js
48 lines (40 loc) · 1.19 KB
/
generate-release-data.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Generates a JSON data file for Harp that contains the issues resolved for a
* given milestone. Required variables are the milestone number and output dir.
*/
var GitHub = require('github');
var FileSystem = require('fs');
var milestone = 3; // Use the milestone number from github.com/dynjs/dynjs/issues/milestones
var outputDir = 'v0_3_0'; // The version number. Assumes a prefix of public/releases
var baseDir = '_harp/public/releases';
var releaseDir = [baseDir, outputDir].join('/');
var dataFile = [baseDir, outputDir, '_data.json'].join('/');
checkDir();
var github = new GitHub({
version: "3.0.0",
debug: true
});
github.issues.repoIssues({
user: "dynjs",
repo: "dynjs",
milestone: milestone,
state: "closed"
}, function(err, data) {
if (err) {
console.log("There was an error fetching the issues");
} else {
writeData(data);
}
});
function writeData(data) {
FileSystem.writeFile(dataFile, JSON.stringify({issues: data}));
console.log(data);
}
function checkDir() {
FileSystem.exists(releaseDir, function(exists) {
if (!exists) {
console.log(releaseDir + " does not exist. Creating it.");
FileSystem.mkdirSync(releaseDir);
}
});
}