Skip to content

Commit 89e4668

Browse files
hyperpolymathclaude
andcommitted
chore: γ-fallback strip TypeScript types from Node-bound packages
Per the AffineScript-or-strip-types policy: where AffineScript Node-target isn't yet ready (issue affinescript#35 still mid-flight), Node-bound TS packages take the γ fallback — pure type-stripping via ts-blank-space, producing equivalent JS at the same source positions. Stripped (19 files, .ts → .js / .tsx → .jsx): - tools/cli/{src/cli, tests/cli_test} - tools/github-action/{src/index, tests/action_test} - tools/monitoring-api/src/{server, routes/{badge,dashboard,leaderboard,scan,stats,violations}} - tools/monitoring-api/tests/{aspect/security_test, benches/api_bench, e2e/api_test, property/scanner_properties_test} - tools/stale/packages/core/src/{index, database/arangodb} - tools/stale/packages/scanner/src/{index, scanner} Per-package package.json: - typescript / ts-node / ts-node-dev / @types/* dropped from devDependencies - main repointed from dist/*.js → src/*.js (no transpile step needed) - "type": "module" added (ESM, matches the strip-types output) - "build": "tsc" removed where it had no remaining purpose - tools/cli bin paths updated dist → src/cli.js tsconfig.json removed in all 5 Node-bound packages. React component package (@accessibility-everywhere/react) NOT touched — that one is browser/wasm-targetable today and goes to AffineScript next. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5773bca commit 89e4668

30 files changed

Lines changed: 320 additions & 432 deletions

tools/cli/package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"name": "@accessibility-everywhere/cli",
33
"version": "1.0.0",
44
"description": "Command-line tool for accessibility scanning",
5-
"main": "dist/index.js",
5+
"main": "src/cli.js",
6+
"type": "module",
67
"bin": {
7-
"a11y-scan": "dist/cli.js",
8-
"accessibility-scan": "dist/cli.js"
8+
"a11y-scan": "src/cli.js",
9+
"accessibility-scan": "src/cli.js"
910
},
1011
"scripts": {
11-
"build": "tsc",
12-
"dev": "ts-node src/cli.ts",
12+
"start": "node src/cli.js",
1313
"test": "jest"
1414
},
1515
"dependencies": {
@@ -21,9 +21,6 @@
2121
"fs-extra": "^11.2.0"
2222
},
2323
"devDependencies": {
24-
"@types/node": "^20.10.0",
25-
"@types/fs-extra": "^11.0.4",
26-
"typescript": "^5.3.2",
27-
"ts-node": "^10.9.2"
24+
"jest": "^29.7.0"
2825
}
2926
}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ program
2424
.option('-o, --output <file>', 'Output file for results (JSON)')
2525
.option('-f, --format <format>', 'Output format (json, table, markdown)', 'table')
2626
.option('--screenshot', 'Take screenshot')
27-
.action(async (url: string, options: any) => {
27+
.action(async (url , options ) => {
2828
const spinner = ora('Scanning for accessibility issues...').start();
2929

3030
try {
@@ -70,7 +70,7 @@ program
7070
colWidths: [12, 50, 10, 15],
7171
});
7272

73-
result.violations.forEach((v: any) => {
73+
result.violations.forEach((v ) => {
7474
violationsTable.push([
7575
getImpactColor(v.impact) + v.impact + chalk.reset(),
7676
v.description,
@@ -97,7 +97,7 @@ program
9797

9898
// Exit with error code if violations found
9999
process.exit(result.violations.length > 0 ? 1 : 0);
100-
} catch (error: any) {
100+
} catch (error ) {
101101
spinner.fail('Scan failed');
102102
console.error(chalk.red(error.message));
103103
process.exit(1);
@@ -112,7 +112,7 @@ program
112112
.option('-l, --level <level>', 'WCAG level (A, AA, AAA)', 'AA')
113113
.option('--min-score <score>', 'Minimum required score', '70')
114114
.option('--fail-on-violations', 'Fail if any violations found')
115-
.action(async (url: string, options: any) => {
115+
.action(async (url , options ) => {
116116
const spinner = ora('Running CI scan...').start();
117117

118118
try {
@@ -142,7 +142,7 @@ program
142142

143143
console.log(chalk.green('✓ Passed all checks'));
144144
process.exit(0);
145-
} catch (error: any) {
145+
} catch (error ) {
146146
spinner.fail('CI scan failed');
147147
console.error(chalk.red(error.message));
148148
process.exit(1);
@@ -156,7 +156,7 @@ program
156156
.argument('<file>', 'File containing URLs (one per line)')
157157
.option('-l, --level <level>', 'WCAG level (A, AA, AAA)', 'AA')
158158
.option('-o, --output <dir>', 'Output directory for results', './scan-results')
159-
.action(async (file: string, options: any) => {
159+
.action(async (file , options ) => {
160160
try {
161161
const urls = (await fs.readFile(file, 'utf-8'))
162162
.split('\n')
@@ -186,7 +186,7 @@ program
186186

187187
spinner.succeed(`${url} - Score: ${result.score}`);
188188
completed++;
189-
} catch (error: any) {
189+
} catch (error ) {
190190
spinner.fail(`${url} - ${error.message}`);
191191
failed++;
192192
}
@@ -196,29 +196,29 @@ program
196196
if (failed > 0) {
197197
console.log(chalk.red(`✗ Failed: ${failed}`));
198198
}
199-
} catch (error: any) {
199+
} catch (error ) {
200200
console.error(chalk.red(error.message));
201201
process.exit(1);
202202
}
203203
});
204204

205205
// Helper functions
206-
function getGrade(score: number): string {
206+
function getGrade(score ) {
207207
if (score >= 90) return 'A';
208208
if (score >= 80) return 'B';
209209
if (score >= 70) return 'C';
210210
if (score >= 60) return 'D';
211211
return 'F';
212212
}
213213

214-
function getScoreColor(score: number): string {
214+
function getScoreColor(score ) {
215215
if (score >= 90) return chalk.green.bold('');
216216
if (score >= 70) return chalk.yellow.bold('');
217217
return chalk.red.bold('');
218218
}
219219

220-
function getImpactColor(impact: string): string {
221-
const colors: Record<string, any> = {
220+
function getImpactColor(impact ) {
221+
const colors = {
222222
critical: chalk.red.bold(''),
223223
serious: chalk.red(''),
224224
moderate: chalk.yellow(''),
@@ -227,13 +227,13 @@ function getImpactColor(impact: string): string {
227227
return colors[impact] || '';
228228
}
229229

230-
function generateMarkdown(result: any, url: string): string {
230+
function generateMarkdown(result , url ) {
231231
let md = `# Accessibility Report\n\n`;
232232
md += `**URL:** ${url}\n`;
233233
md += `**Score:** ${result.score}/100\n\n`;
234234
md += `## Violations\n\n`;
235235

236-
result.violations.forEach((v: any, i: number) => {
236+
result.violations.forEach((v , i ) => {
237237
md += `### ${i + 1}. ${v.help}\n\n`;
238238
md += `- **Impact:** ${v.impact}\n`;
239239
md += `- **Instances:** ${v.nodes.length}\n`;
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class MockCLI {
1515
version = "1.0.0";
1616
name = "accessibility-scan";
1717

18-
help(): string {
18+
help() {
1919
return `
2020
${this.name} v${this.version}
2121
Command-line tool for accessibility scanning
@@ -46,7 +46,7 @@ EXAMPLES:
4646
`;
4747
}
4848

49-
validateUrl(url: string): { valid: boolean; error?: string } {
49+
validateUrl(url ) {
5050
try {
5151
new URL(url);
5252
return { valid: true };
@@ -58,15 +58,15 @@ EXAMPLES:
5858
}
5959
}
6060

61-
parseArgs(args: string[]): {
62-
command?: string;
63-
url?: string;
64-
options: Record<string, string | boolean>;
65-
error?: string;
66-
} {
67-
const options: Record<string, string | boolean> = {};
68-
let command: string | undefined;
69-
let url: string | undefined;
61+
parseArgs(args )
62+
63+
64+
65+
66+
{
67+
const options = {};
68+
let command ;
69+
let url ;
7070

7171
for (let i = 0; i < args.length; i++) {
7272
const arg = args[i];

tools/cli/tsconfig.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

tools/github-action/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
"name": "@accessibility-everywhere/github-action",
33
"version": "1.0.0",
44
"description": "GitHub Action for automated accessibility testing",
5-
"main": "dist/index.js",
5+
"main": "src/index.js",
6+
"type": "module",
67
"scripts": {
7-
"build": "tsc && ncc build dist/index.js -o dist",
8+
"build": "ncc build src/index.js -o dist",
89
"test": "jest"
910
},
1011
"dependencies": {
@@ -13,8 +14,7 @@
1314
"@accessibility-everywhere/scanner": "^1.0.0"
1415
},
1516
"devDependencies": {
16-
"@types/node": "^20.10.0",
1717
"@vercel/ncc": "^0.38.1",
18-
"typescript": "^5.3.2"
18+
"jest": "^29.7.0"
1919
}
2020
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ async function run() {
66
try {
77
// Get inputs
88
const url = core.getInput('url', { required: true });
9-
const wcagLevel = core.getInput('wcag-level') as 'A' | 'AA' | 'AAA';
9+
const wcagLevel = core.getInput('wcag-level') ;
1010
const failOnViolations = core.getInput('fail-on-violations') === 'true';
1111
const minScore = parseInt(core.getInput('min-score') || '0');
1212
const commentPR = core.getInput('comment-pr') === 'true';
@@ -67,12 +67,12 @@ async function run() {
6767
if (result.violations.length === 0 && result.score >= minScore) {
6868
core.info('✓ Accessibility check passed!');
6969
}
70-
} catch (error: any) {
70+
} catch (error ) {
7171
core.setFailed(`Action failed: ${error.message}`);
7272
}
7373
}
7474

75-
function generateSummary(result: any, url: string, wcagLevel: string): string {
75+
function generateSummary(result , url , wcagLevel ) {
7676
const grade = getGrade(result.score);
7777
const gradeEmoji = {
7878
A: '🟢',
@@ -96,8 +96,8 @@ function generateSummary(result: any, url: string, wcagLevel: string): string {
9696

9797
if (result.violations.length > 0) {
9898
markdown += `## Violations\n\n`;
99-
result.violations.slice(0, 10).forEach((v: any, i: number) => {
100-
const impact = v.impact as 'critical' | 'serious' | 'moderate' | 'minor';
99+
result.violations.slice(0, 10).forEach((v , i ) => {
100+
const impact = v.impact ;
101101
const impactEmoji = {
102102
critical: '🔴',
103103
serious: '🟠',
@@ -123,7 +123,7 @@ function generateSummary(result: any, url: string, wcagLevel: string): string {
123123
return markdown;
124124
}
125125

126-
async function postPRComment(token: string, result: any, url: string, wcagLevel: string) {
126+
async function postPRComment(token , result , url , wcagLevel ) {
127127
const octokit = github.getOctokit(token);
128128
const { context } = github;
129129

@@ -140,7 +140,7 @@ async function postPRComment(token: string, result: any, url: string, wcagLevel:
140140
});
141141
}
142142

143-
function getGrade(score: number): string {
143+
function getGrade(score ) {
144144
if (score >= 90) return 'A';
145145
if (score >= 80) return 'B';
146146
if (score >= 70) return 'C';
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,51 @@ import {
1111
} from "https://deno.land/std@0.208.0/assert/mod.ts";
1212

1313
// Mock GitHub Action input/output
14-
interface ActionInput {
15-
url?: string;
16-
"wcag-level"?: string;
17-
"fail-on-violations"?: string;
18-
"min-score"?: string;
19-
"comment-pr"?: string;
20-
"github-token"?: string;
21-
}
22-
23-
interface ActionOutput {
24-
score?: number;
25-
violations?: number;
26-
passes?: number;
27-
"report-url"?: string;
28-
}
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
2929

3030
class MockGitHubAction {
31-
private inputs: ActionInput = {};
32-
private outputs: ActionOutput = {};
31+
inputs = {};
32+
outputs = {};
3333

34-
setInput(name: string, value: string): void {
35-
this.inputs[name as keyof ActionInput] = value;
34+
setInput(name , value ) {
35+
this.inputs[name ] = value;
3636
}
3737

38-
getInput(name: string, required = false): string | undefined {
39-
const value = this.inputs[name as keyof ActionInput];
38+
getInput(name , required = false) {
39+
const value = this.inputs[name ];
4040
if (required && !value) {
4141
throw new Error(`Input required and not supplied: ${name}`);
4242
}
4343
return value;
4444
}
4545

46-
setOutput(name: string, value: unknown): void {
47-
this.outputs[name as keyof ActionOutput] = value as never;
46+
setOutput(name , value ) {
47+
this.outputs[name ] = value ;
4848
}
4949

50-
getOutputs(): ActionOutput {
50+
getOutputs() {
5151
return this.outputs;
5252
}
5353

54-
validateInputs(): {
55-
valid: boolean;
56-
errors: string[];
57-
} {
58-
const errors: string[] = [];
54+
validateInputs()
55+
56+
57+
{
58+
const errors = [];
5959

6060
// Check required input: url
6161
if (!this.getInput("url")) {
@@ -93,11 +93,11 @@ class MockGitHubAction {
9393
};
9494
}
9595

96-
generateSummary(result: {
97-
score: number;
98-
violations: unknown[];
99-
passes: unknown[];
100-
}): string {
96+
generateSummary(result
97+
98+
99+
100+
) {
101101
const grade =
102102
result.score >= 90
103103
? "A"

0 commit comments

Comments
 (0)