Skip to content

Commit d51c1fa

Browse files
committed
1.0.0
- does not load all content from a single endpoint - adds a repo endpoints that gives a list of all unique repo urls - coverage list component now allows for pagination and search - adds syntax highlighting to file view - adds pagination to builds - fixes bug with badges that only shows one color - fixes data integrity gathering the CLI - creates a single point of entry rather than having lcov-server and lcov-server-cli it is now just lcov-server - to upload simply use lcov-server --upload {url} - to start a server simply use lcov-server --serve - coverage chart can now be filtered by branch name - fixes commitUrl being incorrectly formed on the coverage page
1 parent 8b29d67 commit d51c1fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1087
-625
lines changed

.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["es2015", "react"]
2+
"presets": ["env", "react"]
33
}

.storybook/.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["es2015", "react"]
2+
"presets": ["env", "react"]
33
}

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ script:
66
- npm install lcov-server -g
77
- npm test
88
- npm run coverage
9-
- cat coverage/lcov.info | lcov-server-cli --url https://lcov-server.herokuapp.com
9+
- cat coverage/lcov.info | lcov-server --upload https://lcov-server.herokuapp.com
1010
node_js:
1111
- "6"
1212
- "8"

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# 1.0.0 (10/14/2017)
2+
3+
- does not load all content from a single endpoint
4+
- adds a repo endpoints that gives a list of all unique repo urls
5+
- coverage list component now allows for pagination and search
6+
- adds syntax highlighting to file view
7+
- adds pagination to builds
8+
- fixes bug with badges that only shows one color
9+
- fixes data integrity gathering the CLI
10+
- creates a single point of entry rather than having lcov-server and lcov-server-cli it is now just lcov-server
11+
- to upload simply use `lcov-server --upload {url}`
12+
- to start a server simply use `lcov-server --serve`
13+
- coverage chart can now be filtered by branch name
14+
- fixes commitUrl being incorrectly formed on the coverage page
15+
116
# 0.1.1 (09/28/2017)
217

318
- updates react@16 and reduces bundle size from 343 KB to 313 KB

README.md

+24-25
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,21 @@
1010
[![npm](https://img.shields.io/npm/dt/lcov-server.svg)]()
1111
[![npm](https://img.shields.io/npm/dm/lcov-server.svg)]()
1212

13+
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
14+
15+
- [lcov-server](#lcov-server)
16+
- [What is this?](#what-is-this)
17+
- [Prerequisites](#prerequisites)
18+
- [Install](#install)
19+
- [Usage](#usage)
20+
- [Upload](#upload)
21+
- [Server](#server)
22+
23+
<!-- /TOC -->
24+
1325
# What is this?
1426

15-
It is a lcov server! It stores lcov reports and categorizes them based on their origin repo.
27+
It's a lcov server! It stores lcov reports and categorizes them based on their origin repo.
1628

1729
# Prerequisites
1830

@@ -27,40 +39,27 @@ npm install lcov-server -g
2739

2840
# Usage
2941

30-
> cli
31-
32-
```
33-
tap test --coverage-report=text-lcov | lcov-server-cli
3442
```
43+
Usage: lcov-server [options]
3544
36-
> cli:help
3745
38-
```
39-
Usage: lcov-server-cli [options]
46+
Options:
4047
41-
42-
Options:
43-
44-
-V, --version output the version number
45-
-u, --url [server] Set the url to upload lcov data too
46-
-h, --help output usage information
48+
-V, --version output the version number
49+
-u, --upload [server] Set the url to upload lcov data too
50+
-s, --serve Pass this option to startup a lcov-server instance
51+
-d, --db [db] Set the db connection
52+
-h, --help output usage information
4753
```
4854

49-
> server
55+
## Upload
5056

5157
```
52-
lcov-server
58+
tap test --coverage-report=text-lcov | lcov-server --upload http://...
5359
```
5460

55-
> server:help
61+
## Server
5662

5763
```
58-
Usage: lcov-server [options]
59-
60-
61-
Options:
62-
63-
-V, --version output the version number
64-
-d, --db [db] Set the db connection
65-
-h, --help output usage information
64+
lcov-server --serve --db mongodb://localhost:32768/lcov-server
6665
```

bin/lcov-server-cli.js

-106
This file was deleted.

bin/lcov-server.js

+100-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,115 @@
11
#!/usr/bin/env node
22

33
const program = require('commander');
4+
const http = require('http');
5+
const https = require('https');
6+
const fs = require('fs');
7+
const Url = require('url');
48
const updateNotifier = require('update-notifier');
59

10+
const lcov = require('../lib/lcov');
11+
const git = require('../lib/git');
12+
const ci = require('../lib/ci');
13+
614
const pkg = require('../package.json');
715

816
updateNotifier({pkg}).notify();
917

1018
program
1119
.version(pkg.version)
20+
.option('-u, --upload [server]', 'Set the url to upload lcov data too', 'http://localhost:8080')
21+
.option('-s, --serve', 'Pass this option to startup a lcov-server instance')
1222
.option('-d, --db [db]', 'Set the db connection', 'mongodb://localhost:32768/lcov-server')
1323
.parse(process.argv);
1424

15-
process.env.MONGO_URL = process.env.MONGO_URL || program.db;
25+
const { upload, serve, db } = program;
26+
27+
if(serve) {
28+
process.env.MONGO_URL = process.env.MONGO_URL || db;
29+
30+
require('../index');
31+
} else {
32+
const parsedUrl = Url.parse(upload);
33+
34+
let input = '';
35+
process.stdin.resume();
36+
process.stdin.setEncoding('utf8');
37+
process.stdin.on('data', (chunk) => {
38+
input += chunk;
39+
});
40+
process.stdin.on('end', () => {
41+
const env = ci();
42+
const output = {
43+
service_job_id: env.service_job_id,
44+
service_pull_request: env.service_pull_request,
45+
service_name: env.service_name,
46+
source_files: [],
47+
git: {
48+
commit: env.commit,
49+
branch: env.branch,
50+
message: env.message,
51+
committer_name: env.committer_name,
52+
committer_email: env.committer_email
53+
},
54+
run_at: new Date()
55+
};
56+
57+
lcov.parse(input)
58+
.then((_lcov) => {
59+
// Go through and set the file contents
60+
for (let i = 0; i < _lcov.length; i++) {
61+
_lcov[i].source = fs.readFileSync(_lcov[i].file).toString('utf8');
62+
_lcov[i].title = _lcov[i].file.substring(_lcov[i].file.lastIndexOf('/') + 1, _lcov[i].file.length);
63+
}
64+
output['source_files'] = _lcov;
65+
66+
git.parse()
67+
.then(function(_git) {
68+
output['git'] = Object.assign(output['git'], _git);
1669

17-
require('../index');
70+
const options = {
71+
hostname: parsedUrl.hostname,
72+
port: parsedUrl.port || 80,
73+
path: '/api/upload',
74+
method: 'POST',
75+
headers: {
76+
'Content-Type': 'application/json',
77+
}
78+
};
79+
let req, operation, data = '';
80+
if(parsedUrl.protocol == 'https') {
81+
operation = https;
82+
} else {
83+
operation = http;
84+
}
85+
req = operation.request(options, (res) => {
86+
res.on('data', (chunk) => {
87+
data += chunk;
88+
});
89+
res.on('end', () => {
90+
try {
91+
const response = JSON.parse(data);
92+
if(response.error) {
93+
console.error(response.error); // eslint-disable-line
94+
} else {
95+
console.log(`\n coverage sent successfully 💚 \n`); // eslint-disable-line
96+
}
97+
} catch(ex) {
98+
console.log(`\n uhoh something went wrong, ${ex.toString()}`); // eslint-disable-line
99+
}
100+
});
101+
});
102+
req.write(JSON.stringify(output));
103+
req.end();
104+
})
105+
.catch((err) => {
106+
console.log(err); // eslint-disable-line
107+
process.exit(1);
108+
});
109+
})
110+
.catch((err) => {
111+
console.log(`could not parse lcov report correctly: ${err}`); // eslint-disable-line
112+
process.exit(1);
113+
});
114+
});
115+
}

dist/build.js

-1
This file was deleted.

dist/bundle.js

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
</head>
77
<body>
88
<div id="root"></div>
9-
<script src="/build.js"></script>
9+
10+
<script src="/vendor.bundle.js"></script>
11+
<script src="/bundle.js"></script>
1012
</body>
1113
</html>

0 commit comments

Comments
 (0)