| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @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
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | const path = require('path'); | 
					
						
							|  |  |  | const fs = require('fs'); | 
					
						
							|  |  |  | const Package = require('dgeni').Package; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const jsdocPackage = require('dgeni-packages/jsdoc'); | 
					
						
							|  |  |  | const nunjucksPackage = require('dgeni-packages/nunjucks'); | 
					
						
							|  |  |  | const typescriptPackage = require('dgeni-packages/typescript'); | 
					
						
							|  |  |  | const gitPackage = require('dgeni-packages/git'); | 
					
						
							|  |  |  | const linksPackage = require('../links-package'); | 
					
						
							|  |  |  | const examplesPackage = require('../examples-package'); | 
					
						
							|  |  |  | const targetPackage = require('../target-package'); | 
					
						
							| 
									
										
										
										
											2017-03-19 17:56:54 +00:00
										 |  |  | const contentPackage = require('../content-package'); | 
					
						
							| 
									
										
										
										
											2017-04-11 18:24:08 +01:00
										 |  |  | const remarkPackage = require('../remark-package'); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-16 21:31:21 +01:00
										 |  |  | const PROJECT_ROOT = path.resolve(__dirname, '../../../..'); | 
					
						
							| 
									
										
										
										
											2017-03-08 14:48:20 -08:00
										 |  |  | const API_SOURCE_PATH = path.resolve(PROJECT_ROOT, 'packages'); | 
					
						
							| 
									
										
										
										
											2017-02-09 19:58:36 +00:00
										 |  |  | const AIO_PATH = path.resolve(PROJECT_ROOT, 'aio'); | 
					
						
							|  |  |  | const CONTENTS_PATH = path.resolve(AIO_PATH, 'content'); | 
					
						
							| 
									
										
										
										
											2017-04-16 21:31:21 +01:00
										 |  |  | const TEMPLATES_PATH = path.resolve(AIO_PATH, 'tools/transforms/templates'); | 
					
						
							| 
									
										
										
										
											2017-04-01 07:01:44 +01:00
										 |  |  | const OUTPUT_PATH = path.resolve(AIO_PATH, 'src/content'); | 
					
						
							|  |  |  | const DOCS_OUTPUT_PATH = path.resolve(OUTPUT_PATH, 'docs'); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | module.exports = | 
					
						
							|  |  |  |     new Package( | 
					
						
							| 
									
										
										
										
											2017-04-01 21:34:10 +03:00
										 |  |  |         'angular.io', [ | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |           jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, examplesPackage, | 
					
						
							| 
									
										
										
										
											2017-04-11 18:24:08 +01:00
										 |  |  |           gitPackage, targetPackage, contentPackage, remarkPackage | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |         ]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Register the processors
 | 
					
						
							|  |  |  |         .processor(require('./processors/convertPrivateClassesToInterfaces')) | 
					
						
							| 
									
										
										
										
											2017-03-08 21:52:19 +00:00
										 |  |  |         .processor(require('./processors/generateApiListDoc')) | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |         .processor(require('./processors/generateKeywords')) | 
					
						
							|  |  |  |         .processor(require('./processors/createOverviewDump')) | 
					
						
							|  |  |  |         .processor(require('./processors/checkUnbalancedBackTicks')) | 
					
						
							|  |  |  |         .processor(require('./processors/addNotYetDocumentedProperty')) | 
					
						
							|  |  |  |         .processor(require('./processors/mergeDecoratorDocs')) | 
					
						
							|  |  |  |         .processor(require('./processors/extractDecoratedClasses')) | 
					
						
							|  |  |  |         .processor(require('./processors/matchUpDirectiveDecorators')) | 
					
						
							|  |  |  |         .processor(require('./processors/filterMemberDocs')) | 
					
						
							| 
									
										
										
										
											2017-02-21 16:57:19 +00:00
										 |  |  |         .processor(require('./processors/convertToJson')) | 
					
						
							| 
									
										
										
										
											2017-03-12 13:27:47 +00:00
										 |  |  |         .processor(require('./processors/markBarredODocsAsPrivate')) | 
					
						
							| 
									
										
										
										
											2017-03-19 08:35:08 +00:00
										 |  |  |         .processor(require('./processors/filterPrivateDocs')) | 
					
						
							| 
									
										
										
										
											2017-03-19 10:37:53 +00:00
										 |  |  |         .processor(require('./processors/filterIgnoredDocs')) | 
					
						
							| 
									
										
										
										
											2017-03-19 11:14:17 +00:00
										 |  |  |         .processor(require('./processors/fixInternalDocumentLinks')) | 
					
						
							| 
									
										
										
										
											2017-03-20 22:23:20 +00:00
										 |  |  |         .processor(require('./processors/processNavigationMap')) | 
					
						
							| 
									
										
										
										
											2017-04-01 07:01:44 +01:00
										 |  |  |         .processor(require('./processors/copyContentAssets')) | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-09 19:58:36 +00:00
										 |  |  |         // overrides base packageInfo and returns the one for the 'angular/angular' repo.
 | 
					
						
							|  |  |  |         .factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); }) | 
					
						
							| 
									
										
										
										
											2017-03-31 21:10:54 +01:00
										 |  |  |         .factory(require('./readers/json')) | 
					
						
							| 
									
										
										
										
											2017-04-01 07:01:44 +01:00
										 |  |  |         .factory(require('./services/copyFolder')) | 
					
						
							| 
									
										
										
										
											2017-03-20 22:23:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-01 21:34:10 +03:00
										 |  |  |         .config(function(checkAnchorLinksProcessor) { | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |           // TODO: re-enable
 | 
					
						
							|  |  |  |           checkAnchorLinksProcessor.$enabled = false; | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Where do we get the source files?
 | 
					
						
							|  |  |  |         .config(function( | 
					
						
							| 
									
										
										
										
											2017-03-31 21:10:54 +01:00
										 |  |  |             readTypeScriptModules, readFilesProcessor, collectExamples, generateKeywordsProcessor, jsonFileReader) { | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |           // API files are typescript
 | 
					
						
							|  |  |  |           readTypeScriptModules.basePath = API_SOURCE_PATH; | 
					
						
							|  |  |  |           readTypeScriptModules.ignoreExportsMatching = [/^_/]; | 
					
						
							|  |  |  |           readTypeScriptModules.hidePrivateMembers = true; | 
					
						
							| 
									
										
										
										
											2017-03-31 21:10:54 +01:00
										 |  |  |           readFilesProcessor.fileReaders.push(jsonFileReader); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |           readTypeScriptModules.sourceFiles = [ | 
					
						
							| 
									
										
										
										
											2017-03-08 14:48:20 -08:00
										 |  |  |             'common/index.ts', | 
					
						
							|  |  |  |             'common/testing/index.ts', | 
					
						
							|  |  |  |             'core/index.ts', | 
					
						
							|  |  |  |             'core/testing/index.ts', | 
					
						
							|  |  |  |             'forms/index.ts', | 
					
						
							|  |  |  |             'http/index.ts', | 
					
						
							|  |  |  |             'http/testing/index.ts', | 
					
						
							|  |  |  |             'platform-browser/index.ts', | 
					
						
							|  |  |  |             'platform-browser/testing/index.ts', | 
					
						
							|  |  |  |             'platform-browser-dynamic/index.ts', | 
					
						
							|  |  |  |             'platform-browser-dynamic/testing/index.ts', | 
					
						
							|  |  |  |             'platform-server/index.ts', | 
					
						
							|  |  |  |             'platform-server/testing/index.ts', | 
					
						
							|  |  |  |             'platform-webworker/index.ts', | 
					
						
							|  |  |  |             'platform-webworker-dynamic/index.ts', | 
					
						
							|  |  |  |             'router/index.ts', | 
					
						
							|  |  |  |             'router/testing/index.ts', | 
					
						
							|  |  |  |             'upgrade/index.ts', | 
					
						
							|  |  |  |             'upgrade/static.ts', | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |           ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           readFilesProcessor.basePath = PROJECT_ROOT; | 
					
						
							|  |  |  |           readFilesProcessor.sourceFiles = [ | 
					
						
							| 
									
										
										
										
											2017-02-02 08:19:20 +00:00
										 |  |  |             { | 
					
						
							|  |  |  |               basePath: CONTENTS_PATH, | 
					
						
							| 
									
										
										
										
											2017-02-21 13:31:12 +00:00
										 |  |  |               include: CONTENTS_PATH + '/{cookbook,guide,tutorial}/**/*.md', | 
					
						
							| 
									
										
										
										
											2017-02-02 08:19:20 +00:00
										 |  |  |               fileReader: 'contentFileReader' | 
					
						
							| 
									
										
										
										
											2017-03-01 19:16:40 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2017-03-01 22:54:21 +00:00
										 |  |  |             { | 
					
						
							|  |  |  |               basePath: CONTENTS_PATH + '/marketing', | 
					
						
							| 
									
										
										
										
											2017-03-31 18:23:06 +01:00
										 |  |  |               include: CONTENTS_PATH + '/marketing/**/*.{html,md}', | 
					
						
							| 
									
										
										
										
											2017-03-01 22:54:21 +00:00
										 |  |  |               fileReader: 'contentFileReader' | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2017-03-01 19:16:40 +00:00
										 |  |  |             { | 
					
						
							|  |  |  |               basePath: CONTENTS_PATH, | 
					
						
							| 
									
										
										
										
											2017-03-27 16:09:30 +01:00
										 |  |  |               include: CONTENTS_PATH + '/*.md', | 
					
						
							|  |  |  |               exclude: [CONTENTS_PATH + '/index.md'], | 
					
						
							| 
									
										
										
										
											2017-03-01 19:16:40 +00:00
										 |  |  |               fileReader: 'contentFileReader' | 
					
						
							| 
									
										
										
										
											2017-02-02 08:19:20 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |               basePath: API_SOURCE_PATH, | 
					
						
							| 
									
										
										
										
											2017-03-08 14:48:20 -08:00
										 |  |  |               include: API_SOURCE_PATH + '/examples/**/*', | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |               fileReader: 'exampleFileReader' | 
					
						
							| 
									
										
										
										
											2017-02-02 08:19:20 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               basePath: CONTENTS_PATH, | 
					
						
							|  |  |  |               include: CONTENTS_PATH + '/examples/**/*', | 
					
						
							| 
									
										
										
										
											2017-03-20 07:03:17 +00:00
										 |  |  |               exclude: [ | 
					
						
							|  |  |  |                 '**/*plnkr.no-link.html', | 
					
						
							|  |  |  |                 '**/node_modules/**', | 
					
						
							|  |  |  |                 // _boilerplate files
 | 
					
						
							|  |  |  |                 '**/_boilerplate/**', | 
					
						
							|  |  |  |                 '**/*/src/styles.css', | 
					
						
							|  |  |  |                 '**/*/src/systemjs-angular-loader.js', | 
					
						
							|  |  |  |                 '**/*/src/systemjs.config.js', | 
					
						
							|  |  |  |                 '**/*/src/tsconfig.json', | 
					
						
							|  |  |  |                 '**/*/bs-config.e2e.json', | 
					
						
							|  |  |  |                 '**/*/bs-config.json', | 
					
						
							|  |  |  |                 '**/*/package.json', | 
					
						
							|  |  |  |                 '**/*/tslint.json', | 
					
						
							|  |  |  |                 // example files
 | 
					
						
							|  |  |  |                 '**/_test-output', | 
					
						
							|  |  |  |                 '**/protractor-helpers.js', | 
					
						
							|  |  |  |                 '**/e2e-spec.js', | 
					
						
							|  |  |  |                 '**/ts/**/*.js', | 
					
						
							|  |  |  |                 '**/js-es6*/**/*.js', | 
					
						
							|  |  |  |                 '**/ts-snippets/**/*.js', | 
					
						
							|  |  |  |               ], | 
					
						
							| 
									
										
										
										
											2017-02-02 08:19:20 +00:00
										 |  |  |               fileReader: 'exampleFileReader' | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2017-03-20 22:23:20 +00:00
										 |  |  |             { | 
					
						
							|  |  |  |               basePath: CONTENTS_PATH, | 
					
						
							|  |  |  |               include: CONTENTS_PATH + '/navigation.json', | 
					
						
							| 
									
										
										
										
											2017-03-31 21:10:54 +01:00
										 |  |  |               fileReader: 'jsonFileReader' | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               basePath: CONTENTS_PATH, | 
					
						
							| 
									
										
										
										
											2017-03-30 16:51:51 -07:00
										 |  |  |               include: CONTENTS_PATH + '/marketing/contributors.json', | 
					
						
							| 
									
										
										
										
											2017-03-31 21:10:54 +01:00
										 |  |  |               fileReader: 'jsonFileReader' | 
					
						
							| 
									
										
										
										
											2017-03-20 22:23:20 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2017-04-14 17:53:49 -07:00
										 |  |  |             { | 
					
						
							|  |  |  |               basePath: CONTENTS_PATH, | 
					
						
							|  |  |  |               include: CONTENTS_PATH + '/marketing/resources.json', | 
					
						
							|  |  |  |               fileReader: 'jsonFileReader' | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |           ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-08 14:48:20 -08:00
										 |  |  |           collectExamples.exampleFolders = ['examples', 'examples']; | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-16 21:31:21 +01:00
										 |  |  |           generateKeywordsProcessor.ignoreWordsFile = 'aio/tools/transforms/angular.io-package/ignore.words'; | 
					
						
							| 
									
										
										
										
											2017-01-27 14:50:11 +00:00
										 |  |  |           generateKeywordsProcessor.docTypesToIgnore = ['example-region']; | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-19 10:37:53 +00:00
										 |  |  |         // Ignore certain problematic files
 | 
					
						
							|  |  |  |         .config(function(filterIgnoredDocs) { | 
					
						
							|  |  |  |           filterIgnoredDocs.ignore = [ | 
					
						
							|  |  |  |             /\/VERSION$/  // Ignore the `VERSION` const, since it would be written to the same file as the `Version` class
 | 
					
						
							|  |  |  |           ]; | 
					
						
							|  |  |  |         }) | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // Where do we write the output files?
 | 
					
						
							| 
									
										
										
										
											2017-04-01 07:01:44 +01:00
										 |  |  |         .config(function(writeFilesProcessor) { writeFilesProcessor.outputFolder = DOCS_OUTPUT_PATH; }) | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Target environments
 | 
					
						
							|  |  |  |         .config(function(targetEnvironments) { | 
					
						
							|  |  |  |           const ALLOWED_LANGUAGES = ['ts', 'js', 'dart']; | 
					
						
							|  |  |  |           const TARGET_LANGUAGE = 'ts'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           ALLOWED_LANGUAGES.forEach(target => targetEnvironments.addAllowed(target)); | 
					
						
							|  |  |  |           targetEnvironments.activate(TARGET_LANGUAGE); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // TODO: we may need to do something with `linkDocsInlineTagDef`
 | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Configure jsdoc-style tag parsing
 | 
					
						
							| 
									
										
										
										
											2017-02-02 08:19:20 +00:00
										 |  |  |         .config(function(parseTagsProcessor, getInjectables, inlineTagProcessor) { | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |           // Load up all the tag definitions in the tag-defs folder
 | 
					
						
							|  |  |  |           parseTagsProcessor.tagDefinitions = | 
					
						
							|  |  |  |               parseTagsProcessor.tagDefinitions.concat(getInjectables(requireFolder('./tag-defs'))); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // We actually don't want to parse param docs in this package as we are getting the data
 | 
					
						
							|  |  |  |           // out using TS
 | 
					
						
							|  |  |  |           // TODO: rewire the param docs to the params extracted from TS
 | 
					
						
							|  |  |  |           parseTagsProcessor.tagDefinitions.forEach(function(tagDef) { | 
					
						
							|  |  |  |             if (tagDef.name === 'param') { | 
					
						
							|  |  |  |               tagDef.docProperty = 'paramData'; | 
					
						
							|  |  |  |               tagDef.transforms = []; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           }); | 
					
						
							| 
									
										
										
										
											2017-02-02 08:19:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |           inlineTagProcessor.inlineTagDefinitions.push(require('./inline-tag-defs/anchor')); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Configure nunjucks rendering of docs via templates
 | 
					
						
							|  |  |  |         .config(function( | 
					
						
							| 
									
										
										
										
											2017-04-14 19:28:00 +01:00
										 |  |  |             renderDocsProcessor, versionInfo, templateFinder, templateEngine, getInjectables) { | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |           // Where to find the templates for the doc rendering
 | 
					
						
							|  |  |  |           templateFinder.templateFolders = [TEMPLATES_PATH]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // Standard patterns for matching docs to templates
 | 
					
						
							|  |  |  |           templateFinder.templatePatterns = [ | 
					
						
							|  |  |  |             '${ doc.template }', '${ doc.id }.${ doc.docType }.template.html', | 
					
						
							|  |  |  |             '${ doc.id }.template.html', '${ doc.docType }.template.html', | 
					
						
							|  |  |  |             '${ doc.id }.${ doc.docType }.template.js', '${ doc.id }.template.js', | 
					
						
							|  |  |  |             '${ doc.docType }.template.js', '${ doc.id }.${ doc.docType }.template.json', | 
					
						
							|  |  |  |             '${ doc.id }.template.json', '${ doc.docType }.template.json', 'common.template.html' | 
					
						
							|  |  |  |           ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // Nunjucks and Angular conflict in their template bindings so change Nunjucks
 | 
					
						
							|  |  |  |           templateEngine.config.tags = {variableStart: '{$', variableEnd: '$}'}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           templateEngine.filters = | 
					
						
							|  |  |  |               templateEngine.filters.concat(getInjectables(requireFolder('./rendering'))); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // Add the version data to the renderer, for use in things like github links
 | 
					
						
							|  |  |  |           renderDocsProcessor.extraData.versionInfo = versionInfo; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // helpers are made available to the nunjucks templates
 | 
					
						
							|  |  |  |           renderDocsProcessor.helpers.relativePath = function(from, to) { | 
					
						
							|  |  |  |             return path.relative(from, to); | 
					
						
							|  |  |  |           }; | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-08 21:52:19 +00:00
										 |  |  |         // We are not going to be relaxed about ambiguous links
 | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |         .config(function(getLinkInfo) { | 
					
						
							|  |  |  |           getLinkInfo.useFirstAmbiguousLink = false; | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         .config(function( | 
					
						
							| 
									
										
										
										
											2017-03-08 21:52:19 +00:00
										 |  |  |             computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES, generateApiListDoc, | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |             generateKeywordsProcessor) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           const API_SEGMENT = 'api'; | 
					
						
							|  |  |  |           const APP_SEGMENT = 'app'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-08 21:52:19 +00:00
										 |  |  |           generateApiListDoc.outputFolder = API_SEGMENT; | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |           generateKeywordsProcessor.outputFolder = APP_SEGMENT; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // Replace any path templates inherited from other packages
 | 
					
						
							|  |  |  |           // (we want full and transparent control)
 | 
					
						
							|  |  |  |           computePathsProcessor.pathTemplates = [ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               docTypes: ['module'], | 
					
						
							|  |  |  |               getPath: function computeModulePath(doc) { | 
					
						
							| 
									
										
										
										
											2017-03-13 23:53:47 +00:00
										 |  |  |                 doc.moduleFolder = `${API_SEGMENT}/${doc.id.replace(/\/index$/, '')}`; | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |                 return doc.moduleFolder; | 
					
						
							|  |  |  |               }, | 
					
						
							| 
									
										
										
										
											2017-03-13 23:53:47 +00:00
										 |  |  |               outputPathTemplate: '${moduleFolder}.json' | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               docTypes: EXPORT_DOC_TYPES.concat(['decorator', 'directive', 'pipe']), | 
					
						
							|  |  |  |               pathTemplate: '${moduleDoc.moduleFolder}/${name}', | 
					
						
							| 
									
										
										
										
											2017-02-21 16:57:19 +00:00
										 |  |  |               outputPathTemplate: '${moduleDoc.moduleFolder}/${name}.json', | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2017-02-02 08:19:20 +00:00
										 |  |  |             {docTypes: ['example-region'], getOutputPath: function() {}}, | 
					
						
							| 
									
										
										
										
											2017-03-21 07:02:58 +00:00
										 |  |  |             { | 
					
						
							|  |  |  |               docTypes: ['content'], | 
					
						
							|  |  |  |               getPath: (doc) => `${doc.id.replace(/\/index$/, '')}`, | 
					
						
							|  |  |  |               outputPathTemplate: '${path}.json' | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2017-03-31 21:10:54 +01:00
										 |  |  |             {docTypes: ['navigation-json'], pathTemplate: '${id}', outputPathTemplate: '../${id}.json'}, | 
					
						
							| 
									
										
										
										
											2017-04-14 17:53:49 -07:00
										 |  |  |             {docTypes: ['contributors-json'], pathTemplate: '${id}', outputPathTemplate: '../${id}.json'}, | 
					
						
							|  |  |  |             {docTypes: ['resources-json'], pathTemplate: '${id}', outputPathTemplate: '../${id}.json'} | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |           ]; | 
					
						
							| 
									
										
										
										
											2017-02-21 16:57:19 +00:00
										 |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         .config(function(convertToJsonProcessor, EXPORT_DOC_TYPES) { | 
					
						
							|  |  |  |           convertToJsonProcessor.docTypes = EXPORT_DOC_TYPES.concat([ | 
					
						
							|  |  |  |             'content', 'decorator', 'directive', 'pipe', 'module' | 
					
						
							|  |  |  |           ]); | 
					
						
							| 
									
										
										
										
											2017-04-01 07:01:44 +01:00
										 |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         .config(function(copyContentAssetsProcessor) { | 
					
						
							|  |  |  |           copyContentAssetsProcessor.assetMappings.push( | 
					
						
							|  |  |  |             { from: path.resolve(CONTENTS_PATH, 'images'), to: path.resolve(OUTPUT_PATH, 'images') } | 
					
						
							|  |  |  |           ); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |         }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 16:57:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | function requireFolder(folderPath) { | 
					
						
							|  |  |  |   const absolutePath = path.resolve(__dirname, folderPath); | 
					
						
							|  |  |  |   return fs.readdirSync(absolutePath) | 
					
						
							|  |  |  |       .filter(p => !/[._]spec\.js$/.test(p))  // ignore spec files
 | 
					
						
							|  |  |  |       .map(p => require(path.resolve(absolutePath, p))); | 
					
						
							| 
									
										
										
										
											2017-03-08 14:48:20 -08:00
										 |  |  | } |