Skip to content

Commit

Permalink
Use the live list of browser specs instead of the pnpm-installed vers…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
jyasskin committed Nov 22, 2023
1 parent 545cd5a commit b6b67d9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"@octokit/plugin-throttling": "^8.1.2",
"@octokit/request-error": "^5.0.1",
"astro": "^3.2.4",
"browser-specs": "^3.70.0",
"colorjs.io": "^0.4.5",
"commander": "^11.1.0",
"csv-stringify": "^6.4.4",
Expand Down
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions scanner/browser-specs.d.ts

This file was deleted.

15 changes: 15 additions & 0 deletions scanner/browser-specs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import z from 'zod';

const BrowserSpecs = z.object({
nightly: z.object({
repository: z.string().url().optional(),
})
}).array();

export type BrowserSpecs = z.infer<typeof BrowserSpecs>;

export async function browserSpecs() {
return BrowserSpecs.parse(
await fetch('https://raw.githubusercontent.com/w3c/browser-specs/browser-specs%40latest/index.json'
).then(response => response.json()));
}
4 changes: 2 additions & 2 deletions scanner/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Octokit as OctokitCore } from '@octokit/core';
import { paginateGraphql } from '@octokit/plugin-paginate-graphql';
import { throttling } from '@octokit/plugin-throttling';
import { RequestError } from "@octokit/request-error";
import specs from 'browser-specs' assert { type: "json" };
import fs from 'node:fs/promises';
import { browserSpecs } from "./browser-specs.js";
import config from './third_party/config.cjs';

const Octokit = OctokitCore.plugin(throttling, paginateGraphql);
Expand Down Expand Up @@ -537,7 +537,7 @@ async function analyzeRepo(org: string, repoName: string, globalStats: GlobalSta

async function main() {
const repos = new Set<string>();
for (const spec of specs) {
for (const spec of await browserSpecs()) {
const repo = spec.nightly.repository;
if (repo) {
repos.add(repo);
Expand Down

0 comments on commit b6b67d9

Please sign in to comment.