-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(major): Ace 1.2 supersedes v1.1.1 (PR #314)
Summary: * Based on DAISY's own fork of Deque's Axe (latest v4 version), instead of patching Axe's distributed Javascript bundles (see daisy/axe-core#4 ) * Better localization tooling for Axe, integration of Axe translations * Two Axe "runners": Puppeteer (default for Ace CLI), and Electron (can be used in CLI, and used by Ace App), Chromium web browser engine is used in both cases, but Electron runner uses a HTTP server to simulate a typical reading system environment. Unit tests plumbing for both platforms (Continuous Integration server only executes the Puppeteer ones, for faster builds). Runtime performance is near-identical (there is a developer script to check this). * NodeJS >=10 requirement * NPM package dependencies updated to latest versions (except where NodeJS requirement is higher). Added developer scripts to facilitate version checking and incremental updates at regular intervals (i.e. `package.json` exact references and `yarn.lock` maintenance) * All Ace sub-packages (`@daisy/` organisation scope on NPM) have exact same semantic version (easier deployment with developer script that automates NPM publish) * Fixes bugs that couldn't easily be fixed in Ace 1.1.1 (the last of v1), due to older Axe (v3 instead of v4) and due to older NPM package dependencies that were necessary for compatibility with legacy NodeJS requirement (now deprecated / deemed unsecure).
- Loading branch information
1 parent
87947c9
commit e974684
Showing
180 changed files
with
13,929 additions
and
4,886 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
{ | ||
"targets": { | ||
"node": [ | ||
"8" | ||
"10" | ||
] | ||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,5 @@ website/site | |
.DS_Store | ||
._* | ||
Thumbs.db | ||
|
||
.history |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const common = require('./jest.config-common'); | ||
module.exports = { | ||
...common, | ||
testMatch: [ | ||
'<rootDir>/tests/__tests__/cli.test.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
verbose: true, | ||
testEnvironment: 'node', | ||
setupFilesAfterEnv: ['<rootDir>/tests/jest-setup.js'], | ||
testPathIgnorePatterns: [ | ||
'<rootDir>/node_modules/', | ||
'<rootDir>/.history/', | ||
'<rootDir>/website/', | ||
'<rootDir>/scripts/', | ||
'<rootDir>/resources/', | ||
'<rootDir>/CompareAxeRunners/', | ||
'<rootDir>/tests/data/', | ||
], | ||
testMatch: [ | ||
"<rootDir>/tests/__tests__/**/*.js", | ||
"<rootDir>/packages/**/src/**/(*.)+test.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const common = require('./jest.config-common'); | ||
module.exports = { | ||
...common, | ||
runner: '@jest-runner/electron/main', | ||
testPathIgnorePatterns: common.testPathIgnorePatterns.concat([ | ||
'<rootDir>/tests/__tests__/cli', | ||
]), | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const common = require('./jest.config-common'); | ||
module.exports = { | ||
...common, | ||
testPathIgnorePatterns: common.testPathIgnorePatterns.concat([ | ||
'<rootDir>/tests/__tests__/cli', | ||
]), | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"lerna": "2.5.1", | ||
"version": "1.1.1", | ||
"lerna": "4.0.0", | ||
"version": "1.2.0-beta.15", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env node | ||
|
||
var electron = require('electron') | ||
|
||
var proc = require('child_process') | ||
|
||
var path = require('path') | ||
|
||
// console.log(process.argv); | ||
// console.log(process.cwd()); | ||
// console.log(__dirname); | ||
var args = [].concat(path.resolve(__dirname, "../lib/cli.js"), process.argv.slice(2)) | ||
// console.log(args); | ||
|
||
var child = proc.spawn(electron, args, { stdio: 'inherit', windowsHide: false }) | ||
child.on('close', function (code, signal) { | ||
if (code === null) { | ||
console.error(electron, 'exited with signal', signal) | ||
process.exit(1) | ||
} | ||
process.exit(code) | ||
}) | ||
|
||
const handleTerminationSignal = function (signal) { | ||
process.on(signal, function signalHandler () { | ||
if (!child.killed) { | ||
child.kill(signal) | ||
} | ||
}) | ||
} | ||
|
||
handleTerminationSignal('SIGINT') | ||
handleTerminationSignal('SIGTERM') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "@daisy/ace-axe-runner-electron", | ||
"version": "1.2.0-beta.15", | ||
"engines": { | ||
"node": ">=10.0.0", | ||
"yarn": "^1.22.5", | ||
"npm": ">=6.14.12" | ||
}, | ||
"description": "Electron-based Axe runner for Ace", | ||
"author": { | ||
"name": "DAISY developers", | ||
"organization": "DAISY Consortium", | ||
"url": "http://www.daisy.org/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/daisy/ace", | ||
"directory": "packages/ace-axe-runner-electron" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/daisy/ace/issues" | ||
}, | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
"@daisy/ace-cli-shared": "^1.2.0-beta.15", | ||
"express": "^4.17.1", | ||
"portfinder": "^1.0.28", | ||
"selfsigned": "^1.10.8", | ||
"uuid": "^8.3.2" | ||
}, | ||
"devDependencies": { | ||
"electron": "^12.0.2", | ||
"json": "^10.0.0", | ||
"json-diff": "^0.5.4" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
'use strict'; | ||
|
||
const electron = require('electron'); | ||
const app = electron.app; | ||
// const ipcMain = electron.ipcMain; | ||
// const ipcRenderer = electron.ipcRenderer; | ||
|
||
// Removes the deprecation warning message in the console | ||
// https://github.com/electron/electron/issues/18397 | ||
app.allowRendererProcessReuse = true; | ||
|
||
const EventEmitter = require('events'); | ||
class ElectronMockMainRendererEmitter extends EventEmitter {} | ||
const eventEmmitter = new ElectronMockMainRendererEmitter(); | ||
eventEmmitter.send = eventEmmitter.emit; | ||
eventEmmitter.ace_notElectronIpcMainRenderer = true; | ||
|
||
const CONCURRENT_INSTANCES = 4; // same as the Puppeteer Axe runner | ||
|
||
const axeRunnerElectronFactory = require('@daisy/ace-axe-runner-electron'); | ||
const axeRunner = axeRunnerElectronFactory.createAxeRunner(eventEmmitter, CONCURRENT_INSTANCES); | ||
|
||
const prepareLaunch = require('./init').prepareLaunch; | ||
prepareLaunch(eventEmmitter, CONCURRENT_INSTANCES); | ||
|
||
const cli = require('@daisy/ace-cli-shared'); | ||
|
||
const LOG_DEBUG = false; | ||
const ACE_LOG_PREFIX = "[ACE-AXE]"; | ||
|
||
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner CLI launch...`); | ||
|
||
// let win; | ||
// app.whenReady().then(() => { | ||
app.on('ready', async () => { | ||
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner CLI app ready.`); | ||
|
||
// win = new BrowserWindow( | ||
// { | ||
// show: false, | ||
// webPreferences: { | ||
// allowRunningInsecureContent: false, | ||
// contextIsolation: false, | ||
// nodeIntegration: true, | ||
// nodeIntegrationInWorker: false, | ||
// sandbox: false, | ||
// webSecurity: true, | ||
// webviewTag: false, | ||
// } | ||
// } | ||
// ); | ||
// // win.maximize(); | ||
// // let sz = win.getSize(); | ||
// // const sz0 = sz[0]; | ||
// // const sz1 = sz[1]; | ||
// // win.unmaximize(); | ||
// // // open a window that's not quite full screen ... makes sense on mac, anyway | ||
// // win.setSize(Math.min(Math.round(sz0 * .75),1200), Math.min(Math.round(sz1 * .85), 800)); | ||
// // // win.setPosition(Math.round(sz[0] * .10), Math.round(sz[1] * .10)); | ||
// // win.setPosition(Math.round(sz0*0.5-win.getSize()[0]*0.5), Math.round(sz1*0.5-win.getSize()[1]*0.5)); | ||
// // win.show(); | ||
|
||
// win.loadURL(`file://${__dirname}/index.html`); | ||
// win.on('closed', function () { | ||
// if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner win closed.`); | ||
// }); | ||
|
||
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner run...`); | ||
await cli.run(axeRunner, app.exit, (typeof process.env.JEST_TESTS !== "undefined" ? "ace-tests-cli-electron.log" : "ace-cli-electron.log")); // const exitCode = app.quit(); | ||
}); | ||
|
||
app.on('activate', function () { | ||
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner app activate.`); | ||
}); | ||
app.on('window-all-closed', function () { | ||
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner app window-all-closed.`); | ||
}); | ||
app.on('before-quit', function() { | ||
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner app before-quit.`); | ||
}); | ||
app.on('quit', () => { | ||
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner app quit.`); | ||
}); |
Oops, something went wrong.