| 
									
										
										
										
											2017-12-19 21:23:20 +01:00
										 |  |  | const shell = require('shelljs'); | 
					
						
							|  |  |  | const path = require('path'); | 
					
						
							| 
									
										
										
										
											2017-12-20 12:20:22 +01:00
										 |  |  | const _ = require('lodash'); | 
					
						
							| 
									
										
										
										
											2017-12-19 21:23:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-20 12:20:22 +01:00
										 |  |  | shell.echo(''); | 
					
						
							|  |  |  | shell.echo('🕓  The setup process can take few minutes.'); | 
					
						
							|  |  |  | shell.echo('📦  Installing admin packages...'); | 
					
						
							|  |  |  | shell.echo(''); | 
					
						
							| 
									
										
										
										
											2017-12-19 21:23:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-20 12:20:22 +01:00
										 |  |  | const pwd = shell.pwd(); | 
					
						
							| 
									
										
										
										
											2017-12-19 21:23:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-20 12:20:22 +01:00
										 |  |  | shell.exec(`cd ${path.resolve(pwd.stdout, 'node_modules', 'strapi-helper-plugin')} && npm install`, { | 
					
						
							|  |  |  |   silent: true | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2017-12-19 21:23:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-20 18:34:33 +01:00
										 |  |  | shell.echo('🏗  Building...'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const build = shell.exec(`cd ${path.resolve(pwd.stdout)} && npm run build`, { | 
					
						
							|  |  |  |   silent: true | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (build.stderr) { | 
					
						
							|  |  |  |   console.error(build.stderr); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-19 21:23:20 +01:00
										 |  |  | const plugins = path.resolve(pwd.stdout, '..', 'plugins'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | shell.ls('* -d', plugins).forEach(function (plugin) { | 
					
						
							| 
									
										
										
										
											2017-12-20 12:20:22 +01:00
										 |  |  |   shell.echo(`🔸  ${_.upperFirst(plugin)} (plugin)`); | 
					
						
							|  |  |  |   shell.echo('📦  Installing packages...'); | 
					
						
							|  |  |  |   shell.exec(`cd ${path.resolve(plugins, plugin)} && npm install`, { | 
					
						
							|  |  |  |     silent: true | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   shell.exec(`cd ${path.resolve(plugins, plugin, 'node_modules', 'strapi-helper-plugin')} && npm install`, { | 
					
						
							|  |  |  |     silent: true | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   shell.echo('🏗  Building...'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const build = shell.exec(`cd ${path.resolve(plugins, plugin)} && npm run build`, { | 
					
						
							|  |  |  |     silent: true | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-20 15:43:17 +01:00
										 |  |  |   if (build.stderr) { | 
					
						
							|  |  |  |     console.error(build.stderr); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2017-12-20 12:20:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   shell.echo(''); | 
					
						
							| 
									
										
										
										
											2017-12-19 21:23:20 +01:00
										 |  |  | }); |