Skip to content

Commit

Permalink
build(aio): big move of docs related files (angular#14361)
Browse files Browse the repository at this point in the history
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 angular#14361
  • Loading branch information
petebacondarwin authored and IgorMinar committed Feb 9, 2017
1 parent 5e7a2fa commit 600402d
Show file tree
Hide file tree
Showing 437 changed files with 855 additions and 531 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/dist/
node_modules
bower_components
angular.io/dist

# Include when developing application packages.
pubspec.lock
Expand All @@ -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
4 changes: 2 additions & 2 deletions .pullapprove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ groups:
include:
- "*"
exclude:
- "angular.io/*"
- "aio/*"
- "integration/*"
- "modules/*"
- "tools/*"
Expand Down Expand Up @@ -236,7 +236,7 @@ groups:
angular.io:
conditions:
files:
- "angular.io/*"
- "aio/*"
users:
- IgorMinar
- robwormald
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cache:
directories:
- ./node_modules
- ./.chrome/chromium
- ./angular.io/node_modules
- ./aio/node_modules

env:
global:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions aio/build/docs-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (gulp) => () => {
// TODO:(petebd): hook up with whatever builds need doing for the webapp
};
11 changes: 9 additions & 2 deletions tools/gulp-tasks/docs.js → aio/build/docs.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
/**
* @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();
},

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']});
}
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions angular.io/e2e/app.po.ts → aio/e2e/app.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions aio/gulpfile.js
Original file line number Diff line number Diff line change
@@ -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']);
File renamed without changes.
7 changes: 7 additions & 0 deletions angular.io/package.json → aio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,23 @@
"@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",
"karma-chrome-launcher": "^2.0.0",
"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"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ const rhoPackage = require('../rho-package');

const PROJECT_ROOT = path.resolve(__dirname, '../../..');
const API_SOURCE_PATH = path.resolve(PROJECT_ROOT, 'modules');
const CONTENTS_PATH = path.resolve(PROJECT_ROOT, 'docs/content');
const TEMPLATES_PATH = path.resolve(PROJECT_ROOT, 'docs/templates');
const AIO_PATH = path.resolve(PROJECT_ROOT, 'aio');
const CONTENTS_PATH = path.resolve(AIO_PATH, 'content');
const TEMPLATES_PATH = path.resolve(AIO_PATH, 'transforms/templates');
const OUTPUT_PATH = path.resolve(AIO_PATH, 'src/content/docs');

module.exports =
new Package(
Expand All @@ -45,6 +47,9 @@ module.exports =
.processor(require('./processors/matchUpDirectiveDecorators'))
.processor(require('./processors/filterMemberDocs'))

// overrides base packageInfo and returns the one for the 'angular/angular' repo.
.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); })

.config(function(checkAnchorLinksProcessor, log) {
// TODO: re-enable
checkAnchorLinksProcessor.$enabled = false;
Expand Down Expand Up @@ -102,14 +107,14 @@ module.exports =

collectExamples.exampleFolders = ['@angular/examples', 'examples'];

generateKeywordsProcessor.ignoreWordsFile = 'tools/docs/angular.io-package/ignore.words';
generateKeywordsProcessor.ignoreWordsFile = 'aio/transforms/angular.io-package/ignore.words';
generateKeywordsProcessor.docTypesToIgnore = ['example-region'];
})



// Where do we write the output files?
.config(function(writeFilesProcessor) { writeFilesProcessor.outputFolder = 'dist/docs'; })
.config(function(writeFilesProcessor) { writeFilesProcessor.outputFolder = OUTPUT_PATH; })


// Target environments
Expand Down Expand Up @@ -151,7 +156,6 @@ module.exports =

// Where to find the templates for the doc rendering
templateFinder.templateFolders = [TEMPLATES_PATH];
// templateFinder.templateFolders.unshift(TEMPLATES_PATH);

// Standard patterns for matching docs to templates
templateFinder.templatePatterns = [
Expand Down Expand Up @@ -182,8 +186,6 @@ module.exports =
// We are going to be relaxed about ambigous links
.config(function(getLinkInfo) {
getLinkInfo.useFirstAmbiguousLink = false;
// TODO: I think we don't need this for Igor's shell app
// getLinkInfo.relativeLinks = true;
})


Expand Down
Loading

0 comments on commit 600402d

Please sign in to comment.