Skip to content

Commit d9a6585

Browse files
bjnewmanBenjamin Newman
andauthored
fix: handle missing name/version in package.json (#151)
* fix: handle missing name/version in package.json When analyzing monorepos, the root package.json may not have name or version fields, causing a crash in the analyze command. This adds fallback values consistent with computeInfo(). * fix: default version to 0.0.0 for valid semver --------- Co-authored-by: Benjamin Newman <benjaminnewman@Benjamins-Laptop.local>
1 parent 65cb386 commit d9a6585

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/analyze/report.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export async function report(options: Options) {
7777
);
7878

7979
const stats: Stats = {
80-
name: packageFile.name,
81-
version: packageFile.version,
80+
name: packageFile.name || 'unknown',
81+
version: packageFile.version || '0.0.0',
8282
dependencyCount: {
8383
production: 0,
8484
development: 0,

0 commit comments

Comments
 (0)