build(aio): do not render private classes and members

This commit is contained in:
Peter Bacon Darwin 2017-03-19 08:35:08 +00:00 committed by Miško Hevery
parent 45e2126273
commit 8c12374c4c
3 changed files with 50 additions and 0 deletions

View File

@ -47,6 +47,7 @@ module.exports =
.processor(require('./processors/filterMemberDocs'))
.processor(require('./processors/convertToJson'))
.processor(require('./processors/markBarredODocsAsPrivate'))
.processor(require('./processors/filterPrivateDocs'))
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); })

View File

@ -0,0 +1,9 @@
module.exports = function filterPrivateDocs() {
return {
$runAfter: ['extra-docs-added'],
$runBefore: ['computing-paths'],
$process: function(docs) {
return docs.filter(function(doc) { return doc.privateExport !== true });
}
}
};

View File

@ -0,0 +1,40 @@
const testPackage = require('../../helpers/test-package');
const processorFactory = require('./filterPrivateDocs');
const Dgeni = require('dgeni');
describe('filterPrivateDocs processor', () => {
it('should be available on the injector', () => {
const dgeni = new Dgeni([testPackage('angular.io-package')]);
const injector = dgeni.configureInjector();
const processor = injector.get('filterPrivateDocs');
expect(processor.$process).toBeDefined();
});
it('should run before computing-paths', () => {
const processor = processorFactory();
expect(processor.$runBefore).toEqual(['computing-paths'])
});
it('should run before computing-paths', () => {
const processor = processorFactory();
expect(processor.$runAfter).toEqual(['extra-docs-added']);
});
it('should remove docs that are marked as private exports', () => {
const processor = processorFactory();
const docs = [
{ name: 'public1'},
{ name: 'ɵPrivate1', privateExport: true },
{ name: 'public2'},
{ name: 'ɵPrivate2', privateExport: true },
{ id: 'other'}
];
const filteredDocs = processor.$process(docs);
expect(filteredDocs).toEqual([
{ name: 'public1'},
{ name: 'public2'},
{ id: 'other'}
]);
})
});