Created
February 22, 2018 15:59
-
-
Save nfreear/975ccafd9c0d1773d59ff583b926949c to your computer and use it in GitHub Desktop.
pa11y-ci OTU Node.JS accessibility script. | Nick Freear, 19-Feb-2018 (OTU: onefile-js)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// eslint-disable-next-line | |
const _PKG_ = ` | |
dependencies: | |
shelljs: ^0.7.8 | |
pa11y-ci: ^1.3.1 | |
# otu: ^1.1.0-beta | |
pa11y-ci: | |
defaults: | |
standard: WCAG2AAA | |
timeout: 8000 | |
wait: 2000 | |
urls: | |
- https://example.org/?_ua=pa11y-ci | |
`; | |
/** | |
* pa11y-ci OTU Node.JS accessibility script. | Nick Freear, 19-Feb-2018. | |
* | |
* /Users/XXX/.nvm/versions/node/v8.1.3/lib/node_modules/otu/bin/otu.js:30:13 | |
* | |
* https://npmjs.com/package/otu | |
*/ | |
const OTU = require('../index'); | |
const shell = require('shelljs'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const scriptName = OTU.getFilename(__filename); | |
console.log( process.argv ); | |
shell.echo(scriptName); | |
// process.exit( 1 ); | |
OTU.init(scriptName); | |
const pa11yci = OTU.getPackage(__filename)[ 'pa11y-ci' ]; | |
const pa11yci_file = path.join(__dirname, '.pa11yci.json'); | |
shell.echo(process.argv); | |
shell.echo('Hello world!'); | |
shell.echo(OTU.getVersion()); | |
shell.echo(OTU.pkgDirectory()); | |
shell.echo(OTU.getFilename()); | |
const pkgdir = OTU.pkgDirectory(); | |
pa11yci[ 'x-time' ] = new Date().toISOString(); | |
fs.writeFileSync(pa11yci_file, JSON.stringify(pa11yci, null, 2)); | |
const cmd = 'NODE_PATH=' + pkgdir + '/node_modules/; ' + pkgdir + '/node_modules/.bin/pa11y-ci --config ' + pa11yci_file; | |
shell.echo(cmd); | |
shell.exec(cmd); | |
// End. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment