2015-09-16 02:21:55 -04:00
|
|
|
var path = require('canonical-path');
|
|
|
|
var Package = require('dgeni').Package;
|
2015-09-18 08:05:20 -04:00
|
|
|
var basePackage = require('../docs-package');
|
2015-11-06 16:40:30 -05:00
|
|
|
var targetPackage = require('../target-package');
|
2015-11-06 07:56:28 -05:00
|
|
|
var cheatsheetPackage = require('../cheatsheet-package');
|
2015-09-16 02:21:55 -04:00
|
|
|
|
2015-11-04 06:20:07 -05:00
|
|
|
var PROJECT_PATH = path.resolve(__dirname, "../../..");
|
|
|
|
var PUBLIC_PATH = path.resolve(PROJECT_PATH, 'public');
|
|
|
|
var DOCS_PATH = path.resolve(PUBLIC_PATH, 'docs');
|
2015-11-06 07:56:28 -05:00
|
|
|
var ANGULAR2_DOCS_PATH = path.resolve(__dirname, '../../../../angular/modules/angular2/docs');
|
2015-11-04 06:20:07 -05:00
|
|
|
|
2015-11-06 07:56:28 -05:00
|
|
|
|
|
|
|
module.exports = new Package('angular.io', [basePackage, targetPackage, cheatsheetPackage])
|
2015-09-16 02:21:55 -04:00
|
|
|
|
|
|
|
.factory(require('./services/renderMarkdown'))
|
|
|
|
.processor(require('./processors/addJadeDataDocsProcessor'))
|
2015-10-17 11:46:19 -04:00
|
|
|
.processor(require('./processors/filterUnwantedDecorators'))
|
2015-09-30 04:13:23 -04:00
|
|
|
.processor(require('./processors/extractDirectiveClasses'))
|
|
|
|
.processor(require('./processors/matchUpDirectiveDecorators'))
|
2015-11-13 09:09:28 -05:00
|
|
|
.processor(require('./processors/filterMemberDocs'))
|
2015-09-30 04:13:23 -04:00
|
|
|
|
2015-09-17 04:53:37 -04:00
|
|
|
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
|
2015-09-16 02:21:55 -04:00
|
|
|
.factory(require('./services/packageInfo'))
|
|
|
|
|
|
|
|
// Configure rendering
|
2015-12-01 18:31:36 -05:00
|
|
|
.config(function(templateFinder, templateEngine, renderDocsProcessor) {
|
2015-09-16 02:21:55 -04:00
|
|
|
|
|
|
|
templateFinder.templateFolders
|
|
|
|
.unshift(path.resolve(__dirname, 'templates'));
|
2015-12-01 18:31:36 -05:00
|
|
|
|
|
|
|
// helpers are made available to the nunjucks templates
|
|
|
|
renderDocsProcessor.helpers.relativePath = function(from, to) {
|
|
|
|
return path.relative(from, to);
|
|
|
|
};
|
2015-09-16 02:21:55 -04:00
|
|
|
})
|
|
|
|
|
2015-10-02 17:44:57 -04:00
|
|
|
.config(function(parseTagsProcessor) {
|
|
|
|
parseTagsProcessor.tagDefinitions.push({ name: 'internal', transforms: function() { return true; } });
|
|
|
|
})
|
|
|
|
|
2015-09-18 08:05:20 -04:00
|
|
|
.config(function(readTypeScriptModules, writeFilesProcessor, readFilesProcessor) {
|
|
|
|
|
|
|
|
readTypeScriptModules.sourceFiles = [
|
2015-11-30 05:35:22 -05:00
|
|
|
'angular2/animate.ts',
|
|
|
|
'angular2/common.ts',
|
|
|
|
'angular2/compiler.ts',
|
2015-09-18 08:05:20 -04:00
|
|
|
'angular2/core.ts',
|
|
|
|
'angular2/http.ts',
|
2015-12-09 17:49:35 -05:00
|
|
|
'angular2/http/testing.ts',
|
2015-11-30 05:35:22 -05:00
|
|
|
'angular2/instrumentation.ts',
|
|
|
|
'angular2/platform/browser.ts',
|
2015-09-18 08:05:20 -04:00
|
|
|
'angular2/router.ts',
|
2015-12-09 17:49:35 -05:00
|
|
|
'angular2/router/testing.ts',
|
2015-11-30 05:35:22 -05:00
|
|
|
'angular2/testing.ts'
|
2015-09-18 08:05:20 -04:00
|
|
|
];
|
|
|
|
readTypeScriptModules.hidePrivateMembers = true;
|
|
|
|
|
2015-11-04 06:20:07 -05:00
|
|
|
readFilesProcessor.basePath = DOCS_PATH;
|
2015-11-06 07:56:28 -05:00
|
|
|
readFilesProcessor.sourceFiles = [{
|
|
|
|
basePath: ANGULAR2_DOCS_PATH,
|
|
|
|
include: path.resolve(ANGULAR2_DOCS_PATH, 'cheatsheet/*.md')
|
|
|
|
}];
|
2015-09-16 02:21:55 -04:00
|
|
|
})
|
|
|
|
|
2015-09-18 08:05:20 -04:00
|
|
|
.config(function(getLinkInfo) {
|
|
|
|
getLinkInfo.useFirstAmbiguousLink = false;
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2015-09-16 02:21:55 -04:00
|
|
|
.config(function(readFilesProcessor, generateNavigationDoc, createOverviewDump) {
|
|
|
|
// Clear out unwanted processors
|
|
|
|
generateNavigationDoc.$enabled = false;
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
.config(function(computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES) {
|
|
|
|
|
|
|
|
computePathsProcessor.pathTemplates.push({
|
|
|
|
docTypes: ['module'],
|
2015-09-18 08:05:58 -04:00
|
|
|
getPath: function computeModulePath(doc) {
|
2015-12-01 18:31:36 -05:00
|
|
|
doc.moduleFolder = doc.id.replace(/^angular2\//, '');
|
|
|
|
return doc.moduleFolder + '/index.html';
|
2015-09-18 08:05:58 -04:00
|
|
|
},
|
2015-12-01 18:31:36 -05:00
|
|
|
getOutputPath: function computeModulePath(doc) {
|
|
|
|
return doc.moduleFolder + '/index.jade';
|
|
|
|
}
|
2015-09-16 02:21:55 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
computePathsProcessor.pathTemplates.push({
|
|
|
|
docTypes: EXPORT_DOC_TYPES,
|
2015-12-01 18:31:36 -05:00
|
|
|
pathTemplate: '${moduleDoc.moduleFolder}/${name}-${docType}.html',
|
|
|
|
outputPathTemplate:'${moduleDoc.moduleFolder}/${name}-${docType}.jade',
|
2015-09-16 02:21:55 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
computePathsProcessor.pathTemplates.push({
|
|
|
|
docTypes: ['jade-data'],
|
2015-12-01 18:31:36 -05:00
|
|
|
pathTemplate: '${originalDoc.moduleFolder}/_data',
|
2015-09-18 08:05:58 -04:00
|
|
|
outputPathTemplate: '${path}.json'
|
2015-09-16 02:21:55 -04:00
|
|
|
});
|
2015-11-03 11:41:38 -05:00
|
|
|
|
|
|
|
computePathsProcessor.pathTemplates.push({
|
2015-12-10 14:27:54 -05:00
|
|
|
docTypes: ['api-list-data'],
|
|
|
|
pathTemplate: 'api-list.json',
|
|
|
|
outputPathTemplate: '${path}'
|
2015-11-03 11:41:38 -05:00
|
|
|
});
|
2015-12-08 15:23:43 -05:00
|
|
|
|
|
|
|
computePathsProcessor.pathTemplates.push({
|
|
|
|
docTypes: ['cheatsheet-data'],
|
|
|
|
pathTemplate: '../guide/cheatsheet.json',
|
|
|
|
outputPathTemplate: '${path}'
|
|
|
|
});
|
2015-09-16 02:21:55 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
.config(function(getLinkInfo) {
|
|
|
|
getLinkInfo.relativeLinks = true;
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
.config(function(templateEngine, getInjectables) {
|
2015-09-18 16:25:18 -04:00
|
|
|
templateEngine.filters = templateEngine.filters.concat(getInjectables([
|
|
|
|
require('./rendering/trimBlankLines'),
|
|
|
|
require('./rendering/toId'),
|
|
|
|
require('./rendering/indentForMarkdown')
|
|
|
|
]));
|
|
|
|
})
|
2015-09-16 02:21:55 -04:00
|
|
|
|
2015-10-17 11:46:19 -04:00
|
|
|
.config(function(filterUnwantedDecorators, log) {
|
|
|
|
log.level = 'info';
|
|
|
|
filterUnwantedDecorators.decoratorsToIgnore = [
|
|
|
|
'CONST',
|
|
|
|
'IMPLEMENTS',
|
|
|
|
'ABSTRACT'
|
|
|
|
];
|
|
|
|
})
|
2015-09-16 02:21:55 -04:00
|
|
|
|