@escover/formatter-responsive 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/calculator.js +16 -0
- package/lib/responsive.js +16 -9
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const calculate = (columns) => {
|
|
2
|
+
const totalWidth = columns || 80;
|
|
3
|
+
const showPercent = totalWidth >= 70;
|
|
4
|
+
|
|
5
|
+
const linesColWidth = Math.floor(totalWidth / 2);
|
|
6
|
+
const percentColWidth = showPercent ? 7 : 0;
|
|
7
|
+
|
|
8
|
+
const fileColWidth = Math.max(10, totalWidth - linesColWidth - percentColWidth - 6 - 4);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
showPercent,
|
|
12
|
+
linesColWidth,
|
|
13
|
+
percentColWidth,
|
|
14
|
+
fileColWidth,
|
|
15
|
+
};
|
|
16
|
+
};
|
package/lib/responsive.js
CHANGED
|
@@ -4,23 +4,30 @@ import {
|
|
|
4
4
|
getBorderCharacters,
|
|
5
5
|
} from 'table';
|
|
6
6
|
import {buildGroupedTable} from './build-grouped-table.js';
|
|
7
|
+
import {calculate} from './calculator.js';
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
+
const {cwd, stdout} = process;
|
|
10
|
+
const CWD = cwd();
|
|
9
11
|
const {entries, keys} = Object;
|
|
10
12
|
|
|
11
|
-
export default (coverageFile,
|
|
13
|
+
export default (coverageFile, overrides = {}) => {
|
|
14
|
+
const {
|
|
15
|
+
skipFull = false,
|
|
16
|
+
columns = stdout.columns,
|
|
17
|
+
} = overrides;
|
|
18
|
+
|
|
12
19
|
const files = parseCoverageFile(coverageFile, skipFull);
|
|
13
20
|
|
|
14
21
|
if (skipFull && !files.length)
|
|
15
|
-
return '💪 coverage 100
|
|
16
|
-
|
|
17
|
-
const totalWidth = process.stdout.columns || 80;
|
|
18
|
-
const showPercent = totalWidth >= 70;
|
|
22
|
+
return '💪 coverage 100%, good job!\n';
|
|
19
23
|
|
|
20
|
-
const
|
|
21
|
-
|
|
24
|
+
const {
|
|
25
|
+
showPercent,
|
|
26
|
+
linesColWidth,
|
|
27
|
+
percentColWidth,
|
|
28
|
+
fileColWidth,
|
|
29
|
+
} = calculate(columns);
|
|
22
30
|
|
|
23
|
-
const fileColWidth = Math.max(10, totalWidth - linesColWidth - percentColWidth - 6 - 4);
|
|
24
31
|
const tableData = buildGroupedTable({
|
|
25
32
|
files,
|
|
26
33
|
showPercent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@escover/formatter-responsive",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "Istanbul converter",
|
|
6
6
|
"exports": "./lib/responsive.js",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"test": "madrun test",
|
|
22
22
|
"coverage": "madrun coverage",
|
|
23
|
+
"coverage:c8": "madrun coverage:c8",
|
|
23
24
|
"lint": "madrun lint",
|
|
24
25
|
"fresh:lint": "madrun fresh:lint",
|
|
25
26
|
"lint:fresh": "madrun lint:fresh",
|
|
@@ -28,8 +29,7 @@
|
|
|
28
29
|
"watcher": "madrun watcher",
|
|
29
30
|
"watch:test": "madrun watch:test",
|
|
30
31
|
"watch:lint": "madrun watch:lint",
|
|
31
|
-
"watch:tape": "madrun watch:tape"
|
|
32
|
-
"prewisdom": "madrun prewisdom"
|
|
32
|
+
"watch:tape": "madrun watch:tape"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"chalk": "^5.0.0",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@putout/eslint-flat": "^4.0.0",
|
|
53
53
|
"@putout/test": "^15.1.1",
|
|
54
|
-
"c8": "^11.0.0",
|
|
55
54
|
"escover": "^6.2.9",
|
|
56
55
|
"eslint": "^10.0.0",
|
|
57
56
|
"eslint-plugin-putout": "^31.0.0",
|
|
58
57
|
"madrun": "^13.0.0",
|
|
58
|
+
"superc8": "^12.7.0",
|
|
59
59
|
"supertape": "^13.1.1"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|