Skip to content

Commit d7d08f0

Browse files
authored
Merge pull request #322 from rtfpessoa/update-codacy-coverage
Update codacy coverage and bump dependencies
2 parents c3a037b + 1844fed commit d7d08f0

File tree

9 files changed

+2054
-2167
lines changed

9 files changed

+2054
-2167
lines changed

.circleci/config.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,12 @@ jobs:
4646
yarn -v
4747
- run:
4848
name: Install dependencies
49-
command: yarn
49+
command: yarn install --ignore-engines
5050
- save_cache:
5151
key: yarn-cache-{{ checksum "yarn.lock" }}
5252
paths:
5353
- /usr/local/share/.cache/yarn
54-
- run: yarn run validate
55-
- store_artifacts:
56-
path: coverage
57-
- store_test_results:
58-
path: coverage
54+
- run: yarn run build:templates && yarn run build
5955

6056
build-latest: &latest-build
6157
docker:
@@ -90,11 +86,6 @@ jobs:
9086
- '*'
9187

9288
build-node-10:
93-
<<: *common-build
94-
docker:
95-
- image: node:10
96-
97-
build-node-11:
9889
<<: *common-build
9990
docker:
10091
- image: node:11
@@ -104,14 +95,14 @@ jobs:
10495
docker:
10596
- image: node:12
10697

107-
build-node-13:
98+
build-node-14:
10899
<<: *latest-build
109100
docker:
110-
- image: node:13
101+
- image: node:14
111102

112103
tag_version:
113104
docker:
114-
- image: node:13
105+
- image: node:14
115106
working_directory: ~/workdir
116107
steps:
117108
- attach_workspace:
@@ -129,7 +120,7 @@ jobs:
129120
130121
publish_library:
131122
docker:
132-
- image: node:13
123+
- image: node:14
133124
working_directory: ~/workdir
134125
steps:
135126
- attach_workspace:
@@ -203,22 +194,18 @@ workflows:
203194
- build-node-10:
204195
requires:
205196
- checkout-and-version
206-
- build-node-11:
207-
requires:
208-
- checkout-and-version
209197
- build-node-12:
210198
requires:
211199
- checkout-and-version
212-
- build-node-13:
200+
- build-node-14:
213201
requires:
214202
- checkout-and-version
215203
- publish_approval:
216204
type: approval
217205
requires:
218206
- build-node-10
219-
- build-node-11
220207
- build-node-12
221-
- build-node-13
208+
- build-node-14
222209
- tag_version:
223210
requires:
224211
- publish_approval

package.json

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"url": "https://www.github.com/rtfpessoa/diff2html/issues"
3333
},
3434
"engines": {
35-
"node": ">=10.13"
35+
"node": ">=10"
3636
},
3737
"scripts": {
3838
"eslint": "eslint --ignore-path .gitignore \"**/*.{js,jsx,ts,tsx,json}\"",
@@ -56,7 +56,7 @@
5656
"test:watch": "jest --watch",
5757
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
5858
"coverage:open": "yarn run test:coverage && open ./coverage/index.html",
59-
"coverage:push": "cat ./coverage/lcov.info | codacy-coverage",
59+
"coverage:push": "curl -Ls https://coverage.codacy.com/get.sh | bash",
6060
"validate": "yarn run build:templates && yarn run format:check && yarn run lint:check && yarn run build && yarn run test:coverage",
6161
"fix": "yarn run format:fix && yarn run lint:fix",
6262
"start": "yarn run start:website",
@@ -89,7 +89,7 @@
8989
"hogan.js": "3.0.2"
9090
},
9191
"optionalDependencies": {
92-
"highlight.js": "9.18.1"
92+
"highlight.js": "10.0.2"
9393
},
9494
"devDependencies": {
9595
"@types/clipboard": "2.0.1",
@@ -98,57 +98,56 @@
9898
"@types/highlight.js": "9.12.3",
9999
"@types/hogan.js": "3.0.0",
100100
"@types/html-webpack-plugin": "3.2.2",
101-
"@types/jest": "25.1.4",
101+
"@types/jest": "25.2.1",
102102
"@types/mini-css-extract-plugin": "0.9.1",
103103
"@types/mkdirp": "1.0.0",
104-
"@types/node": "13.9.1",
104+
"@types/node": "13.13.5",
105105
"@types/nopt": "3.0.29",
106-
"@types/webpack": "4.41.7",
107-
"@typescript-eslint/eslint-plugin": "2.23.0",
108-
"@typescript-eslint/parser": "2.23.0",
109-
"autoprefixer": "9.7.4",
106+
"@types/webpack": "4.41.12",
107+
"@typescript-eslint/eslint-plugin": "2.31.0",
108+
"@typescript-eslint/parser": "2.31.0",
109+
"autoprefixer": "9.7.6",
110110
"bulma": "^0.8.0",
111111
"clipboard": "2.0.6",
112-
"codacy-coverage": "3.4.0",
113112
"copy-webpack-plugin": "5.1.1",
114-
"css-loader": "3.4.2",
113+
"css-loader": "3.5.3",
115114
"cssnano": "4.1.10",
116-
"eslint": "6.8.0",
117-
"eslint-config-prettier": "6.10.0",
118-
"eslint-plugin-import": "2.20.1",
119-
"eslint-plugin-jest": "23.8.2",
120-
"eslint-plugin-json": "2.1.0",
121-
"eslint-plugin-node": "11.0.0",
122-
"eslint-plugin-optimize-regex": "1.1.7",
115+
"eslint": "7.0.0",
116+
"eslint-config-prettier": "6.11.0",
117+
"eslint-plugin-import": "2.20.2",
118+
"eslint-plugin-jest": "23.10.0",
119+
"eslint-plugin-json": "2.1.1",
120+
"eslint-plugin-node": "11.1.0",
121+
"eslint-plugin-optimize-regex": "1.2.0",
123122
"eslint-plugin-promise": "4.2.1",
124123
"eslint-plugin-sonarjs": "0.5.0",
125-
"file-loader": "5.1.0",
126-
"handlebars": "4.7.3",
124+
"file-loader": "6.0.0",
125+
"handlebars": "4.7.6",
127126
"handlebars-loader": "1.7.1",
128-
"html-webpack-plugin": "3.2.0",
129-
"husky": "4.2.3",
127+
"html-webpack-plugin": "4.3.0",
128+
"husky": "4.2.5",
130129
"image-webpack-loader": "6.0.0",
131130
"is-ci-cli": "2.0.0",
132-
"jest": "25.1.0",
133-
"lint-staged": "10.0.8",
131+
"jest": "26.0.1",
132+
"lint-staged": "10.2.2",
134133
"markdown-toc": "^1.2.0",
135134
"mini-css-extract-plugin": "0.9.0",
136-
"mkdirp": "1.0.3",
135+
"mkdirp": "1.0.4",
137136
"nopt": "4.0.3",
138-
"postcss": "7.0.27",
139-
"postcss-cli": "7.1.0",
137+
"postcss": "7.0.29",
138+
"postcss-cli": "7.1.1",
140139
"postcss-import": "12.0.1",
141140
"postcss-loader": "3.0.0",
142141
"postcss-preset-env": "6.7.0",
143-
"prettier": "1.19.1",
144-
"ts-jest": "25.2.1",
145-
"ts-loader": "6.2.1",
146-
"ts-node": "8.6.2",
142+
"prettier": "2.0.5",
143+
"ts-jest": "25.5.1",
144+
"ts-loader": "7.0.3",
145+
"ts-node": "8.10.1",
147146
"typescript": "3.8.3",
148-
"url-loader": "3.0.0",
149-
"webpack": "4.42.0",
147+
"url-loader": "4.1.0",
148+
"webpack": "4.43.0",
150149
"webpack-cli": "3.3.11",
151-
"webpack-dev-server": "3.10.3",
150+
"webpack-dev-server": "3.11.0",
152151
"whatwg-fetch": "3.0.0"
153152
},
154153
"resolutions": {

src/render-utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,7 @@ export function filenameDiff(file: DiffFileName): string {
186186
* Generates a unique string numerical identifier based on the names of the file diff
187187
*/
188188
export function getHtmlId(file: DiffFileName): string {
189-
return `d2h-${hashCode(filenameDiff(file))
190-
.toString()
191-
.slice(-6)}`;
189+
return `d2h-${hashCode(filenameDiff(file)).toString().slice(-6)}`;
192190
}
193191

194192
/**

src/ui/js/diff2html-ui-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as HighlightJS from 'highlight.js/lib/highlight.js';
1+
import * as HighlightJS from 'highlight.js/lib/core';
22
import { ICompiledMode, IHighlightResult, IAutoHighlightResult } from 'highlight.js';
33
import { nodeStream, mergeStreams } from './highlight.js-helpers';
44

src/ui/js/highlight.js-helpers.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55

66
/* Utility functions */
77

8-
function escape(value: string): string {
9-
return value
10-
.replace(/&/gm, '&amp;')
11-
.replace(/</gm, '&lt;')
12-
.replace(/>/gm, '&gt;');
8+
function escapeHTML(value: string): string {
9+
return value.replace(/&/gm, '&amp;').replace(/</gm, '&lt;').replace(/>/gm, '&gt;');
1310
}
1411

1512
function tag(node: Node): string {
@@ -97,7 +94,7 @@ export function mergeStreams(original: NodeEvent[], highlighted: NodeEvent[], va
9794
}
9895

9996
result += `<${tag(node)} ${Array<Attr>()
100-
.map.call(node.attributes, attr => `${attr.nodeName}="${escape(attr.value)}"`)
97+
.map.call(node.attributes, attr => `${attr.nodeName}="${escapeHTML(attr.value).replace(/"/g, '&quot;')}"`)
10198
.join(' ')}>`;
10299
}
103100

@@ -111,7 +108,7 @@ export function mergeStreams(original: NodeEvent[], highlighted: NodeEvent[], va
111108

112109
while (original.length || highlighted.length) {
113110
let stream = selectStream();
114-
result += escape(value.substring(processed, stream[0].offset));
111+
result += escapeHTML(value.substring(processed, stream[0].offset));
115112
processed = stream[0].offset;
116113
if (stream === original) {
117114
/*
@@ -135,5 +132,6 @@ export function mergeStreams(original: NodeEvent[], highlighted: NodeEvent[], va
135132
render(stream.splice(0, 1)[0]);
136133
}
137134
}
138-
return result + escape(value.substr(processed));
135+
136+
return result + escapeHTML(value.substr(processed));
139137
}

0 commit comments

Comments
 (0)