Skip to content

Commit

Permalink
feat: allow package.json as source for name
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanowak committed Apr 30, 2024
1 parent 5e336b9 commit 214ae2d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ export async function guessPackageNameByFilePath(
if (e instanceof Error) error(e)
}
}
if (existsSync(`${filePath}/package.json`)) {
try {
const foo = path.resolve(filePath, 'package.json')
const json = readFileSync(foo, 'utf8')
packageName = JSON.parse(json)['name']
break
} catch (e) {
if (e instanceof Error) error(e)
}
}
} while (parts.length > 0)

packageNamePathMap.set(parts.join('/'), packageName)
Expand Down

0 comments on commit 214ae2d

Please sign in to comment.