Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs(api/dart): add support for generation and display #1888

Merged
merged 1 commit into from
Jul 15, 2016

Conversation

chalin
Copy link
Contributor

@chalin chalin commented Jul 14, 2016

Fixes #1880, which has a detailed task breakdown.
Supersedes #1593.

Note about the API subsite design: I had to resort to using Jade extends/includes; hence disabling Harp _layout/partials.

cc: @naomiblack @kwalrath @ferhatb @keertip

@chalin
Copy link
Contributor Author

chalin commented Jul 14, 2016

@wardbell @Foxandxss : ready for review.

@chalin
Copy link
Contributor Author

chalin commented Jul 14, 2016

I forgot to mention that to build the docs do: an install (which patches terraforma), and then check-deploy.

Prerequisite: Ensure that you have the angular.io and Angular/Dart repos repos in the same directory, and the later must be named angular-dart --- if it isn't just create a link with that name pointing to the actual repo.

Commands:
Setup

./scripts/before-install.sh
./scripts/install.sh # this script now does the necessary patching

If you just want to build the Dart API docs:

gulp build-dart-api-docs --dgeni-log=warn  # drop the flag if you want `info` level messages as usual
gulp serve # to see the results at http://localhost:9000/

If you want to build all the docs:

gulp check-deploy --dgeni-log=warn  # drop the flag if you want `info` level messages as usual

@kwalrath
Copy link
Contributor

Taking a look... First impression: nice!

The second thing I noticed is the lack of a language dropdown at /docs/dart/latest/api/ (or any page under it). Would it be possible to add it? (And add some reasonable behavior in the likely case that there's no equivalent page at the dart -> ts/js version of the URL.)

If a dropdown isn't practical, we should put "Dart" in that space, so it's easier to tell that you're in the Dart version of the API docs.

@chalin
Copy link
Contributor Author

chalin commented Jul 14, 2016

I chose to leave out the dropdown because IMHO maintaining a complete dart <-> ts/js mapping might be tricky and not really worth the effort (we can open a separate issue as a "feature request" so that we can track discussion about it). Leaving the dropdown there with only Dart is a good idea. I'll look into it.

@chalin chalin force-pushed the chalin-dart-api-doc-gen-0714 branch from 31f8840 to b374e9a Compare July 14, 2016 23:35
@chalin
Copy link
Contributor Author

chalin commented Jul 14, 2016

@filipesilva @Foxandxss @wardbell : I just rebased. Note the following change:

  • Renamed 'harp-compile' to 'check' (as in check-deploy without the deploy :).
  • Created new 'harp-compile' that only does a harp compile; i.e., doesn't depend on 'build-docs' (where as 'check' does).

This makes it easier to selectively rebuild only parts of the docs and then quickly get harp to start compiling.

@filipesilva
Copy link
Contributor

@chalin that change lgtm

@chalin
Copy link
Contributor Author

chalin commented Jul 15, 2016

@kwalrath : I've created #1895 for the API page language-cross-referencing issue. I'd like to suggest that nothing be done in the scope of this PR. We can explore the range of alternative solutions via #1895 and a follow up PR. Thoughts?

@kwalrath
Copy link
Contributor

LGTM.

@kwalrath
Copy link
Contributor

@filipesilva @Foxandxss @wardbell @naomiblack: Unless you object, I plan to merge this after confirming that I can, indeed, generate the docs. 2 pm Pacific time is my goal.

@chalin chalin force-pushed the chalin-dart-api-doc-gen-0714 branch 2 times, most recently from 9c65189 to 8e0911b Compare July 15, 2016 19:45
@wardbell
Copy link
Contributor

Please no gulp task called check Check what? I don't approve.

I do understand the impulse. It comes down to naming. I strongly prefer one of these alternatives (in my preferred order)

  1. an option on harp-compile such as harp-compile --no-build
  2. new build-compile task that is check-deploy without the deploy.

return execPromise('npm run live-server ./www');
});

gulp.task('check', ['build-docs'], function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be build-compile

@wardbell
Copy link
Contributor

Please also update the READM.md to explain these gulp tasks-and-options.

Otherwise, LGTM

@chalin chalin force-pushed the chalin-dart-api-doc-gen-0714 branch from 8e0911b to da9f950 Compare July 15, 2016 20:16
@chalin
Copy link
Contributor Author

chalin commented Jul 15, 2016

@wardbell : named changed to build-compile.

More install / travis / gulpfile changes are on their way (to support Dart API docs building). I'll update the README then.

Fixes angular#1880.
Supersedes angular#1593.
### Task breakdown

**Package dependencies:**
- [ ] [**BLOCKING**] Update to new [harp](https://github.com/sintaxi/harp) package which depends on latest [terraform](https://github.com/sintaxi/terraform) release. This is needed so that dots (`.`) can be supported in site URIs; something that is essential for Dart given that library names contain dots. See sintaxi/harp#526 (/cc @sintaxi).<br>Blocked awaiting the new release.

**Gulp tasks / build scripts:**
- [x] New tasks to run `pub` and `dartdoc` over (existing) `angular-dart` repo, peer to ng.io repo.
- [x] `build-api-docs` should also do Dart API docs.
- [x] Shredder should run over Dart sources and generate example fragments.
- [x] Create script to patch local `terraform` package, while we await new harp release, as a means of **unblocking**.

**Generator package:**
- [x] New `tools/dart-api-builder`; stand alone tool re-using part of the basis of a Dart API dgeni package.

**Harp/Jade site infrastructure:**
- [x] New `public/docs/_layout-dart-api.jade`.
- [x] Updates to other Harp/Jade template files.

**API List directive:**
- [x] Create new or update existing `<api-list>` directive:
  - [x] Display only filter categories that are relevant to Dart.

**Site data and Jade file generation:**
- [x] Main API page
  - [x] Generate `api-list.json`.
  - [x] Add warning that API is preliminary and that code might still appear as TS.
- [x] Generate data (`_data.json`) and Jade files for
  - [x] For each library (i.e., top-level folder).
    - [x] `_data.json`
    - [x] Library "index" Jade page.
    - [x] Each member Jade page.
  - [x] For library subfolders (e.g., containing class member details).
    - [x] `_data.json`
    - [x] Folder "index" page (it actually has the same name as the container -- e.g., class name).
    - [x] Each member page.
- [x] API Jade file page contents:
  - [x] Attributes like name and type
  - [x] Breadcrumbs
  - [ ] Page header section tabs.
  - [x] Core page content excerpt from dartdoc-generated page
    - [x] Exclude the "left" nav menu (full ng2 package content list) from the core page content.
  - [x] `{@example ...}` tags are replaced by their designated example code fragments.
- [x] Filter generated API pages (configurable via regExp in build file): exclude entries from
  - [x] Non-public, developer/internal libraries.
  - [x] Top-level catch all `angular2` library -- otherwise every entry appears twice.
- [x] Support developer & production modes for data (JSON) file generation
  - [x] Developer mode (pretty-printed).
  - [x] [NOT implemented] ~~Production mode (compact).~~

Note about the API subsite design:
- I had to resort to using Jade extends/includes; hence disabling Harp _layout/partials.

cc: @naomiblack @kwalrath @ferhatb @keertip
@chalin chalin force-pushed the chalin-dart-api-doc-gen-0714 branch from da9f950 to dd96229 Compare July 15, 2016 20:21
@wardbell
Copy link
Contributor

LGTM. @kwalrath is free to merge 👍

@kwalrath kwalrath merged commit 1bef20a into angular:master Jul 15, 2016
@chalin chalin deleted the chalin-dart-api-doc-gen-0714 branch July 15, 2016 21:24
@chalin
Copy link
Contributor Author

chalin commented Jul 15, 2016

Design note (cc @petebacondarwin): while originally I started writing a dgeni package for Dart API processing, I ran into problems -- due to my lack of mastery of the dgeni framework --- and so, in the hopes of making some progress, I switched to building a stand alone transformer from the dgeni package parts. Maybe this can be revised later, or, I might just write a revised API page generator in Dart :).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants