angular-cn/aio
mgechev da14391cff docs(aio): update resource for codelyzer (#18742)
PR Close #18742
2017-08-18 13:23:26 -05:00
..
aio-builds-setup fix(aio): skip PWA test when redeploying non-public commit 2017-08-10 15:59:00 -07:00
content docs(aio): update resource for codelyzer (#18742) 2017-08-18 13:23:26 -05:00
e2e fix(aio): temporarily remove link to source from the API pages (#17371) 2017-06-09 14:14:39 -07:00
scripts build(aio): upgrade `zone.js` to 0.8.16 2017-08-15 15:13:47 -07:00
src test(aio): fix error logged during tests (#18659) 2017-08-18 13:23:16 -05:00
tools test(aio): fix running docs examples against local builds (#18520) 2017-08-09 14:21:10 -07:00
.angular-cli.json ci(aio): compute AIO deployment mode 2017-08-04 09:13:34 -07:00
.gitignore fix(aio): use locally hosted lunr library 2017-06-13 11:26:35 +01:00
README.md feat(aio): serve-and-sync command (#17850) 2017-07-06 11:51:58 -07:00
database.rules.json build(aio): big move of docs related files (#14361) 2017-02-09 11:58:36 -08:00
firebase.json fix(aio): correctly redirect `cookbook/a1-a2-quick-reference.html` (#18418) 2017-08-02 15:54:22 -07:00
karma.conf.js build(aio): use cli 1.3.0-rc (#18290) 2017-08-02 15:37:03 -07:00
ngsw-manifest.json refactor(aio): move content-specific images to `content/images/` 2017-07-28 15:06:49 -07:00
package.json build(aio): upgrade `zone.js` to 0.8.16 2017-08-15 15:13:47 -07:00
protractor.conf.js build(aio): update project config for @angular/cli v1.0.0 2017-03-27 11:55:26 -07:00
tsconfig.json build(aio): IDEs should only parse the `src` files 2017-04-19 08:36:05 +01:00
tslint.json test(aio): enable tslint rule for focused jasmine tests/suites 2017-04-01 20:56:16 +01:00
yarn.lock build(aio): switch from `@angular/http` to `@angular/common/http` 2017-08-15 15:13:47 -07:00

README.md

Angular documentation project (https://angular.io)

Everything in this folder is part of the documentation project. This includes

  • the web site for displaying the documentation
  • the dgeni configuration for converting source files to rendered files that can be viewed in the web site.
  • the tooling for setting up examples for development; and generating plunkers and zip files from the examples.

Developer tasks

We use yarn to manage the dependencies and to run build tasks. You should run all these tasks from the angular/aio folder. Here are the most important tasks you might need to use:

  • yarn - install all the dependencies.

  • yarn setup - Install all the dependencies, boilerplate, plunkers, zips and runs dgeni on the docs.

  • yarn start - run a development web server that watches the files; then builds the doc-viewer and reloads the page, as necessary.

  • yarn serve-and-sync - run both the docs-watch and start in the same console.

  • yarn lint - check that the doc-viewer code follows our style rules.

  • yarn test - watch all the source files, for the doc-viewer, and run all the unit tests when any change.

  • yarn e2e - run all the e2e tests for the doc-viewer.

  • yarn docs - generate all the docs from the source files.

  • yarn docs-watch - watch the Angular source and the docs files and run a short-circuited doc-gen for the docs that changed.

  • yarn docs-lint - check that the doc gen code follows our style rules.

  • yarn docs-test - run the unit tests for the doc generation code.

  • yarn boilerplate:add - generate all the boilerplate code for the examples, so that they can be run locally.

  • yarn boilerplate:remove - remove all the boilerplate code that was added via yarn boilerplate:add.

  • yarn generate-plunkers - generate the plunker files that are used by the live-example tags in the docs.

  • yarn generate-zips - generate the zip files from the examples. Zip available via the live-example tags in the docs.

  • yarn example-e2e - run all e2e tests for examples

    • yarn example-e2e -- --setup - force webdriver update & other setup, then run tests
    • yarn example-e2e -- --filter=foo - limit e2e tests to those containing the word "foo"
  • yarn build-ie-polyfills - generates a js file of polyfills that can be loaded in Internet Explorer.

Using ServiceWorker locally

Since abb36e3cb, running yarn start -- --prod will no longer set up the ServiceWorker, which would require manually running yarn sw-manifest and yarn sw-copy (something that is not possible with webpack serving the files from memory).

If you want to test ServiceWorker locally, you can use yarn build and serve the files in dist/ with yarn http-server -- dist -p 4200.

For more details see #16745.

Guide to authoring

There are two types of content in the documentatation:

  • API docs: descriptions of the modules, classes, interfaces, decorators, etc that make up the Angular platform. API docs are generated directly from the source code. The source code is contained in TypeScript files, located in the angular/packages folder. Each API item may have a preceding comment, which contains JSDoc style tags and content. The content is written in markdown.

  • Other content: guides, tutorials, and other marketing material. All other content is written using markdown in text files, located in the angular/aio/content folder. More specifically, there are sub-folders that contain particular types of content: guides, tutorial and marketing.

We use the dgeni tool to convert these files into docs that can be viewed in the doc-viewer.

The Authors Style Guide prescribes guidelines for writing guide pages, explains how to use the documentation classes and components, and how to markup sample source code to produce code snippets.

Generating the complete docs

The main task for generating the docs is yarn docs. This will process all the source files (API and other), extracting the documentation and generating JSON files that can be consumed by the doc-viewer.

Partial doc generation for editors

Full doc generation can take up to one minute. That's too slow for efficient document creation and editing.

You can make small changes in a smart editor that displays formatted markdown:

In VS Code, Cmd-K, V opens markdown preview in side pane; Cmd-B toggles left sidebar

You also want to see those changes displayed properly in the doc viewer with a quick, edit/view cycle time.

For this purpose, use the yarn docs-watch task, which watches for changes to source files and only re-processes the the files necessary to generate the docs that are related to the file that has changed. Since this task takes shortcuts, it is much faster (often less than 1 second) but it won't produce full fidelity content. For example, links to other docs and code examples may not render correctly. This is most particularly noticed in links to other docs and in the embedded examples, which may not always render correctly.

The general setup is as follows:

  • Open a terminal, ensure the dependencies are installed; run an initial doc generation; then start the doc-viewer:
yarn
yarn docs
yarn start
  • Open a second terminal and start watching the docs
yarn docs-watch
  • Open a browser at https://localhost:4200/ and navigate to the document on which you want to work. You can automatically open the browser by using yarn start -- -o in the first terminal.

  • Make changes to the page's associated doc or example files. Every time a file is saved, the doc will be regenerated, the app will rebuild and the page will reload.