build(aio): big move of docs related files (#14361)

All the docs related files (docs-app, doc-gen, content, etc)
are now to be found inside the `/aio` folder.

The related gulp tasks have been moved from the top level
gulp file to a new one inside the `/aio` folder.

The structure of the `/aio` folder now looks like:

```
/aio/
  build/         # gulp tasks
  content/       #MARKDOWN FILES for devguides, cheatsheet, etc
    devguides/
    cheatsheets/
  transforms/    #dgeni packages, templates, etc
  src/
    app/
    assets/
    content/    #HTML + JSON build artifacts produced by dgeni from /aio/content.
                #This dir is .gitignored-ed
  e2e/           #protractor tests for the doc viewer app
  node_modules/ #dependencies for both the doc viewer builds and the dgeni stuff
                #This dir is .gitignored-ed
  gulpfile.js   #Tasks for generating docs and building & deploying the doc viewer
```

Closes #14361
This commit is contained in:
Pete Bacon Darwin 2017-02-09 19:58:36 +00:00 committed by Igor Minar
parent 5e7a2fa854
commit 600402d440
437 changed files with 855 additions and 531 deletions

6
.gitignore vendored
View File

@ -3,7 +3,6 @@
/dist/
node_modules
bower_components
angular.io/dist
# Include when developing application packages.
pubspec.lock
@ -28,5 +27,6 @@ npm-debug.log
/modules/rollup-test/dist/
# angular.io
/angular.io/node_modules/
/angular.io/dist/
/aio/node_modules
/aio/src/content/docs
/aio/dist

View File

@ -36,7 +36,7 @@ groups:
include:
- "*"
exclude:
- "angular.io/*"
- "aio/*"
- "integration/*"
- "modules/*"
- "tools/*"
@ -236,7 +236,7 @@ groups:
angular.io:
conditions:
files:
- "angular.io/*"
- "aio/*"
users:
- IgorMinar
- robwormald

View File

@ -21,7 +21,7 @@ cache:
directories:
- ./node_modules
- ./.chrome/chromium
- ./angular.io/node_modules
- ./aio/node_modules
env:
global:

View File

@ -227,7 +227,7 @@ There is currently few exception to the "use package name" rule:
* **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
* **changelog**: used for updating the release notes in CHANGELOG.md
* **aio**: used for angular.io changes within the /angular.io directory of the repo
* **aio**: used for docs-app (angular.io) related changes within the /aio directory of the repo
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
### Subject

3
aio/build/docs-app.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = (gulp) => () => {
// TODO:(petebd): hook up with whatever builds need doing for the webapp
};

View File

@ -1,9 +1,16 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
module.exports = {
generate: (gulp) => () => {
const path = require('path');
const Dgeni = require('dgeni');
const angularDocsPackage = require(path.resolve(__dirname, '../docs/angular.io-package'));
const angularDocsPackage = require(path.resolve(__dirname, '../transforms/angular.io-package'));
const dgeni = new Dgeni([angularDocsPackage]);
return dgeni.generate();
},
@ -11,7 +18,7 @@ module.exports = {
test: (gulp) => () => {
const execSync = require('child_process').execSync;
execSync(
'node dist/tools/cjs-jasmine/index-tools ../../tools/docs/**/*.spec.js',
'node ../dist/tools/cjs-jasmine/index-tools ../../transforms/**/*.spec.js',
{stdio: ['inherit', 'inherit', 'inherit']});
}
};

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -3,9 +3,9 @@ import { browser, element, by } from 'protractor';
export class SitePage {
links = element.all(by.css('md-toolbar a'));
datePipeLink = element(by.css('md-toolbar a[aioNavLink="docs/api/common/date-pipe"]'));
datePipeLink = element(by.css('md-toolbar a[aioNavLink="docs/api/common/DatePipe"]'));
docViewer = element(by.css('aio-doc-viewer'));
codeExample = element.all(by.css('aio-doc-viewer code-example > pre > code'));
codeExample = element.all(by.css('aio-doc-viewer pre > code'));
featureLink = element(by.css('md-toolbar a[aioNavLink="features"]'));
navigateTo() {

34
aio/gulpfile.js Normal file
View File

@ -0,0 +1,34 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
// THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE
// This is to ensure that we catch env issues before we error while requiring other dependencies.
// NOTE: we are getting the value from the parent `angular/angular` package.json not the `/aio` one.
const engines = require('../package.json').engines;
require('../tools/check-environment')({
requiredNpmVersion: engines.npm,
requiredNodeVersion: engines.node
});
const gulp = require('gulp');
// See `tools/gulp-tasks/README.md` for information about task loading.
function loadTask(fileName, taskName) {
const taskModule = require('./build/' + fileName);
const task = taskName ? taskModule[taskName] : taskModule;
return task(gulp);
}
gulp.task('docs', ['doc-gen', 'docs-app']);
gulp.task('doc-gen', loadTask('docs', 'generate'));
gulp.task('doc-gen-test', loadTask('docs', 'test'));
gulp.task('docs-app', loadTask('docs-app'));
gulp.task('docs-app-test', () => {});
gulp.task('docs-test', ['doc-gen-test', 'docs-app-test']);

View File

@ -39,8 +39,13 @@
"@angular/compiler-cli": "^2.3.1",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"canonical-path": "^0.0.2",
"codelyzer": "~2.0.0-beta.1",
"dgeni": "^0.4.2",
"dgeni-packages": "^0.16.5",
"entities": "^1.1.1",
"firebase-tools": "^3.2.1",
"gulp": "^3.9.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
@ -48,7 +53,9 @@
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"lodash": "^4.17.4",
"protractor": "~4.0.13",
"rho": "^0.3.0",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "2.0.10"

View File

@ -3,7 +3,7 @@
<span><a class="nav-link" aioNavLink="home"> Home </a></span>
<span><a class="nav-link" aioNavLink="news"> News</a></span>
<span><a class="nav-link" aioNavLink="features"> Features</a></span>
<span><a class="nav-link" aioNavLink="docs/api/common/date-pipe"> DatePipe</a></span>
<span><a class="nav-link" aioNavLink="docs/api/common/DatePipe"> DatePipe</a></span>
<span class="fill-remaining-space"></span>
</md-toolbar>
<section class="app-content">

View File

@ -11,21 +11,21 @@ describe('SiteMapService', () => {
it('should get News metadata', fakeAsync(() => {
siteMapService.getDocMetadata('news').subscribe(
metadata => expect(metadata.url).toBe('assets/documents/news.html')
metadata => expect(metadata.url).toBe('content/news.html')
);
tick();
}));
it('should calculate expected doc url for unknown id', fakeAsync(() => {
siteMapService.getDocMetadata('fizbuz').subscribe(
metadata => expect(metadata.url).toBe('assets/documents/fizbuz.html')
metadata => expect(metadata.url).toBe('content/fizbuz.html')
);
tick();
}));
it('should calculate expected index doc url for unknown id ending in /', fakeAsync(() => {
siteMapService.getDocMetadata('fizbuz/').subscribe(
metadata => expect(metadata.url).toBe('assets/documents/fizbuz/index.html')
metadata => expect(metadata.url).toBe('content/fizbuz/index.html')
);
tick();
}));

View File

@ -8,9 +8,9 @@ import 'rxjs/add/operator/map';
import { DocMetadata } from './doc.model';
const siteMap: DocMetadata[] = [
{ 'title': 'Home', 'url': 'assets/documents/home.html', id: 'home'},
{ 'title': 'Features', 'url': 'assets/documents/features.html', id: 'features'},
{ 'title': 'News', 'url': 'assets/documents/news.html', id: 'news'}
{ 'title': 'Home', 'url': 'content/home.html', id: 'home'},
{ 'title': 'Features', 'url': 'content/features.html', id: 'features'},
{ 'title': 'News', 'url': 'content/news.html', id: 'news'}
];
@Injectable()
@ -32,7 +32,7 @@ export class SiteMapService {
return {
id,
title: id,
url: `assets/documents/${filename}${filename.endsWith('/') ? 'index' : ''}.html`
url: `content/${filename}${filename.endsWith('/') ? 'index' : ''}.html`
} as DocMetadata;
}
}

View File

@ -12,7 +12,21 @@ import 'rxjs/add/observable/of';
import 'rxjs/add/operator/switchMap';
export interface QueryResults {}
/**
* We will use this client from a component with something like...
*
* ngOnInit() {
* const searchWorker = new SearchWorkerClient('app/search-worker.js', this.zone);
* this.indexReady = searchWorker.ready;
* this.searchInput = new FormControl();
* this.searchResult$ = this.searchInput.valueChanges
* .switchMap((searchText: string) => searchWorker.search(searchText));
* }
*
* TODO(petebd): do we need a fallback for browsers that do not support service workers?
*/
type QueryResults = Object[];
export interface ResultsReadyMessage {
type: 'query-results';
@ -40,7 +54,7 @@ export class SearchWorkerClient {
return new Promise((resolve, reject) => {
worker.onmessage = (e) => {
if(e.data.type === 'index-ready') {
if (e.data.type === 'index-ready') {
resolve(true);
cleanup();
}

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Some files were not shown because too many files have changed in this diff Show More