forked from unmeshjoshi/nodewebmodules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_module.js
23 lines (20 loc) · 844 Bytes
/
build_module.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var moment = require('moment')
, url = require('url')
;
module.exports = function(gh, npm) {
var data = {};
data["name"] = npm.name;
data["description"] = gh.description;
data["version"] = npm.version;
data["engine"] = npm.engines && npm.engines.node || '';
data["created_at"] = moment(gh.created_at).fromNow();
data["author"] = npm.name !== "meteor" ? (npm.author && npm.author.name || npm._npmUser.name) : '';
data["forks"] = gh.forks_count;
data["watchers"] = gh.watchers;
data["issues"] = gh.open_issues;
data["install"] = npm.name !== "meteor" ? ("npm install " + npm.name) : "curl https://install.meteor.com | /bin/sh";
data["gh_url"] = gh.html_url;
data["npm_url"] = npm.name !== "meteor" && ("https://npmjs.org/package/" + npm.name);
data["site"] = gh.homepage && url.resolve('http://', gh.homepage);
return data;
};