From c772b17f7991bfcf752ac7f1d3d15abbc3454140 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 7 Jan 2023 22:07:46 -0500 Subject: [PATCH] obtain validatornu release from npm --- .github/workflows/static.yml | 18 ------------------ package-lock.json | 16 +++++++++++++++- package.json | 3 ++- process-static | 2 +- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index e0b61da9..6d891007 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -6,9 +6,6 @@ jobs: static: runs-on: ubuntu-latest - env: - VALIDATOR_VERSION: 20.6.30 - steps: - uses: actions/checkout@v3 with: @@ -21,25 +18,10 @@ jobs: python-version: '3.10' cache: pip - - name: Cache validator - id: validator-cache - uses: actions/cache@v3 - with: - path: vnu-runtime-image - key: ${{ runner.os }}-validator-${{ env.VALIDATOR_VERSION }} - - run: sudo apt-get update - run: sudo apt-get -y install libxml2-utils yajl-tools moreutils zopfli - run: npm install - run: pip install -r requirements.txt - - name: Download validatornu - # There isn't a package with a `validatornu` command in Ubuntu, so download the validator - # from the GitHub releases and change the process-static script later to use it. - run: curl -OL https://github.com/validator/validator/releases/download/${{ env.VALIDATOR_VERSION }}/vnu.linux.zip && unzip vnu.linux.zip - if: steps.validator-cache.outputs.cache-hit != 'true' - - - run: sed -i 's+validatornu+vnu-runtime-image/bin/vnu+g' process-static - - name: process static run: ./process-static diff --git a/package-lock.json b/package-lock.json index ec8a16dc..a70a1bdb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,8 @@ "html-minifier": "^4.0.0", "stylelint": "^14.16.1", "stylelint-config-standard": "^29.0.0", - "terser": "^5.16.1" + "terser": "^5.16.1", + "vnu-jar": "^22.9.29" } }, "node_modules/@babel/code-frame": { @@ -2569,6 +2570,14 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/vnu-jar": { + "version": "22.9.29", + "resolved": "https://registry.npmjs.org/vnu-jar/-/vnu-jar-22.9.29.tgz", + "integrity": "sha512-AM0mnQEXT5UgT/YoCGy/4KE0i0A4iz9MWUIevzUlYb36UMnsHHQQYnA0ptm971JyaQ5Dg+z3u8AyobotmwkZUQ==", + "engines": { + "node": ">=0.10" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4480,6 +4489,11 @@ "spdx-expression-parse": "^3.0.0" } }, + "vnu-jar": { + "version": "22.9.29", + "resolved": "https://registry.npmjs.org/vnu-jar/-/vnu-jar-22.9.29.tgz", + "integrity": "sha512-AM0mnQEXT5UgT/YoCGy/4KE0i0A4iz9MWUIevzUlYb36UMnsHHQQYnA0ptm971JyaQ5Dg+z3u8AyobotmwkZUQ==" + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 82bf54c3..9d6c54b8 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "html-minifier": "^4.0.0", "stylelint": "^14.16.1", "stylelint-config-standard": "^29.0.0", - "terser": "^5.16.1" + "terser": "^5.16.1", + "vnu-jar": "^22.9.29" } } diff --git a/process-static b/process-static index c11e334d..0ce73f92 100755 --- a/process-static +++ b/process-static @@ -77,7 +77,7 @@ sed -i "$replace" static-tmp/releases.html gixy nginx-tmp/nginx.conf xmllint --noout static-tmp/**/*.html -validatornu --errors-only --also-check-css --also-check-svg static-tmp/**/!(bimi).@(css|html|svg) +java -jar node_modules/vnu-jar/build/dist/vnu.jar --errors-only --also-check-css --also-check-svg static-tmp/**/!(bimi).@(css|html|svg) find static-tmp -name '*.html' -exec html-minifier --collapse-whitespace \ --process-scripts "application/ld+json" --collapse-boolean-attributes \ --remove-attribute-quotes --remove-comments --remove-empty-attributes \