mirror of https://github.com/ColorlibHQ/AdminLTE
Add vnu-jar for HTML validation.
Also, add a GitHub Action which builds the docs and run the validator script.pull/2772/head
parent
da1fa4eaab
commit
38e74faf55
|
@ -0,0 +1,73 @@
|
|||
name: Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
env:
|
||||
CI: true
|
||||
NODE: 12.x
|
||||
RUBY: 2.6.x
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "${{ env.NODE }}"
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ env.RUBY }}
|
||||
|
||||
- name: Disable gem docs
|
||||
run: 'echo "gem: --no-document" > ~/.gemrc'
|
||||
|
||||
- name: Set up npm cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-v${{ env.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}}
|
||||
restore-keys: |
|
||||
${{ runner.OS }}-node-v${{ env.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
|
||||
${{ runner.OS }}-node-v${{ env.node }}-
|
||||
|
||||
- name: Set up Ruby cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: ${{ runner.os }}-ruby-v${{ env.RUBY }}-${{ hashFiles('Gemfile') }}-${{ hashFiles('Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ruby-v${{ env.RUBY }}-${{ hashFiles('Gemfile') }}-${{ hashFiles('Gemfile.lock') }}
|
||||
${{ runner.os }}-ruby-v${{ env.RUBY }}-
|
||||
|
||||
- name: Set up Bundler
|
||||
run: gem install bundler -v "~> 1.17"
|
||||
|
||||
- run: ruby --version
|
||||
- run: gem --version
|
||||
- run: bundle --version
|
||||
- run: java -version
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install bundler dependencies
|
||||
run: bundle install --gemfile docs/Gemfile --deployment --jobs=4 --retry=3 --clean
|
||||
|
||||
- name: Build docs
|
||||
run: npm run docs-compile
|
||||
|
||||
- name: Run HTML validator
|
||||
run: npm run docs-lint
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/*!
|
||||
* Script to run vnu-jar if Java is available.
|
||||
* Copyright 2017-2020 The Bootstrap Authors
|
||||
* Copyright 2017-2020 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const childProcess = require('child_process')
|
||||
const vnu = require('vnu-jar')
|
||||
|
||||
childProcess.exec('java -version', (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error('Skipping vnu-jar test; Java is missing.')
|
||||
return
|
||||
}
|
||||
|
||||
const is32bitJava = !/64-Bit/.test(stderr)
|
||||
|
||||
// vnu-jar accepts multiple ignores joined with a `|`.
|
||||
// Also note that the ignores are regular expressions.
|
||||
const ignores = [
|
||||
// "autocomplete" is included in <button> and checkboxes and radio <input>s due to
|
||||
// Firefox's non-standard autocomplete behavior - see https://bugzilla.mozilla.org/show_bug.cgi?id=654072
|
||||
'Attribute “autocomplete” is only allowed when the input type is.*'
|
||||
].join('|')
|
||||
|
||||
const args = [
|
||||
'-jar',
|
||||
vnu,
|
||||
'--asciiquotes',
|
||||
'--skip-non-html',
|
||||
// Ignore the language code warnings
|
||||
'--no-langdetect',
|
||||
// '--Werror',
|
||||
`--filterpattern "${ignores}"`,
|
||||
'./*.html',
|
||||
'docs_html/',
|
||||
'pages/'
|
||||
]
|
||||
|
||||
// For the 32-bit Java we need to pass `-Xss512k`
|
||||
if (is32bitJava) {
|
||||
args.splice(0, 0, '-Xss512k')
|
||||
}
|
||||
|
||||
return childProcess.spawn('java', args, {
|
||||
shell: true,
|
||||
stdio: 'inherit'
|
||||
})
|
||||
.on('exit', process.exit)
|
||||
})
|
|
@ -11581,6 +11581,12 @@
|
|||
"unist-util-stringify-position": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"vnu-jar": {
|
||||
"version": "20.5.29",
|
||||
"resolved": "https://registry.npmjs.org/vnu-jar/-/vnu-jar-20.5.29.tgz",
|
||||
"integrity": "sha512-//4B+FR0RlMul8YTQCDrC1Xxrm/meFKpD/cNaam6VU/bfjOiFIeNYVpCUsIiUWGqBiNcxtky+K5RIPzO1QSykg==",
|
||||
"dev": true
|
||||
},
|
||||
"which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
"compile": "npm-run-all --parallel js css-all",
|
||||
"dev": "npm-run-all --parallel watch sync",
|
||||
"docs": "npm-run-all --sequential docs-prepare docs-compile",
|
||||
"docs-lint": "node build/npm/vnu-jar.js",
|
||||
"docs-compile": "cd docs/ && bundle exec jekyll build -d ../docs_html",
|
||||
"docs-serve": "cd docs/ && bundle exec jekyll serve",
|
||||
"docs-prepare": "node build/npm/DocsPublish.js -v",
|
||||
|
@ -152,6 +153,7 @@
|
|||
"rollup": "^2.12.1",
|
||||
"stylelint": "^13.5.0",
|
||||
"stylelint-config-twbs-bootstrap": "^2.0.3",
|
||||
"terser": "^4.7.0"
|
||||
"terser": "^4.7.0",
|
||||
"vnu-jar": "^20.5.29"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue