cleanup/comment api builder

This commit is contained in:
Jay Traband 2015-09-17 01:40:45 -07:00
parent 3f6a9833dd
commit 834b65dca3
5 changed files with 44 additions and 13 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ typings
www
.DS_Store
.idea
**/js/latest/api

View File

@ -2,17 +2,16 @@ var path = require('canonical-path');
var Package = require('dgeni').Package;
var basePackage = require('../public-docs-package');
var PARTIAL_PATH = 'partials';
var MODULES_DOCS_PATH = PARTIAL_PATH + '/api';
// OLD paths
// var DOCS_DIST = 'dist/angular.io/partials/api/angular2/';
// var DOCS_IO_DIST = '../angular.io/public/docs/js/latest/api/';
// 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'))
// MIGRATION: added this processor
.processor(require('./processors/fixOutputPathProcessor'))
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
.factory(require('./services/packageInfo'))
@ -24,37 +23,44 @@ module.exports = new Package('angular.io', [basePackage])
})
.config(function(writeFilesProcessor) {
writeFilesProcessor.outputFolder = 'dist/angular.io';
writeFilesProcessor.outputFolder = 'js/latest/api';
})
.config(function(readFilesProcessor, generateNavigationDoc, createOverviewDump) {
// Clear out unwanted processors
// MIGRATION: HACK - added basePath to point to a local repo location because the docs-package-processor will
// have previously set it to point to angular/angular repo.
readFilesProcessor.basePath = path.resolve(__dirname, "../../docs");
readFilesProcessor.$enabled = false;
generateNavigationDoc.$enabled = false;
createOverviewDump.$enabled = false;
})
.config(function(computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES) {
computePathsProcessor.pathTemplates.push({
docTypes: ['module'],
pathTemplate: '${id}/',
outputPathTemplate: MODULES_DOCS_PATH + '/${id}/index.jade'
// MIGRATION:
// outputPathTemplate: MODULES_DOCS_PATH + '/${id}/index.jade'
outputPathTemplate: '/${id}/index.jade'
});
computePathsProcessor.pathTemplates.push({
docTypes: EXPORT_DOC_TYPES,
pathTemplate: '${moduleDoc.id}/${name}-${docType}.html',
outputPathTemplate: MODULES_DOCS_PATH + '/${moduleDoc.id}/${name}-${docType}.jade',
// MIGRATION:
// outputPathTemplate: MODULES_DOCS_PATH + '/${moduleDoc.id}/${name}-${docType}.jade',
outputPathTemplate:'/${moduleDoc.id}/${name}-${docType}.jade',
});
computePathsProcessor.pathTemplates.push({
docTypes: ['jade-data'],
pathTemplate: '${originalDoc.id}/_data',
outputPathTemplate: MODULES_DOCS_PATH + '/${path}.json'
// MIGRATION:
// outputPathTemplate: MODULES_DOCS_PATH + '/${path}.json'
outputPathTemplate: '/${path}.json'
});
})

View File

@ -0,0 +1,23 @@
var _ = require('lodash');
var path = require('canonical-path');
/*
* Remove angular2 prefix from all doc output paths
*/
module.exports = function fixOutputPathProcessor() {
return {
$runAfter: ['paths-computed'],
$runBefore: ['writing-files'],
$process: function(docs) {
docs.forEach(function(doc) {
try {
doc.outputPath = doc.outputPath && path.relative("/angular2", doc.outputPath);
} catch(e) {
var x = e;
}
});
return docs;
}
};
};

View File

@ -8,7 +8,7 @@ p.location-badge.
defined in {$ githubViewLink(doc) $}
:markdown
{$ doc.moduleDoc.description | indent(2, true) | trimBlankLines $}
{$ doc.description | indent(2, true) | trimBlankLines $}
{%- if doc.decorators %}
.l-main-section

View File

@ -33,6 +33,7 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
// Configure file reading
.config(function(readFilesProcessor, ngdocFileReader, readTypeScriptModules) {
readFilesProcessor.fileReaders = [ngdocFileReader];
// MIGRATION: set the readFilesProcessor base path to point to angular repo.
var angular_repo_path = path.resolve(__dirname, '../../../../angular');
// TODO: confirm that the angular repo is actually there.
if (!fs.existsSync(angular_repo_path)) {