angular/dgeni-packages

Error when package.json does not contain repository field

roryf opened this issue · 7 comments

Since 8194468, when my Package depends on dgeni-packages/ngdoc but the package.json does contain a repository field, attempting to run dgeni results in

var match = GITURL_REGEX.exec(packageInfo.repository.url);
^
TypeError: Cannot read property 'url' of undefined

I didn't make changes to depend on the git package directly, this works fine with 0.10.4

Dittos. Looks like the package expects repository.url to be present and to be a github.com url.

@petebacondarwin @eggers I would suggest that the git package be removed as a dependency from the ngdoc package until this can be cleaned up. There a few problems:

  1. It presumes that a project will have a repository defined in package.json, and throws exception if it's not there. Furthermore test specs expect an exception if there's no repository defined. If a user wants to use the ngdoc package without any repo details they are prevented.

    Could the package simply fetch the git repo info if it's there and leave it blank if it isn't?

  2. It presumes that the project will have a github.com url and throws exceptions if it's not. This prevents users from using BitBucket or whatever internal repo hosting they want.

  3. One of the tests wasn't set up to work on Windows but this PR should fix that: #124

I will fix this today!

Yay!

So I agree that the ngdoc package should not depend upon the git package. The git package is more like a mix-in, similar to the examples and nunjucks packages.

Landed these fixes as 0.10.16. @roryf and @c0bra can you take a look and see if it works for you?

Looks good! Thanks Pete :)