build(aio): ignore the VERSION constant correctly

We were filtering this document from the docs list but
not removing it from the module export lists.

We can actually filter it out much easier at the TypeScript
parsing point, which means we do not need the
`filterIgnoredDocs` processor any more.

Closes #16287
This commit is contained in:
Peter Bacon Darwin 2017-04-24 21:53:36 +01:00 committed by Pete Bacon Darwin
parent 23e6502ef3
commit f5aaa55f21
3 changed files with 1 additions and 61 deletions

View File

@ -23,14 +23,13 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage])
.processor(require('./processors/filterMemberDocs'))
.processor(require('./processors/markBarredODocsAsPrivate'))
.processor(require('./processors/filterPrivateDocs'))
.processor(require('./processors/filterIgnoredDocs'))
// Where do we get the source files?
.config(function(readTypeScriptModules, readFilesProcessor, collectExamples) {
// API files are typescript
readTypeScriptModules.basePath = API_SOURCE_PATH;
readTypeScriptModules.ignoreExportsMatching = [/^[_ɵ]/];
readTypeScriptModules.ignoreExportsMatching = [/^[_ɵ]|^VERSION$/];
readTypeScriptModules.hidePrivateMembers = true;
readTypeScriptModules.sourceFiles = [
'animations/index.ts',
@ -70,13 +69,6 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage])
collectExamples.exampleFolders.push('examples');
})
// Ignore certain problematic files
.config(function(filterIgnoredDocs) {
filterIgnoredDocs.ignore = [
/\/VERSION$/ // Ignore the `VERSION` const, since it would be written to the same file as the `Version` class
];
})
// Configure jsdoc-style tag parsing
.config(function(parseTagsProcessor, getInjectables) {
// Load up all the tag definitions in the tag-defs folder

View File

@ -1,13 +0,0 @@
/**
* Filter out docs whose id matches a pattern in the `filterIgnoredDocs.ignore` list
*/
module.exports = function filterIgnoredDocs() {
return {
ignore: [],
$runAfter: ['ids-computed'],
$runBefore: ['computing-paths'],
$process: function(docs) {
return docs.filter(doc => !this.ignore.some(regexp => regexp.test(doc.id)));
}
};
};

View File

@ -1,39 +0,0 @@
const testPackage = require('../../helpers/test-package');
const processorFactory = require('./filterIgnoredDocs');
const Dgeni = require('dgeni');
describe('filterIgnoredDocs processor', () => {
it('should be available on the injector', () => {
const dgeni = new Dgeni([testPackage('angular-api-package')]);
const injector = dgeni.configureInjector();
const processor = injector.get('filterIgnoredDocs');
expect(processor.$process).toBeDefined();
});
it('should run before the correct processor', () => {
const processor = processorFactory();
expect(processor.$runBefore).toEqual(['computing-paths']);
});
it('should run after the correct processor', () => {
const processor = processorFactory();
expect(processor.$runAfter).toEqual(['ids-computed']);
});
it('should remove docs that match the ignore list', () => {
const processor = processorFactory();
processor.ignore = [/\/VERSION$/, /ignore-me/];
const docs = [
{ id: 'public1'},
{ id: 'ignore-me/something' },
{ id: 'public2'},
{ id: 'and-me/VERSION' }
];
const filteredDocs = processor.$process(docs);
expect(filteredDocs).toEqual([
{ id: 'public1'},
{ id: 'public2'}
]);
});
});