Skip to content

Commit 577a11f

Browse files
committed
vitepress: Disable default link checking on build
It is too unstable at the moment. Not sure if it is a library limitation or something else. Move this checking to an explicit 'npm run docs:build-checks' command. Thus, both CI and deployment builds will ignore (for now).
1 parent 27dfa9c commit 577a11f

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
run: npm ci
1818
- name: Build with VitePress
1919
run: |
20-
npm run docs:build-ci
20+
npm run docs:build

lib/link_checker.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import getHrefs from 'get-hrefs'
22
import linkCheck from 'link-check'
3-
import { isCIBuild } from './utility.js'
3+
import { doBuildChecks } from './utility.js'
44

55
const linkCache = {}
66
const linkErrors = []
@@ -12,18 +12,11 @@ const ignores = [
1212
// Ignore localhost links
1313
'://localhost',
1414
// Ignore example data
15-
'http://10.10.10.1',
16-
'http://host:9090',
17-
// Ignore datastax links (possibly related to ALPN/HTTP 2.0 resolution:
18-
// https://github.com/tcort/link-check/issues/72; wget and curl do not
19-
// work by default from command line either)
20-
'https://docs.datastax.com/',
21-
'https://support.cpanel.net/',
22-
'https://forums.cpanel.net',
15+
'://10.10.10.1',
2316
]
2417

2518
export function checkExternalLinks(context, extra_ignores = []) {
26-
if (isCIBuild()) {
19+
if (!doBuildChecks()) {
2720
return
2821
}
2922

lib/utility.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,8 @@ export function resolveURL(url, base) {
170170
return (base.endsWith('/') ? base.slice(0, -1) : base) + '/' + url
171171
}
172172

173-
export function isCIBuild() {
173+
export function doBuildChecks() {
174174
// Running a local dev environment is considered a "CI build", since
175175
// we should not be doing expensive validity checking
176-
return (process.env.npm_lifecycle_event === 'docs:build-ci') ||
177-
(process.env.NODE_ENV === 'development')
176+
return (process.env.npm_lifecycle_event === 'docs:build-checks')
178177
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"scripts": {
2727
"docs:dev": "vitepress dev",
2828
"docs:build": "vitepress build",
29-
"docs:build-ci": "vitepress build",
29+
"docs:build-checks": "vitepress build",
3030
"docs:preview": "vitepress preview",
3131
"man:build": "node util/generate_man.js"
3232
},

0 commit comments

Comments
 (0)