Skip to content

Commit 8dc9066

Browse files
Merge branch 'main' into rfc2119-warnings
2 parents 6f2bfb4 + 8fb22a4 commit 8dc9066

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

.github/workflows/roleInfo.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: roleInfo update
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
roleInfo:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
ref: ${{ github.head_ref }}
15+
- name: Use Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "latest"
19+
- run: npm i linkedom
20+
- run: node ./common/script/buildRoleInfo.js > ./common/script/roleInfo.js
21+
- run: git config user.name "github-actions[bot]"
22+
- run: git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
23+
- run: git add ./common/script/roleInfo.js
24+
- run: |
25+
git diff-index --quiet HEAD ./common/script/roleInfo.js || git commit -m'chore: update roleInfo.js'
26+
- run: git push
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: roleInfo PR check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
roleInfo:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
ref: ${{ github.head_ref }}
15+
- name: Use Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "latest"
19+
- run: npm i linkedom prettier@3.6.0
20+
- run: node ./common/script/buildRoleInfo.js > ./common/script/roleInfo.js
21+
- run: npx prettier --write --print-width 200 ./common/script/roleInfo.js
22+
- run: git diff --exit-code

common/script/buildRoleInfo.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as fs from "node:fs";
2+
import { parseHTML } from "linkedom";
3+
4+
const { document } = parseHTML(fs.readFileSync("../aria/index.html").toString());
5+
6+
// mock functions for aria.js
7+
let updateReferences = () => {};
8+
document.URL = "";
9+
10+
const script = fs.readFileSync("./common/script/aria.js").toString();
11+
12+
const scriptWithoutRespecUI = script.substring(0, script.indexOf("require(")); // TODO: HACK remove everything past "require(" (NOTE: if we went only with this SSG approach, we could remove that end of aria.js and this hack)
13+
14+
// HACK call ariaAttributeReferences() and log out roleInfo with prefix
15+
const scriptAddition = 'ariaAttributeReferences();console.log("/* This file is generated - do not modify */ var roleInfo = "+JSON.stringify(roleInfo, null, 2));';
16+
17+
// HACK: eval!
18+
eval(scriptWithoutRespecUI + scriptAddition);

0 commit comments

Comments
 (0)