Skip to content

Commit b64a42a

Browse files
committed
Add README
1 parent 1f9be5b commit b64a42a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

packages/history/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# @arethetypeswrong/history
2+
3+
This package provides `@arethetypeswrong/core` analysis for every [npm-high-impact](https://github.com/wooorm/npm-high-impact) package at the latest version available on the first of every month since January 2022.
4+
5+
The analysis is saved as a 1.2 GB newline-delimited JSON file, cached in Azure Storage for incremental updates going forward, compressed down to 34 MB for shipping to npm, and accessible in Node as a JavaScript object via a small programmatic interface.
6+
7+
## Usage
8+
9+
```ts
10+
import { getAllDataAsObject, getVersionsByDate } from "@arethetypeswrong/history";
11+
12+
const dates = await getVersionsByDate();
13+
const data = await getAllDataAsObject();
14+
15+
function getPackagesWithFalseCJSProblems(date) {
16+
const packages = dates[date];
17+
const result = [];
18+
for (const { packageName, packageVersion } of packages) {
19+
const analysis = data[`${packageName}@${packageVersion}`];
20+
// `analysis` is undefined if the package doesn't contain types
21+
if (analysis?.problems.some((p) => p.kind === "FalseESM")) {
22+
result.push(analysis);
23+
}
24+
}
25+
return result;
26+
}
27+
28+
const mayFalseESMProblems = getPackagesWithFalseCJSProblems("2023-05-01").length;
29+
const juneFalseESMProblems = getPackagesWithFalseCJSProblems("2023-06-01").length;
30+
console.log({ mayFalseESMProblems, juneFalseESMProblems });
31+
```

0 commit comments

Comments
 (0)