100 lines
3.0 KiB
JavaScript
Raw Normal View History

var path = require('canonical-path');
var Package = require('dgeni').Package;
var basePackage = require('../docs-package');
2015-09-17 01:40:45 -07:00
// MIGRATION: removed these vars
// var PARTIAL_PATH = 'partials';
// var MODULES_DOCS_PATH = PARTIAL_PATH + '/api';
module.exports = new Package('angular.io', [basePackage])
.factory(require('./services/renderMarkdown'))
.processor(require('./processors/addJadeDataDocsProcessor'))
2015-09-17 01:53:37 -07:00
// MIGRATION: added packageInfo to point to angular/angular repo
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
.factory(require('./services/packageInfo'))
// Configure rendering
.config(function(templateFinder, templateEngine) {
templateFinder.templateFolders
.unshift(path.resolve(__dirname, 'templates'));
})
.config(function(readTypeScriptModules, writeFilesProcessor, readFilesProcessor) {
readTypeScriptModules.sourceFiles = [
'angular2/lifecycle_hooks.ts',
'angular2/core.ts',
'angular2/http.ts',
'angular2/router.ts',
'angular2/test.ts'
];
readTypeScriptModules.hidePrivateMembers = true;
2015-09-17 01:53:37 -07:00
// MIGRATION: HACK - readFileProcessor.basePath set to point to a local repo location
// because the docs-package-processor will
// have previously set it to point to angular/angular repo.
// needed because the writeFilesProcessor uses the readFilesProcessor's basePath.
readFilesProcessor.basePath = path.resolve(__dirname, "../../docs");
2015-09-17 01:40:45 -07:00
writeFilesProcessor.outputFolder = 'js/latest/api';
})
.config(function(getLinkInfo) {
getLinkInfo.useFirstAmbiguousLink = false;
})
.config(function(readFilesProcessor, generateNavigationDoc, createOverviewDump) {
// Clear out unwanted processors
readFilesProcessor.$enabled = false;
generateNavigationDoc.$enabled = false;
createOverviewDump.$enabled = false;
})
.config(function(computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES) {
computePathsProcessor.pathTemplates.push({
docTypes: ['module'],
getPath: function computeModulePath(doc) {
return doc.id.replace(/^angular2\//, '');
},
2015-09-17 01:40:45 -07:00
// MIGRATION:
// outputPathTemplate: MODULES_DOCS_PATH + '/${id}/index.jade'
outputPathTemplate: '${path}/index.jade'
});
computePathsProcessor.pathTemplates.push({
docTypes: EXPORT_DOC_TYPES,
pathTemplate: '${moduleDoc.path}/${name}-${docType}.html',
2015-09-17 01:40:45 -07:00
// MIGRATION:
// outputPathTemplate: MODULES_DOCS_PATH + '/${moduleDoc.id}/${name}-${docType}.jade',
outputPathTemplate:'${moduleDoc.path}/${name}-${docType}.jade',
});
computePathsProcessor.pathTemplates.push({
docTypes: ['jade-data'],
pathTemplate: '${originalDoc.path}/_data',
2015-09-17 01:40:45 -07:00
// MIGRATION:
// outputPathTemplate: MODULES_DOCS_PATH + '/${path}.json'
outputPathTemplate: '${path}.json'
});
})
.config(function(getLinkInfo) {
getLinkInfo.relativeLinks = true;
})
.config(function(templateEngine, getInjectables) {
2015-09-18 13:25:18 -07:00
templateEngine.filters = templateEngine.filters.concat(getInjectables([
require('./rendering/trimBlankLines'),
require('./rendering/toId'),
require('./rendering/indentForMarkdown')
]));
})