| 
									
										
										
										
											2016-11-24 23:21:40 +01:00
										 |  |  | import * as q from 'q' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import * as plugins from './npmci.plugins' | 
					
						
							|  |  |  | import * as paths from './npmci.paths' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 17:11:47 +02:00
										 |  |  | import { repo } from './npmci.env' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import { KeyValueStore } from 'npmextra' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-24 23:21:40 +01:00
										 |  |  | export interface INpmciOptions { | 
					
						
							| 
									
										
										
										
											2017-08-28 17:19:31 +02:00
										 |  |  |   npmGlobalTools: string[] | 
					
						
							|  |  |  |   dockerRegistryRepoMap: any | 
					
						
							| 
									
										
										
										
											2016-11-24 23:21:40 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 17:11:47 +02:00
										 |  |  | // instantiate a kvStorage for the current directory
 | 
					
						
							| 
									
										
										
										
											2017-08-28 17:19:31 +02:00
										 |  |  | export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`) | 
					
						
							| 
									
										
										
										
											2017-08-28 17:11:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 18:09:59 +02:00
										 |  |  | // handle config retrival
 | 
					
						
							|  |  |  | let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd) | 
					
						
							|  |  |  | let defaultConfig: INpmciOptions = { | 
					
						
							|  |  |  |   npmGlobalTools: [], | 
					
						
							|  |  |  |   dockerRegistryRepoMap: {} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | export let configObject = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-08 14:50:41 +01:00
										 |  |  | export let getConfig = async (): Promise<INpmciOptions> => { | 
					
						
							| 
									
										
										
										
											2017-08-28 18:09:59 +02:00
										 |  |  |   return configObject | 
					
						
							| 
									
										
										
										
											2016-11-24 23:21:40 +01:00
										 |  |  | } |