| 
									
										
										
										
											2016-05-30 02:28:47 +02:00
										 |  |  | import "typings-global"; | 
					
						
							|  |  |  | import * as plugins from "./npmci.plugins"; | 
					
						
							| 
									
										
										
										
											2016-05-30 03:40:07 +02:00
										 |  |  | import {bash} from "./npmci.bash"; | 
					
						
							| 
									
										
										
										
											2016-05-30 02:28:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-29 22:54:59 +02:00
										 |  |  | let npmrcPrefix:string = "//registry.npmjs.org/:_authToken="; | 
					
						
							| 
									
										
										
										
											2016-05-30 02:28:47 +02:00
										 |  |  | let npmToken:string = process.env.NPMCITOKEN; | 
					
						
							|  |  |  | let npmrcFileString = npmrcPrefix + npmToken; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-29 22:54:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export let publish = () => { | 
					
						
							| 
									
										
										
										
											2016-05-30 02:28:47 +02:00
										 |  |  |     let done = plugins.q.defer(); | 
					
						
							| 
									
										
										
										
											2016-05-30 05:13:15 +02:00
										 |  |  |     if(npmToken){ | 
					
						
							|  |  |  |         plugins.beautylog.info("found access token"); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         plugins.beautylog.error("no access token found! Exiting!"); | 
					
						
							|  |  |  |         process.exit(1); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-05-30 05:29:18 +02:00
										 |  |  |     plugins.smartfile.memory.toFsSync(npmrcFileString,{fileName:".npmrc",filePath:"/root"}); | 
					
						
							| 
									
										
										
										
											2016-05-30 03:40:07 +02:00
										 |  |  |     bash("npm publish"); | 
					
						
							| 
									
										
										
										
											2016-05-30 03:06:18 +02:00
										 |  |  |     plugins.beautylog.ok("Done!") | 
					
						
							| 
									
										
										
										
											2016-05-30 02:28:47 +02:00
										 |  |  |     return done.promise; | 
					
						
							| 
									
										
										
										
											2016-05-29 22:54:59 +02:00
										 |  |  | }; |