Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add clear error message for missing 'version' in package.json #242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: Add clear error message for missing 'version' in package.json
This commit introduces error handling improvements for cases where the 'version' key is absent in package.json. Previously, the error thrown did not clearly indicate the issue was related to the missing 'version' key, leading to confusion. Now, the application checks for the 'version' key early in the command execution process and provides a clear and descriptive error message if it is not found.
ElayGelbart committed May 21, 2024

Verified

This commit was signed with the committer’s verified signature.
commit 9098268ec48f1726471aa46f76c3033156080ac7
2 changes: 1 addition & 1 deletion src/pkg.ts
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ export function readPackageManifest(workingDir: string) {
try {
const fileData = fs.readFileSync(packagePath, 'utf-8')
pkg = JSON.parse(fileData) as PackageManifest
if (!pkg.name && pkg.version) {
if (!pkg.name || !pkg.version) {
console.log(
'Package manifest',
packagePath,