UNPKG

826 BJavaScriptView Raw
1const exec = require('mz/child_process').exec;
2
3const commit = exec('git rev-list --all --count').then((stdout) => parseInt(stdout.join('').toString()));
4const date = exec('git log -1 --format=%at').then((stdout) => parseInt(stdout.join('').toString()));
5const branch = exec('git rev-parse --abbrev-ref HEAD').then((stdout) => stdout.join('').toString().trim());
6const repo = exec('git config remote.origin.url').then((stdout) => {
7 const data = stdout.join('').toString().split('/');
8 let repo = data[data.length - 1].trim();
9 const remove = '.git';
10 if (repo.toLowerCase().endsWith(remove)) {
11 repo = repo.substr(0, repo.length - remove.length);
12 }
13 return repo;
14});
15
16const settings = {
17 "branch": branch,
18 "date": date,
19 "commit": commit,
20 "repo": repo
21};
22
23
24module.exports = settings;
25