@hexonet/semantic-release-whmcs 3.0.2 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +13 -11
- package/.github/workflows/pull-request.yml +47 -0
- package/.github/workflows/push.yml +76 -0
- package/.releaserc.json +20 -23
- package/HISTORY.md +30 -0
- package/README.md +5 -5
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/coverage-final.json +11 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +131 -0
- package/coverage/lib/definitions/errors.js.html +136 -0
- package/coverage/lib/definitions/index.html +116 -0
- package/coverage/lib/delete-marketplace-version.js.html +400 -0
- package/coverage/lib/get-error.js.html +106 -0
- package/coverage/lib/get-github-releases.js.html +190 -0
- package/coverage/lib/index.html +236 -0
- package/coverage/lib/publish.js.html +490 -0
- package/coverage/lib/puppet.js.html +271 -0
- package/coverage/lib/resolve-config.js.html +112 -0
- package/coverage/lib/scrape-marketplace-versions.js.html +322 -0
- package/coverage/lib/set-compatible-versions.js.html +376 -0
- package/coverage/lib/verify.js.html +145 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/index.js +11 -9
- package/lib/definitions/errors.js +6 -3
- package/lib/delete-marketplace-version.js +7 -36
- package/lib/get-error.js +1 -1
- package/lib/get-github-releases.js +10 -8
- package/lib/publish.js +97 -105
- package/lib/puppet.js +62 -0
- package/lib/resolve-config.js +2 -2
- package/lib/scrape-marketplace-versions.js +5 -34
- package/lib/set-compatible-versions.js +6 -34
- package/package.json +20 -21
- package/whmcs.js +1 -2
- package/.github/workflows/release.yml +0 -56
- package/test/publish.test.js +0 -78
- package/test/verify.test.js +0 -54
package/.eslintrc.js
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
module.exports = {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
env: {
|
3
|
+
node: true,
|
4
|
+
},
|
5
|
+
parserOptions: {
|
6
|
+
ecmaVersion: 2020,
|
7
|
+
},
|
8
|
+
extends: [
|
9
|
+
"standard",
|
10
|
+
"plugin:json/recommended",
|
11
|
+
"plugin:markdown/recommended",
|
12
|
+
"plugin:n/recommended",
|
13
|
+
],
|
14
|
+
};
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# This workflow handle pull requests
|
2
|
+
name: Receive pull_request
|
3
|
+
on: [pull_request_target]
|
4
|
+
jobs:
|
5
|
+
approve: # to approve a workflow run(through github environment)
|
6
|
+
name: Approve Job
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- name: Approve
|
10
|
+
run: |
|
11
|
+
echo For security reasons, all pull requests need to be approved first before running any automated CI.
|
12
|
+
echo Thank you for your patience.
|
13
|
+
test:
|
14
|
+
name: Test @ NodeJS - x86 - ubuntu-latest
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
needs: [approve]
|
17
|
+
strategy:
|
18
|
+
matrix:
|
19
|
+
node-version: [lts/*]
|
20
|
+
environment:
|
21
|
+
name: pr-reviews
|
22
|
+
steps:
|
23
|
+
- name: Checkout
|
24
|
+
uses: actions/checkout@v3
|
25
|
+
- name: Setup NodeJS ${{ matrix.node-version }}
|
26
|
+
uses: actions/setup-node@v3
|
27
|
+
with:
|
28
|
+
node-version: ${{ matrix.node-version }}
|
29
|
+
- name: Install dependencies
|
30
|
+
run: npm ci
|
31
|
+
- name: Linting
|
32
|
+
run: npm run lint
|
33
|
+
- name: Initialize CodeQL
|
34
|
+
uses: github/codeql-action/init@v2
|
35
|
+
with:
|
36
|
+
languages: javascript
|
37
|
+
- name: Perform CodeQL Analysis
|
38
|
+
uses: github/codeql-action/analyze@v2
|
39
|
+
- name: Tests
|
40
|
+
env:
|
41
|
+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
42
|
+
GITHUB_REPO: ${{ secrets.GH_REPO }}
|
43
|
+
WHMCSMP_LOGIN: ${{ secrets.WHMCSMP_LOGIN }}
|
44
|
+
WHMCSMP_PASSWORD: ${{ secrets.WHMCSMP_PASSWORD }}
|
45
|
+
WHMCSMP_PRODUCTID: ${{ secrets.WHMCSMP_PRODUCTID }}
|
46
|
+
WHMCSMP_MINVERSION: ${{ secrets.WHMCSMP_MINVERSION }}
|
47
|
+
run: npm run coverage
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# This workflow handle Push
|
2
|
+
name: Receive Push
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- "**"
|
7
|
+
tags-ignore:
|
8
|
+
- "**"
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
name: Test @ NodeJS - x86 - ubuntu-latest
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
if: github.actor != 'dependabot[bot]' # ignore pushed brnaches by dependabot
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
node-version: [lts/*]
|
17
|
+
steps:
|
18
|
+
- name: Checkout
|
19
|
+
uses: actions/checkout@v3
|
20
|
+
- name: Setup NodeJS ${{ matrix.node-version }}
|
21
|
+
uses: actions/setup-node@v3
|
22
|
+
with:
|
23
|
+
node-version: ${{ matrix.node-version }}
|
24
|
+
- name: Install dependencies
|
25
|
+
run: npm ci
|
26
|
+
- name: Linting
|
27
|
+
run: npm run lint
|
28
|
+
- name: Initialize CodeQL
|
29
|
+
uses: github/codeql-action/init@v2
|
30
|
+
with:
|
31
|
+
languages: javascript
|
32
|
+
- name: Perform CodeQL Analysis
|
33
|
+
uses: github/codeql-action/analyze@v2
|
34
|
+
- name: Tests
|
35
|
+
env:
|
36
|
+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
37
|
+
GITHUB_REPO: ${{ secrets.GH_REPO }}
|
38
|
+
WHMCSMP_LOGIN: ${{ secrets.WHMCSMP_LOGIN }}
|
39
|
+
WHMCSMP_PASSWORD: ${{ secrets.WHMCSMP_PASSWORD }}
|
40
|
+
WHMCSMP_PRODUCTID: ${{ secrets.WHMCSMP_PRODUCTID }}
|
41
|
+
WHMCSMP_MINVERSION: ${{ secrets.WHMCSMP_MINVERSION }}
|
42
|
+
run: npm run coverage
|
43
|
+
- name: Upload coverage folder
|
44
|
+
uses: actions/upload-artifact@v3
|
45
|
+
with:
|
46
|
+
name: coverage-folder
|
47
|
+
path: coverage
|
48
|
+
|
49
|
+
release:
|
50
|
+
name: Release @ NodeJS LTS - x86 - ubuntu-latest
|
51
|
+
needs: test
|
52
|
+
if: github.ref == 'refs/heads/master' # release when pushing on master branch only
|
53
|
+
runs-on: ubuntu-latest
|
54
|
+
steps:
|
55
|
+
- name: Checkout
|
56
|
+
uses: actions/checkout@v3
|
57
|
+
with:
|
58
|
+
fetch-depth: 0
|
59
|
+
persist-credentials: false
|
60
|
+
- name: Setup NodeJS LTS
|
61
|
+
uses: actions/setup-node@v3
|
62
|
+
with:
|
63
|
+
node-version: lts/*
|
64
|
+
- name: Install dependencies
|
65
|
+
run: npm ci
|
66
|
+
- name: Download coverage folder from Push workflow
|
67
|
+
uses: actions/download-artifact@v3
|
68
|
+
with:
|
69
|
+
name: coverage-folder
|
70
|
+
path: coverage
|
71
|
+
- name: Release
|
72
|
+
env:
|
73
|
+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
74
|
+
GITHUB_REPO: ${{ secrets.GH_REPO }}
|
75
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
76
|
+
run: npx semantic-release
|
package/.releaserc.json
CHANGED
@@ -1,24 +1,21 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
"@semantic-release/github"
|
23
|
-
]
|
24
|
-
}
|
2
|
+
"plugins": [
|
3
|
+
"@semantic-release/commit-analyzer",
|
4
|
+
"@semantic-release/release-notes-generator",
|
5
|
+
[
|
6
|
+
"@semantic-release/changelog",
|
7
|
+
{
|
8
|
+
"changelogFile": "HISTORY.md"
|
9
|
+
}
|
10
|
+
],
|
11
|
+
"@semantic-release/npm",
|
12
|
+
[
|
13
|
+
"@semantic-release/git",
|
14
|
+
{
|
15
|
+
"assets": ["HISTORY.md", "package.json", "coverage"],
|
16
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
17
|
+
}
|
18
|
+
],
|
19
|
+
"@semantic-release/github"
|
20
|
+
]
|
21
|
+
}
|
package/HISTORY.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
## [3.1.2](https://github.com/hexonet/semantic-release-whmcs/compare/v3.1.1...v3.1.2) (2022-06-08)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* **regex:** polygonal regular expression used on uncontrolled data ([bcaf404](https://github.com/hexonet/semantic-release-whmcs/commit/bcaf40466a59baaf4a1fe8f55c819ef3ff325064))
|
7
|
+
* **regular expression:** fixed unnecessary escape character ([5613eba](https://github.com/hexonet/semantic-release-whmcs/commit/5613eba3684060fd33c47db1dc4a82f2eb262c77))
|
8
|
+
|
9
|
+
## [3.1.1](https://github.com/hexonet/semantic-release-whmcs/compare/v3.1.0...v3.1.1) (2021-11-09)
|
10
|
+
|
11
|
+
|
12
|
+
### Performance Improvements
|
13
|
+
|
14
|
+
* **dep bumps:** upgraded dependencies ([f54620f](https://github.com/hexonet/semantic-release-whmcs/commit/f54620f1fcdd54f62b6d43f15ef0a6e4b0e70292))
|
15
|
+
|
16
|
+
# [3.1.0](https://github.com/hexonet/semantic-release-whmcs/compare/v3.0.2...v3.1.0) (2021-05-19)
|
17
|
+
|
18
|
+
|
19
|
+
### Bug Fixes
|
20
|
+
|
21
|
+
* **coverage:** fixed coverage report by ignoring puppeteer browser-side code ([612403d](https://github.com/hexonet/semantic-release-whmcs/commit/612403d25f211766118ce96016967d554e976c98))
|
22
|
+
* **gh_repo:** fix implementation of GH_REPO and syncVersions ([cf33e36](https://github.com/hexonet/semantic-release-whmcs/commit/cf33e36d8d26d4396642d33791bb774382c9fc28))
|
23
|
+
* **gh_repo:** fix implementation of GH_REPO and syncVersions ([c4f8165](https://github.com/hexonet/semantic-release-whmcs/commit/c4f8165d0d2d1fcf3ea83680d895b35eea3abc5a))
|
24
|
+
* **puppeteer:** ensure to hover to selector before clicking ([aad85a6](https://github.com/hexonet/semantic-release-whmcs/commit/aad85a60c42d226342d72b19ef7cf86d2ad2ca20))
|
25
|
+
|
26
|
+
|
27
|
+
### Features
|
28
|
+
|
29
|
+
* **log:** improve logging ([5573b6a](https://github.com/hexonet/semantic-release-whmcs/commit/5573b6a255ef755e67fcacbe33fdeacc232e4b15))
|
30
|
+
|
1
31
|
## [3.0.2](https://github.com/hexonet/semantic-release-whmcs/compare/v3.0.1...v3.0.2) (2021-04-28)
|
2
32
|
|
3
33
|
|
package/README.md
CHANGED
@@ -72,7 +72,7 @@ That said, before you can use this module for publishing new product/module vers
|
|
72
72
|
| `WHMCSMP_PRODUCTID` | **Required.** The product id of the product/module you want to publish versions for. |
|
73
73
|
| `WHMCSMP_MINVERSION` | **Optional.** The minimum supported WHMCS version. Defaults to 7.10. |
|
74
74
|
| `GH_TOKEN` | **Optional.** GitHub API authentication token to use for syncing versions. |
|
75
|
-
| `GH_REPO` | **Optional.** GitHub repository name to use for syncing versions. |
|
75
|
+
| `GH_REPO` | **Optional.** GitHub repository name (format: organization/repository) to use for syncing versions. |
|
76
76
|
|
77
77
|
### Options
|
78
78
|
|
@@ -84,13 +84,13 @@ Type `./whmcs.js --help` for command reference
|
|
84
84
|
|
85
85
|
## Contributing
|
86
86
|
|
87
|
-
Please read [
|
87
|
+
Please read [Contribution Guide Lines](https://github.com/hexonet/semantic-release-whmcs/blob/master/CONTRIBUTING.md) for details on our code of conduct, then address a PR to us.
|
88
|
+
Contributors are highly welcome.
|
88
89
|
|
89
90
|
## Authors
|
90
91
|
|
91
|
-
* **Kai Schwarz** - *development* - [PapaKai](https://github.com/papakai)
|
92
|
-
|
93
|
-
See also the list of [contributors](https://github.com/hexonet/semantic-release-whmcs/graphs/contributors) who participated in this project.
|
92
|
+
* **Kai Schwarz** - *lead development* - [PapaKai](https://github.com/papakai)
|
93
|
+
* **Sebastian Vassiliou** - *development* - [h9k](https://github.com/h9k)
|
94
94
|
|
95
95
|
## License
|
96
96
|
|
@@ -0,0 +1,224 @@
|
|
1
|
+
body, html {
|
2
|
+
margin:0; padding: 0;
|
3
|
+
height: 100%;
|
4
|
+
}
|
5
|
+
body {
|
6
|
+
font-family: Helvetica Neue, Helvetica, Arial;
|
7
|
+
font-size: 14px;
|
8
|
+
color:#333;
|
9
|
+
}
|
10
|
+
.small { font-size: 12px; }
|
11
|
+
*, *:after, *:before {
|
12
|
+
-webkit-box-sizing:border-box;
|
13
|
+
-moz-box-sizing:border-box;
|
14
|
+
box-sizing:border-box;
|
15
|
+
}
|
16
|
+
h1 { font-size: 20px; margin: 0;}
|
17
|
+
h2 { font-size: 14px; }
|
18
|
+
pre {
|
19
|
+
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
20
|
+
margin: 0;
|
21
|
+
padding: 0;
|
22
|
+
-moz-tab-size: 2;
|
23
|
+
-o-tab-size: 2;
|
24
|
+
tab-size: 2;
|
25
|
+
}
|
26
|
+
a { color:#0074D9; text-decoration:none; }
|
27
|
+
a:hover { text-decoration:underline; }
|
28
|
+
.strong { font-weight: bold; }
|
29
|
+
.space-top1 { padding: 10px 0 0 0; }
|
30
|
+
.pad2y { padding: 20px 0; }
|
31
|
+
.pad1y { padding: 10px 0; }
|
32
|
+
.pad2x { padding: 0 20px; }
|
33
|
+
.pad2 { padding: 20px; }
|
34
|
+
.pad1 { padding: 10px; }
|
35
|
+
.space-left2 { padding-left:55px; }
|
36
|
+
.space-right2 { padding-right:20px; }
|
37
|
+
.center { text-align:center; }
|
38
|
+
.clearfix { display:block; }
|
39
|
+
.clearfix:after {
|
40
|
+
content:'';
|
41
|
+
display:block;
|
42
|
+
height:0;
|
43
|
+
clear:both;
|
44
|
+
visibility:hidden;
|
45
|
+
}
|
46
|
+
.fl { float: left; }
|
47
|
+
@media only screen and (max-width:640px) {
|
48
|
+
.col3 { width:100%; max-width:100%; }
|
49
|
+
.hide-mobile { display:none!important; }
|
50
|
+
}
|
51
|
+
|
52
|
+
.quiet {
|
53
|
+
color: #7f7f7f;
|
54
|
+
color: rgba(0,0,0,0.5);
|
55
|
+
}
|
56
|
+
.quiet a { opacity: 0.7; }
|
57
|
+
|
58
|
+
.fraction {
|
59
|
+
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
60
|
+
font-size: 10px;
|
61
|
+
color: #555;
|
62
|
+
background: #E8E8E8;
|
63
|
+
padding: 4px 5px;
|
64
|
+
border-radius: 3px;
|
65
|
+
vertical-align: middle;
|
66
|
+
}
|
67
|
+
|
68
|
+
div.path a:link, div.path a:visited { color: #333; }
|
69
|
+
table.coverage {
|
70
|
+
border-collapse: collapse;
|
71
|
+
margin: 10px 0 0 0;
|
72
|
+
padding: 0;
|
73
|
+
}
|
74
|
+
|
75
|
+
table.coverage td {
|
76
|
+
margin: 0;
|
77
|
+
padding: 0;
|
78
|
+
vertical-align: top;
|
79
|
+
}
|
80
|
+
table.coverage td.line-count {
|
81
|
+
text-align: right;
|
82
|
+
padding: 0 5px 0 20px;
|
83
|
+
}
|
84
|
+
table.coverage td.line-coverage {
|
85
|
+
text-align: right;
|
86
|
+
padding-right: 10px;
|
87
|
+
min-width:20px;
|
88
|
+
}
|
89
|
+
|
90
|
+
table.coverage td span.cline-any {
|
91
|
+
display: inline-block;
|
92
|
+
padding: 0 5px;
|
93
|
+
width: 100%;
|
94
|
+
}
|
95
|
+
.missing-if-branch {
|
96
|
+
display: inline-block;
|
97
|
+
margin-right: 5px;
|
98
|
+
border-radius: 3px;
|
99
|
+
position: relative;
|
100
|
+
padding: 0 4px;
|
101
|
+
background: #333;
|
102
|
+
color: yellow;
|
103
|
+
}
|
104
|
+
|
105
|
+
.skip-if-branch {
|
106
|
+
display: none;
|
107
|
+
margin-right: 10px;
|
108
|
+
position: relative;
|
109
|
+
padding: 0 4px;
|
110
|
+
background: #ccc;
|
111
|
+
color: white;
|
112
|
+
}
|
113
|
+
.missing-if-branch .typ, .skip-if-branch .typ {
|
114
|
+
color: inherit !important;
|
115
|
+
}
|
116
|
+
.coverage-summary {
|
117
|
+
border-collapse: collapse;
|
118
|
+
width: 100%;
|
119
|
+
}
|
120
|
+
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
121
|
+
.keyline-all { border: 1px solid #ddd; }
|
122
|
+
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
123
|
+
.coverage-summary tbody { border: 1px solid #bbb; }
|
124
|
+
.coverage-summary td { border-right: 1px solid #bbb; }
|
125
|
+
.coverage-summary td:last-child { border-right: none; }
|
126
|
+
.coverage-summary th {
|
127
|
+
text-align: left;
|
128
|
+
font-weight: normal;
|
129
|
+
white-space: nowrap;
|
130
|
+
}
|
131
|
+
.coverage-summary th.file { border-right: none !important; }
|
132
|
+
.coverage-summary th.pct { }
|
133
|
+
.coverage-summary th.pic,
|
134
|
+
.coverage-summary th.abs,
|
135
|
+
.coverage-summary td.pct,
|
136
|
+
.coverage-summary td.abs { text-align: right; }
|
137
|
+
.coverage-summary td.file { white-space: nowrap; }
|
138
|
+
.coverage-summary td.pic { min-width: 120px !important; }
|
139
|
+
.coverage-summary tfoot td { }
|
140
|
+
|
141
|
+
.coverage-summary .sorter {
|
142
|
+
height: 10px;
|
143
|
+
width: 7px;
|
144
|
+
display: inline-block;
|
145
|
+
margin-left: 0.5em;
|
146
|
+
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
147
|
+
}
|
148
|
+
.coverage-summary .sorted .sorter {
|
149
|
+
background-position: 0 -20px;
|
150
|
+
}
|
151
|
+
.coverage-summary .sorted-desc .sorter {
|
152
|
+
background-position: 0 -10px;
|
153
|
+
}
|
154
|
+
.status-line { height: 10px; }
|
155
|
+
/* yellow */
|
156
|
+
.cbranch-no { background: yellow !important; color: #111; }
|
157
|
+
/* dark red */
|
158
|
+
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
159
|
+
.low .chart { border:1px solid #C21F39 }
|
160
|
+
.highlighted,
|
161
|
+
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
|
162
|
+
background: #C21F39 !important;
|
163
|
+
}
|
164
|
+
/* medium red */
|
165
|
+
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
166
|
+
/* light red */
|
167
|
+
.low, .cline-no { background:#FCE1E5 }
|
168
|
+
/* light green */
|
169
|
+
.high, .cline-yes { background:rgb(230,245,208) }
|
170
|
+
/* medium green */
|
171
|
+
.cstat-yes { background:rgb(161,215,106) }
|
172
|
+
/* dark green */
|
173
|
+
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
174
|
+
.high .chart { border:1px solid rgb(77,146,33) }
|
175
|
+
/* dark yellow (gold) */
|
176
|
+
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
|
177
|
+
.medium .chart { border:1px solid #f9cd0b; }
|
178
|
+
/* light yellow */
|
179
|
+
.medium { background: #fff4c2; }
|
180
|
+
|
181
|
+
.cstat-skip { background: #ddd; color: #111; }
|
182
|
+
.fstat-skip { background: #ddd; color: #111 !important; }
|
183
|
+
.cbranch-skip { background: #ddd !important; color: #111; }
|
184
|
+
|
185
|
+
span.cline-neutral { background: #eaeaea; }
|
186
|
+
|
187
|
+
.coverage-summary td.empty {
|
188
|
+
opacity: .5;
|
189
|
+
padding-top: 4px;
|
190
|
+
padding-bottom: 4px;
|
191
|
+
line-height: 1;
|
192
|
+
color: #888;
|
193
|
+
}
|
194
|
+
|
195
|
+
.cover-fill, .cover-empty {
|
196
|
+
display:inline-block;
|
197
|
+
height: 12px;
|
198
|
+
}
|
199
|
+
.chart {
|
200
|
+
line-height: 0;
|
201
|
+
}
|
202
|
+
.cover-empty {
|
203
|
+
background: white;
|
204
|
+
}
|
205
|
+
.cover-full {
|
206
|
+
border-right: none !important;
|
207
|
+
}
|
208
|
+
pre.prettyprint {
|
209
|
+
border: none !important;
|
210
|
+
padding: 0 !important;
|
211
|
+
margin: 0 !important;
|
212
|
+
}
|
213
|
+
.com { color: #999 !important; }
|
214
|
+
.ignore-none { color: #999; font-weight: normal; }
|
215
|
+
|
216
|
+
.wrapper {
|
217
|
+
min-height: 100%;
|
218
|
+
height: auto !important;
|
219
|
+
height: 100%;
|
220
|
+
margin: 0 auto -48px;
|
221
|
+
}
|
222
|
+
.footer, .push {
|
223
|
+
height: 48px;
|
224
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
var jumpToCode = (function init() {
|
3
|
+
// Classes of code we would like to highlight in the file view
|
4
|
+
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
|
5
|
+
|
6
|
+
// Elements to highlight in the file listing view
|
7
|
+
var fileListingElements = ['td.pct.low'];
|
8
|
+
|
9
|
+
// We don't want to select elements that are direct descendants of another match
|
10
|
+
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
|
11
|
+
|
12
|
+
// Selecter that finds elements on the page to which we can jump
|
13
|
+
var selector =
|
14
|
+
fileListingElements.join(', ') +
|
15
|
+
', ' +
|
16
|
+
notSelector +
|
17
|
+
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
|
18
|
+
|
19
|
+
// The NodeList of matching elements
|
20
|
+
var missingCoverageElements = document.querySelectorAll(selector);
|
21
|
+
|
22
|
+
var currentIndex;
|
23
|
+
|
24
|
+
function toggleClass(index) {
|
25
|
+
missingCoverageElements
|
26
|
+
.item(currentIndex)
|
27
|
+
.classList.remove('highlighted');
|
28
|
+
missingCoverageElements.item(index).classList.add('highlighted');
|
29
|
+
}
|
30
|
+
|
31
|
+
function makeCurrent(index) {
|
32
|
+
toggleClass(index);
|
33
|
+
currentIndex = index;
|
34
|
+
missingCoverageElements.item(index).scrollIntoView({
|
35
|
+
behavior: 'smooth',
|
36
|
+
block: 'center',
|
37
|
+
inline: 'center'
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
function goToPrevious() {
|
42
|
+
var nextIndex = 0;
|
43
|
+
if (typeof currentIndex !== 'number' || currentIndex === 0) {
|
44
|
+
nextIndex = missingCoverageElements.length - 1;
|
45
|
+
} else if (missingCoverageElements.length > 1) {
|
46
|
+
nextIndex = currentIndex - 1;
|
47
|
+
}
|
48
|
+
|
49
|
+
makeCurrent(nextIndex);
|
50
|
+
}
|
51
|
+
|
52
|
+
function goToNext() {
|
53
|
+
var nextIndex = 0;
|
54
|
+
|
55
|
+
if (
|
56
|
+
typeof currentIndex === 'number' &&
|
57
|
+
currentIndex < missingCoverageElements.length - 1
|
58
|
+
) {
|
59
|
+
nextIndex = currentIndex + 1;
|
60
|
+
}
|
61
|
+
|
62
|
+
makeCurrent(nextIndex);
|
63
|
+
}
|
64
|
+
|
65
|
+
return function jump(event) {
|
66
|
+
if (
|
67
|
+
document.getElementById('fileSearch') === document.activeElement &&
|
68
|
+
document.activeElement != null
|
69
|
+
) {
|
70
|
+
// if we're currently focused on the search input, we don't want to navigate
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
|
74
|
+
switch (event.which) {
|
75
|
+
case 78: // n
|
76
|
+
case 74: // j
|
77
|
+
goToNext();
|
78
|
+
break;
|
79
|
+
case 66: // b
|
80
|
+
case 75: // k
|
81
|
+
case 80: // p
|
82
|
+
goToPrevious();
|
83
|
+
break;
|
84
|
+
}
|
85
|
+
};
|
86
|
+
})();
|
87
|
+
window.addEventListener('keydown', jumpToCode);
|