Skip to content

Commit cc73ceb

Browse files
committed
feat: add api extraction
1 parent 279abdd commit cc73ceb

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

lib/handlers/package/handle-package.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Bun, getPackageJson, getPackageTypes } from "@jsdocs-io/extractor";
1+
import { Bun, getPackageApi, getPackageJson, getPackageTypes } from "@jsdocs-io/extractor";
22
import { goTry } from "go-go-try";
33
import { join } from "pathe";
44
import { PackageApiMemDb } from "../../db/package-api-mem-db";
@@ -137,20 +137,19 @@ export async function handlePackage(slug: string) {
137137
};
138138
}
139139

140-
// // Extract the package API.
141-
// const pkgApiRes = yield * Effect.either(extractPackageApi({ pkg, subpath }));
142-
// if (Either.isLeft(pkgApiRes)) {
143-
// yield * Effect.logError(pkgApiRes.left);
144-
// return {
145-
// status: "no-api" as const,
146-
// pkgId,
147-
// subpath,
148-
// pkgJson,
149-
// generatedAt: generatedAt(),
150-
// generatedIn: generatedIn(start),
151-
// };
152-
// }
153-
// const pkgApi = pkgApiRes.right;
140+
// Extract the package API.
141+
const [pkgApiErr, pkgApi] = await goTry(getPackageApi({ pkg, subpath, bun }));
142+
if (pkgApiErr !== undefined) {
143+
log.error({ err: pkgApiErr });
144+
return {
145+
status: "pkg-has-no-api" as const,
146+
pkgId,
147+
subpath,
148+
pkgJson,
149+
generatedAt: generatedAt(),
150+
generatedIn: generatedIn(start),
151+
};
152+
}
154153

155154
// // Store the package API in the DB.
156155
// const setPkgApiRes = yield * Effect.either(db.setPackageApi({ pkg, subpath, pkgApi }));

0 commit comments

Comments
 (0)