| 
									
										
										
										
											2017-01-17 13:40:59 +01:00
										 |  |  | /** | 
					
						
							|  |  |  |  * componentExists | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Check whether the given component exist in either the components or containers directory | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const fs = require('fs'); | 
					
						
							| 
									
										
										
										
											2017-05-16 16:32:54 +02:00
										 |  |  | const path = require('path'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-08 17:16:20 +01:00
										 |  |  | const pageComponents = fs.readdirSync(path.resolve(process.cwd(), 'admin', 'src', 'components')); | 
					
						
							|  |  |  | const pageContainers = fs.readdirSync(path.resolve(process.cwd(), 'admin', 'src', 'containers')); | 
					
						
							| 
									
										
										
										
											2017-01-17 13:40:59 +01:00
										 |  |  | const components = pageComponents.concat(pageContainers); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function componentExists(comp) { | 
					
						
							|  |  |  |   return components.indexOf(comp) >= 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = componentExists; |