From f5aaa55f21e97173c6134688b8d21c9714c81ef9 Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Mon, 24 Apr 2017 21:53:36 +0100 Subject: [PATCH] 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 --- .../transforms/angular-api-package/index.js | 10 +---- .../processors/filterIgnoredDocs.js | 13 ------- .../processors/filterIgnoredDocs.spec.js | 39 ------------------- 3 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 aio/tools/transforms/angular-api-package/processors/filterIgnoredDocs.js delete mode 100644 aio/tools/transforms/angular-api-package/processors/filterIgnoredDocs.spec.js diff --git a/aio/tools/transforms/angular-api-package/index.js b/aio/tools/transforms/angular-api-package/index.js index 523b42de88..b86b541a9e 100644 --- a/aio/tools/transforms/angular-api-package/index.js +++ b/aio/tools/transforms/angular-api-package/index.js @@ -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 diff --git a/aio/tools/transforms/angular-api-package/processors/filterIgnoredDocs.js b/aio/tools/transforms/angular-api-package/processors/filterIgnoredDocs.js deleted file mode 100644 index f1ec0fe177..0000000000 --- a/aio/tools/transforms/angular-api-package/processors/filterIgnoredDocs.js +++ /dev/null @@ -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))); - } - }; -}; diff --git a/aio/tools/transforms/angular-api-package/processors/filterIgnoredDocs.spec.js b/aio/tools/transforms/angular-api-package/processors/filterIgnoredDocs.spec.js deleted file mode 100644 index c47c6b1966..0000000000 --- a/aio/tools/transforms/angular-api-package/processors/filterIgnoredDocs.spec.js +++ /dev/null @@ -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'} - ]); - }); -});