We can define regions in our examples that can be referenced and rendered in guides as code snippets. It is quite hard to ensure that these regions are maintained correctly. One reason for this is it is hard to know whether a region is being used or not. This commit adds a new processor that checks for unused named regions in examples and fails if any are found. Fixes #19761 PR Close #40479
		
			
				
	
	
		
			30 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| var Package = require('dgeni').Package;
 | |
| var jsdocPackage = require('dgeni-packages/jsdoc');
 | |
| 
 | |
| module.exports =
 | |
|     new Package('examples', [jsdocPackage])
 | |
| 
 | |
|         .factory(require('./inline-tag-defs/example'))
 | |
|         .factory(require('./services/parseArgString'))
 | |
|         .factory(require('./services/example-map'))
 | |
|         .factory(require('./file-readers/example-reader'))
 | |
|         .factory(require('./services/region-parser'))
 | |
|         .factory(require('./services/getExampleRegion'))
 | |
| 
 | |
|         .processor(require('./processors/collect-examples'))
 | |
|         .processor(require('./processors/render-examples'))
 | |
|         .processor(require('./processors/check-for-unused-example-regions'))
 | |
| 
 | |
|         .config(function(readFilesProcessor, exampleFileReader) {
 | |
|           readFilesProcessor.fileReaders.push(exampleFileReader);
 | |
|         })
 | |
| 
 | |
|         .config(function(inlineTagProcessor, exampleInlineTagDef) {
 | |
|           inlineTagProcessor.inlineTagDefinitions.push(exampleInlineTagDef);
 | |
|         })
 | |
| 
 | |
|         .config(function(computePathsProcessor) {
 | |
|           computePathsProcessor.pathTemplates.push(
 | |
|               {docTypes: ['example-region'], getPath: function() {}, getOutputPath: function() {}});
 | |
|         });
 |