Skip to content

Commit 712dbd2

Browse files
Merge pull request #14 from eugenezinovyev/cli
Introduced CLI package Unified lerna version instead of using independent versions Moved @lcov-viewer/rollup-copy from dependencies to devDependencies for istanbul report package Updated package version to 1.2.0
2 parents bd85d47 + 54930a1 commit 712dbd2

Some content is hidden

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

52 files changed

+539
-73
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ dist/
44
/packages/demo/*/coverage/
55
/packages/*/coverage/
66
/coverage/
7+
yarn-error.log

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"packages/*",
55
"packages/demo/*"
66
],
7-
"version": "independent",
7+
"version": "1.2.0",
88
"useWorkspaces": true
99
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lcov-viewer",
33
"description": "LCOV viewer",
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"author": "Eugene Zinovyev <eugene.zinovyev@gmail.com>",
66
"license": "MIT",
77
"private": true,

packages/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/jest-coverage

packages/app/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lcov-viewer/app",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"author": "Eugene Zinovyev <eugene.zinovyev@gmail.com>",
55
"main": "src/index.js",
66
"license": "MIT",
@@ -11,15 +11,14 @@
1111
"test": "../../node_modules/.bin/jest --colors --passWithNoTests"
1212
},
1313
"devDependencies": {
14-
"@lcov-viewer/istanbul-report": "^1.1.0",
14+
"@lcov-viewer/istanbul-report": "^1.2.0",
1515
"@testing-library/jest-dom": "^5.14.1",
1616
"@testing-library/preact": "^2.0.1",
1717
"copy-webpack-plugin": "^9.0.1"
1818
},
1919
"dependencies": {
20-
"@lcov-viewer/components": "^1.1.0",
21-
"@lcov-viewer/core": "^1.1.0",
22-
"lcov-parse": "^1.0.0",
20+
"@lcov-viewer/components": "^1.2.0",
21+
"@lcov-viewer/core": "^1.2.0",
2322
"preact": "^10.5.15",
2423
"preact-router": "^3.2.1",
2524
"react-dropzone": "^11.4.2"

packages/app/src/components/LcovImport/LcovImport.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { buildCoverageTree, clsx } from '@lcov-viewer/core';
1+
import { buildCoverage, buildCoverageTree, clsx } from '@lcov-viewer/core';
22
import { route } from 'preact-router';
33
import React, { useCallback, useState } from 'react';
44
import { useDropzone } from 'react-dropzone';
5-
import buildCoverage from '../../utils/buildCoverage';
65
import readLcov from '../../utils/readLcov';
76
import useCoverageDataControl from '../CoverageDataProvider/useCoverageDataControl';
87
import classes from './LcovImport.module.less';

packages/app/src/utils/readLcov.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import { source as parseLCOV } from 'lcov-parse';
1+
import { parseLCOV } from '@lcov-viewer/core';
22

33
const readLcov = (file) => new Promise((resolve, reject) => {
44
const date = new Date(file.lastModified || file.lastModifiedDate || new Date().getTime()).toString();
55
const reader = new FileReader();
6-
reader.onload = () => {
7-
const lcovContent = reader.result;
8-
parseLCOV(lcovContent, (error, data) => {
9-
if (error) {
10-
reject([error, 'Failed to parse file']);
11-
} else {
12-
resolve([date, data]);
13-
}
14-
});
6+
reader.onload = async () => {
7+
try {
8+
const data = await parseLCOV(reader.result);
9+
resolve([date, data]);
10+
} catch (error) {
11+
reject([error, 'Failed to parse file']);
12+
}
1513
};
1614
reader.onerror = () => reject([reader.error, 'Failed to read file']);
1715
reader.readAsText(file);

packages/cli/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/lib/

packages/cli/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License Copyright (c) 2021 Eugene Zinovyev <eugene.zinovyev@gmail.com>
2+
3+
Permission is hereby granted,
4+
free of charge, to any person obtaining a copy of this software and associated
5+
documentation files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use, copy, modify, merge,
7+
publish, distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to the
9+
following conditions:
10+
11+
The above copyright notice and this permission notice
12+
(including the next paragraph) shall be included in all copies or substantial
13+
portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

packages/cli/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
![build](https://github.com/eugenezinovyev/lcov-viewer/actions/workflows/main.yml/badge.svg)
2+
[![Known Vulnerabilities](https://snyk.io/test/github/eugenezinovyev/lcov-viewer/badge.svg?targetFile=packages%2Fcli%2Fpackage.json)](https://snyk.io/test/github/eugenezinovyev/lcov-viewer?targetFile=packages%2Fcli%2Fpackage.json)
3+
[![npm version](https://badge.fury.io/js/@lcov-viewer%2Fcli.svg)](https://www.npmjs.com/package/@lcov-viewer/cli)
4+
5+
# LCOV viewer CLI
6+
7+
CLI to convert coverage to grouped HTML report. Generates code coverage report grouped by directory.
8+
9+
## Installation
10+
11+
```
12+
npm install -g @lcov-viewer/cli
13+
yarn global add @lcov-viewer/cli
14+
```
15+
16+
## Usage
17+
```
18+
lcov-viewer lcov -o ./report-output-directory ./lcov.info
19+
```
20+
21+
# Other packages
22+
An Istanbul report package: [@lcov-viewer/istanbul-report](https://www.npmjs.com/package/@lcov-viewer/istanbul-report)
23+
24+
25+
## Demo
26+
![report](https://user-images.githubusercontent.com/1678896/160290486-4474bd0a-c3e5-4e0e-90dc-6ac72a1e76f7.gif)

0 commit comments

Comments
 (0)