Skip to content
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
10 changes: 8 additions & 2 deletions src/pkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ 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) {
console.log(
'Package manifest',
packagePath,
'should contain name and version.'
'should contain name'
)
return null
}
if (!pkg.version) {
console.log(
'No version found in package manifest, using 0.0.1'
)
pkg.version = '0.0.1'
}
const indent = getIndent(fileData) || ' '
pkg.__Indent = indent
return pkg
Expand Down