-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
- Running `grunt doc` will generate API docs for the host project in an _apidocs/ directory. - Use '--publish-api' command line flag to enable publishing - Publishing is further controlled by a 'shouldPush' function that can be specified in publishOptions. If this function returns a falsey value, the docs won't be published. The default implementation of this function is intended for use in a Travis-CI build. This task currently relies on typedoc master (0.5.5+).
Oh, I suppose I should have added some tests... |
tasks/typedoc.ts
Outdated
|
||
// TODO: typedoc <= 0.5.5 breaks TS's automatic type discovery, and also leaves out important | ||
// compiler flags like strictNullChecks. Fake the type discovery, and ignore remaining errors. | ||
const typedocInfo = grunt.file.readJSON(require.resolve('typedoc/package.json')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if this section were broken out into a function so we could remove it someday in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree -- I actually already did that while writing the tests. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good and it's well compartmentalized so it's inclusion won't have an affect on any other area.
IIRC, Jason said he'd be adding tests
- Add unit tests - General cleanup
Codecov Report
@@ Coverage Diff @@
## master #103 +/- ##
==========================================
+ Coverage 92.26% 92.44% +0.17%
==========================================
Files 12 13 +1
Lines 388 450 +62
==========================================
+ Hits 358 416 +58
- Misses 30 34 +4
Continue to review full report at Codecov.
|
@@ -0,0 +1,97 @@ | |||
import ITask = grunt.task.ITask; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can submit an upstream fix for Grunt to not preface their interfaces with I ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could submit a PR, but this seems to be a pretty common practice in DefinitelyTyped (around 450 packages prefix interface names with I). It might be more worthwhile to submit a discussion issue to DT asking if the no-I style (and possibly other styles in the TS Coding Guidelines) should become a general recommendation.
This PR adds a typedoc task with support for publishing docs to a repo's gh-pages branch. The PR includes code for mitigating some issues with typedoc <= 0.5.5 that should be unnecessary for 0.5.6+.
Running
grunt doc
will install necessary types and generate API documentation. Adding a--publish-api
option will attempt to publish the API docs to the repo's gh-pages branch.