| 
									
										
										
										
											2015-07-11 07:21:21 +01:00
										 |  |  | var Package = require('dgeni').Package; | 
					
						
							|  |  |  | var jsdocPackage = require('dgeni-packages/jsdoc'); | 
					
						
							|  |  |  | var nunjucksPackage = require('dgeni-packages/nunjucks'); | 
					
						
							|  |  |  | var typescriptPackage = require('../typescript-package'); | 
					
						
							|  |  |  | var gitPackage = require('dgeni-packages/git'); | 
					
						
							|  |  |  | var path = require('canonical-path'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Define the dgeni package for generating the docs
 | 
					
						
							|  |  |  | module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, gitPackage]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Register the processors
 | 
					
						
							|  |  |  | .processor(require('./processors/createTypeDefinitionFile')) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .config(function(readFilesProcessor, inlineTagProcessor) { | 
					
						
							|  |  |  |   readFilesProcessor.basePath = path.resolve(__dirname, '../..'); | 
					
						
							|  |  |  |   // Don't run unwanted processors
 | 
					
						
							|  |  |  |   readFilesProcessor.$enabled = false; | 
					
						
							|  |  |  |   inlineTagProcessor.$enabled = false; | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Configure the log service
 | 
					
						
							|  |  |  | .config(function(log) { | 
					
						
							|  |  |  |   log.level = 'info'; | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .config(function(renderDocsProcessor, versionInfo) { | 
					
						
							|  |  |  |   renderDocsProcessor.extraData.versionInfo = versionInfo; | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-12 19:10:58 +01:00
										 |  |  | .config(function(readFilesProcessor, inlineTagProcessor, readTypeScriptModules, createTypeDefinitionFile) { | 
					
						
							| 
									
										
										
										
											2015-07-11 07:21:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Don't run unwanted processors
 | 
					
						
							|  |  |  |   readFilesProcessor.$enabled = false; // We are not using the normal file reading processor
 | 
					
						
							|  |  |  |   inlineTagProcessor.$enabled = false; // We are not actually processing the inline link tags
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Configure file reading
 | 
					
						
							|  |  |  |   readFilesProcessor.basePath = path.resolve(__dirname, '../..'); | 
					
						
							|  |  |  |   readTypeScriptModules.sourceFiles = [ | 
					
						
							|  |  |  |     'angular2/angular2.ts', | 
					
						
							| 
									
										
										
										
											2015-08-27 10:39:39 -07:00
										 |  |  |     'angular2/web_worker/worker.ts', | 
					
						
							|  |  |  |     'angular2/web_worker/ui.ts', | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |     'angular2/router.ts', | 
					
						
							| 
									
										
										
										
											2015-09-01 20:43:03 -07:00
										 |  |  |     'angular2/http.ts', | 
					
						
							|  |  |  |     'angular2/test_lib.ts' | 
					
						
							| 
									
										
										
										
											2015-07-11 07:21:21 +01:00
										 |  |  |   ]; | 
					
						
							|  |  |  |   readTypeScriptModules.basePath = path.resolve(path.resolve(__dirname, '../../modules')); | 
					
						
							| 
									
										
										
										
											2015-08-07 16:42:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-12 19:10:58 +01:00
										 |  |  |   createTypeDefinitionFile.typeDefinitions = [ | 
					
						
							| 
									
										
										
										
											2015-09-01 11:38:36 -07:00
										 |  |  |     { | 
					
						
							|  |  |  |       id: 'angular2/angular2', | 
					
						
							|  |  |  |       references: ['../es6-promise/es6-promise.d.ts', '../rx/rx.d.ts'], | 
					
						
							|  |  |  |       modules: { | 
					
						
							| 
									
										
										
										
											2015-09-03 22:01:36 -07:00
										 |  |  |         'angular2/angular2': {namespace: 'ng', id: 'angular2/angular2'} | 
					
						
							|  |  |  |         /* TODO(jeffbcross): re-implement with @jteplitz as part of #3926, | 
					
						
							| 
									
										
										
										
											2015-09-01 11:38:36 -07:00
										 |  |  |         'angular2/web_worker/worker': {namespace: 'ngWorker', id: 'angular2/web_worker/worker'}, | 
					
						
							|  |  |  |         'angular2/web_worker/ui': {namespace: 'ngUi', id: 'angular2/web_worker/ui'} | 
					
						
							| 
									
										
										
										
											2015-09-03 22:01:36 -07:00
										 |  |  |         */ | 
					
						
							| 
									
										
										
										
											2015-08-07 16:42:36 -07:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2015-09-01 11:38:36 -07:00
										 |  |  |     }, | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       id: 'angular2/router', | 
					
						
							|  |  |  |       references: ['./angular2.d.ts'], | 
					
						
							|  |  |  |       remapTypes: {Type: 'ng.Type'}, | 
					
						
							|  |  |  |       modules: {'angular2/router': {namespace: 'ngRouter', id: 'angular2/router'}} | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       id: 'angular2/http', | 
					
						
							|  |  |  |       references: ['./angular2.d.ts'], | 
					
						
							|  |  |  |       remapTypes: {Type: 'ng.Type', Observable: 'ng.Observable', EventEmitter: 'ng.EventEmitter'}, | 
					
						
							|  |  |  |       modules: {'angular2/http': {namespace: 'ngHttp', id: 'angular2/http'}} | 
					
						
							| 
									
										
										
										
											2015-09-01 20:43:03 -07:00
										 |  |  |     }, | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       id: 'angular2/test_lib', | 
					
						
							|  |  |  |       references: ['./angular2.d.ts', '../jasmine/jasmine.d.ts'], | 
					
						
							|  |  |  |       remapTypes: { | 
					
						
							|  |  |  |         Type: 'ng.Type', | 
					
						
							|  |  |  |         Binding: 'ng.Binding', | 
					
						
							|  |  |  |         ViewMetadata: 'ng.ViewMetadata', | 
					
						
							|  |  |  |         Injector: 'ng.Injector', | 
					
						
							|  |  |  |         Predicate: 'ng.Predicate', | 
					
						
							|  |  |  |         ElementRef: 'ng.ElementRef', | 
					
						
							| 
									
										
										
										
											2015-09-03 22:01:36 -07:00
										 |  |  |         DebugElement: 'ng.DebugElement' | 
					
						
							| 
									
										
										
										
											2015-09-01 20:43:03 -07:00
										 |  |  |       }, | 
					
						
							|  |  |  |       modules: {'angular2/test_lib': {namespace: 'ngTestLib', id: 'angular2/test_lib'}} | 
					
						
							| 
									
										
										
										
											2015-09-01 11:38:36 -07:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-07-12 19:10:58 +01:00
										 |  |  |   ]; | 
					
						
							| 
									
										
										
										
											2015-07-11 07:21:21 +01:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .config(function(parseTagsProcessor, getInjectables) { | 
					
						
							|  |  |  |   // We actually don't want to parse param docs in this package as we are getting the data out using TS
 | 
					
						
							|  |  |  |   parseTagsProcessor.tagDefinitions.forEach(function(tagDef) { | 
					
						
							|  |  |  |     if (tagDef.name === 'param') { | 
					
						
							|  |  |  |       tagDef.docProperty = 'paramData'; | 
					
						
							|  |  |  |       tagDef.transforms = []; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Configure file writing
 | 
					
						
							|  |  |  | .config(function(writeFilesProcessor) { | 
					
						
							|  |  |  |   writeFilesProcessor.outputFolder  = 'dist/docs'; | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Configure rendering
 | 
					
						
							|  |  |  | .config(function(templateFinder, templateEngine) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Nunjucks and Angular conflict in their template bindings so change Nunjucks
 | 
					
						
							|  |  |  |   templateEngine.config.tags = { | 
					
						
							|  |  |  |     variableStart: '{$', | 
					
						
							|  |  |  |     variableEnd: '$}' | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   templateFinder.templateFolders | 
					
						
							|  |  |  |       .unshift(path.resolve(__dirname, 'templates')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   templateFinder.templatePatterns = [ | 
					
						
							|  |  |  |     '${ doc.template }', | 
					
						
							|  |  |  |     '${ doc.id }.${ doc.docType }.template.html', | 
					
						
							|  |  |  |     '${ doc.id }.template.html', | 
					
						
							|  |  |  |     '${ doc.docType }.template.html', | 
					
						
							|  |  |  |     'common.template.html' | 
					
						
							|  |  |  |   ]; | 
					
						
							| 
									
										
										
										
											2015-08-27 10:39:39 -07:00
										 |  |  | }); |