build(aio): do not render ignored docs
This commit is contained in:
parent
8c12374c4c
commit
1a0c6d89b1
@ -48,6 +48,7 @@ module.exports =
|
||||
.processor(require('./processors/convertToJson'))
|
||||
.processor(require('./processors/markBarredODocsAsPrivate'))
|
||||
.processor(require('./processors/filterPrivateDocs'))
|
||||
.processor(require('./processors/filterIgnoredDocs'))
|
||||
|
||||
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
|
||||
.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); })
|
||||
@ -123,7 +124,12 @@ module.exports =
|
||||
generateKeywordsProcessor.docTypesToIgnore = ['example-region'];
|
||||
})
|
||||
|
||||
|
||||
// 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
|
||||
];
|
||||
})
|
||||
|
||||
// Where do we write the output files?
|
||||
.config(function(writeFilesProcessor) { writeFilesProcessor.outputFolder = OUTPUT_PATH; })
|
||||
|
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 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)));
|
||||
}
|
||||
}
|
||||
};
|
@ -0,0 +1,39 @@
|
||||
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.io-package')]);
|
||||
const injector = dgeni.configureInjector();
|
||||
const processor = injector.get('filterIgnoredDocs');
|
||||
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(['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'}
|
||||
]);
|
||||
})
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user