Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/google/docsy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrice Chalin <chalin@users.noreply.github.com>2022-08-15 21:56:02 +0300
committerGitHub <noreply@github.com>2022-08-15 21:56:02 +0300
commit4eca154408266571c819e326a2975a169ebb602a (patch)
treef4dc8e11943e4c0f2fdf806e7a87e13d4d708475
parentbec58690c1d70a97e9498c05857aae03c7565fd4 (diff)
Check links in the user guide (#1172)
-rw-r--r--package.json2
-rw-r--r--userguide/.gitignore1
-rw-r--r--userguide/.htmltest.yml8
-rw-r--r--userguide/Makefile21
-rw-r--r--userguide/package.json5
5 files changed, 37 insertions, 0 deletions
diff --git a/package.json b/package.json
index 303b4e9..e3a8f0b 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,8 @@
"build:production": "npm run cd:docs build:production",
"build": "npm run cd:docs build",
"cd:docs": "npm run _cd:docs -- npm run",
+ "check-links:all": "npm run cd:docs check-links:all",
+ "check-links": "npm run cd:docs check-links",
"docs-install": "npm run _cd:docs -- npm install",
"get:submodule": "set -x && git submodule update --init ${DEPTH:- --depth 1}",
"serve": "npm run cd:docs serve",
diff --git a/userguide/.gitignore b/userguide/.gitignore
index a1b6687..c18d685 100644
--- a/userguide/.gitignore
+++ b/userguide/.gitignore
@@ -2,3 +2,4 @@
.hugo_build.lock
/public
resources/
+tmp
diff --git a/userguide/.htmltest.yml b/userguide/.htmltest.yml
new file mode 100644
index 0000000..4a67a2b
--- /dev/null
+++ b/userguide/.htmltest.yml
@@ -0,0 +1,8 @@
+DirectoryPath: public
+CheckDoctype: false # Sadly, this is false only because of `static/google*.html`
+IgnoreAltMissing: true # FIXME
+IgnoreDirectoryMissingTrailingSlash: true # FIXME
+IgnoreDirs: [_print] # FIXME
+IgnoreEmptyHref: true # FIXME
+IgnoreInternalEmptyHash: true # FIXME
+IgnoreInternalURLs:
diff --git a/userguide/Makefile b/userguide/Makefile
new file mode 100644
index 0000000..7a4aa11
--- /dev/null
+++ b/userguide/Makefile
@@ -0,0 +1,21 @@
+HTMLTEST_DIR=tmp
+HTMLTEST?=htmltest # Specify as make arg if different
+HTMLTEST_ARGS?=--skip-external
+
+# Use $(HTMLTEST) in PATH, if available; otherwise, we'll get a copy
+ifeq (, $(shell which $(HTMLTEST)))
+override HTMLTEST=$(HTMLTEST_DIR)/bin/htmltest
+ifeq (, $(shell which $(HTMLTEST)))
+GET_LINK_CHECKER_IF_NEEDED=get-link-checker
+endif
+endif
+
+check-links: $(GET_LINK_CHECKER_IF_NEEDED)
+ $(HTMLTEST) $(HTMLTEST_ARGS)
+
+clean:
+ rm -rf $(HTMLTEST_DIR) public/* resources
+
+get-link-checker:
+ rm -Rf $(HTMLTEST_DIR)/bin
+ curl https://htmltest.wjdp.uk | bash -s -- -b $(HTMLTEST_DIR)/bin
diff --git a/userguide/package.json b/userguide/package.json
index 7f3dab7..b40c316 100644
--- a/userguide/package.json
+++ b/userguide/package.json
@@ -2,14 +2,19 @@
"name": "docsy-user-guide",
"scripts": {
"_build": "npm run _hugo-dev",
+ "_check-links": "make check-links",
"_hugo": "hugo --cleanDestinationDir --themesDir ../..",
"_hugo-dev": "npm run _hugo -- -e dev -DFE",
"_serve": "npm run _hugo-dev -- serve",
"build:preview": "npm run _hugo-dev -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"",
"build:production": "npm run _hugo -- --minify",
"build": "npm run _build",
+ "check-links:all": "HTMLTEST_ARGS= npm run _check-links",
+ "check-links": "npm run _check-links",
"clean": "rm -Rf public",
"make:public": "git init -b main public",
+ "postbuild:preview": "npm run _check-links",
+ "postbuild:production": "npm run _check-links",
"prepare": "cd .. && npm install",
"serve": "npm run _serve"
},