-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_unstable_apis.ts
46 lines (42 loc) · 1.28 KB
/
get_unstable_apis.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import $ from "@david/dax";
import { getWorkspacePackageConfigs, isUnstable } from "./utils.ts";
import { join } from "@std/path";
import { join as posixJoin } from "@std/path/posix";
type UnstableApiProfile = {
package: string;
export: string;
specifier: string;
path: string;
startedAt: Date;
};
async function getPathStartedDate(path: string): Promise<Date> {
const date = await $`git log --format=%ad --date=short ${path} | tail -1`
.cwd("std")
.text();
return new Date(date);
}
async function main() {
const configs = await getWorkspacePackageConfigs();
const stables = configs.filter((config) => !isUnstable(config));
const unstableApiProfiles = [] as UnstableApiProfile[];
for (const config of stables) {
for (const [name, relPath] of Object.entries(config.exports)) {
if (name.includes("unstable-")) {
const path = join(config.path, relPath);
unstableApiProfiles.push({
package: config.name,
export: name,
specifier: posixJoin(config.name, name),
path,
startedAt: await getPathStartedDate(path),
});
}
}
}
console.log(unstableApiProfiles);
await Deno.writeTextFile(
"unstable_apis.json",
JSON.stringify(unstableApiProfiles, null, 2) + "\n",
);
}
main();