Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"test:lint": "npx eslint .",
"test:schema": "tsx scripts/schema.ts",
"test:specs": "tsx scripts/specs.ts",
"test:types": "npm run --workspaces test:types && tsc",
"test": "npm run test:caniuse -- --quiet && npm run test:schema && npm run test:specs && npm run test:format && npm run test:dist && npm run test --workspaces && npm run test:lint",
"update-drafts": "tsx scripts/update-drafts.ts"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/compute-baseline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
"types": "./dist/index.d.ts",
"type": "module",
"scripts": {
"test": "mocha -r tsx 'src/**/*.test.ts'",
"prepare": "cp ../../LICENSE.txt . && tsc",
"test:coverage": "c8 npm run test",
"prepare": "cp ../../LICENSE.txt . && tsc"
"test:types": "tsc --noEmit",
"test": "mocha -r tsx 'src/**/*.test.ts'"
},
"license": "Apache-2.0",
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions scripts/dist.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { computeBaseline, getStatus, setLogger } from "compute-baseline";
import { Compat, Feature } from "compute-baseline/browser-compat-data";
import { fdir } from "fdir";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { isDeepStrictEqual } from "node:util";
import winston from "winston";
import YAML, { Document, YAMLSeq, Scalar } from "yaml";
import YAML, { Document, Scalar, YAMLSeq } from "yaml";
import yargs from "yargs";
import { fdir } from "fdir";

const compat = new Compat();

Expand Down Expand Up @@ -101,7 +101,7 @@ function compareStatus(a: SupportStatus, b: SupportStatus) {
const bVersions = Object.values(b.support);
for (let i = 0; i < aVersions.length; i++) {
if (aVersions[i] !== bVersions[i]) {
return aVersions[i] - bVersions[i];
return Number(aVersions[i]) - Number(bVersions[i]);
}
}
return 0;
Expand Down Expand Up @@ -230,7 +230,7 @@ function insertCompatFeatures(yaml: Document, groups: Map<string, string[]>) {
return;
}

const list = new YAMLSeq();
const list = new YAMLSeq<Scalar<string>>();
for (const [comment, keys] of groups.entries()) {
let first = true;
for (const key of keys) {
Expand Down
8 changes: 5 additions & 3 deletions scripts/update-drafts.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Compat } from "compute-baseline/browser-compat-data";
import fs from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { Document } from "yaml";
import webSpecs from "web-specs" assert { type: "json" };
import { Document } from "yaml";

import { features } from "../index.js";

type WebSpecsSpec = (typeof webSpecs)[number];

function* getPages(spec): Generator<string> {
yield spec.url;
if (spec.nightly?.url) {
Expand Down Expand Up @@ -53,15 +55,15 @@ async function main() {
});

// Build a map from URLs to spec.
const pageToSpec = new Map<string, object>();
const pageToSpec = new Map<string, WebSpecsSpec>();
for (const spec of webSpecs) {
for (const page of getPages(spec)) {
pageToSpec.set(normalize(page), spec);
}
}

// Iterate BCD and group compat features by spec.
const specToCompatFeatures = new Map<object, Set<string>>();
const specToCompatFeatures = new Map<WebSpecsSpec, Set<string>>();
for (const feature of compat.walk()) {
// Skip deprecated and non-standard features.
if (feature.deprecated || !feature.standard_track) {
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"moduleResolution": "Bundler",
"esModuleInterop": true,
"resolveJsonModule": true,
}
"noEmit": true
},
"exclude": ["packages/"]
}