Skip to content

Commit 1cfc28e

Browse files
committed
feat: get package name from the dependencies property
Instead of getting the name from the `pkg` input and expecting it to be a valid npm package name, use the name from the dependencies property of the only installed package in the temporary work directory. This allows installing local tarball packages and reading their name after installation. See jsdocs-io/web#584
1 parent 4da365e commit 1cfc28e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/extract-package-api-effect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type { ExtractPackageApiOptions, PackageApi } from "./extract-package-api
66
import { packageDeclarations } from "./package-declarations";
77
import { packageJson } from "./package-json";
88
import { PackageManager } from "./package-manager";
9-
import { packageName } from "./package-name";
109
import { packageOverview } from "./package-overview";
1110
import { packageTypes } from "./package-types";
1211
import { workDir } from "./work-dir";
@@ -19,10 +18,11 @@ export const extractPackageApiEffect = ({
1918
}: Omit<ExtractPackageApiOptions, "bunPath">) =>
2019
Effect.gen(function* () {
2120
const startTime = performance.now();
22-
const pkgName = yield* packageName(pkg);
2321
const { path: cwd } = yield* workDir;
2422
const pm = yield* PackageManager;
2523
const packages = yield* pm.installPackage({ pkg, cwd });
24+
const workDirPkgJson = yield* packageJson(cwd);
25+
const pkgName = Object.keys(workDirPkgJson.dependencies!)[0]!;
2626
const pkgDir = join(cwd, "node_modules", pkgName);
2727
const pkgJson = yield* packageJson(pkgDir);
2828
const types = yield* packageTypes(pkgJson, subpath);

0 commit comments

Comments
 (0)