| 
									
										
										
										
											2017-10-10 11:11:17 +02:00
										 |  |  | const _ = require('lodash'); | 
					
						
							|  |  |  | const fs = require('fs'); | 
					
						
							|  |  |  | const path = require('path'); | 
					
						
							|  |  |  | const shell = require('shelljs'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | try { | 
					
						
							| 
									
										
										
										
											2017-10-10 11:21:48 +02:00
										 |  |  |   const versions = fs.readdirSync(path.resolve(process.cwd(), 'docs'), 'utf8').filter(x => x[0] !== '.'); | 
					
						
							| 
									
										
										
										
											2017-10-10 11:11:17 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   _.forEach(versions, (version) => { | 
					
						
							|  |  |  |     console.log(`Strapi install plugins version ${version}`); | 
					
						
							|  |  |  |     shell.exec(`${path.join(process.cwd(), 'node_modules', '.bin', 'gitbook')} install ${path.join(process.cwd(), 'docs', version)}`); | 
					
						
							|  |  |  |     console.log(`Strapi build version ${version}`); | 
					
						
							|  |  |  |     shell.exec(`${path.join(process.cwd(), 'node_modules', '.bin', 'gitbook')} build ${path.join(process.cwd(), 'docs', version)}`); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   console.log('Documentation has been built with success'); | 
					
						
							|  |  |  | } catch (err) { | 
					
						
							|  |  |  |   if (err.stdout) { | 
					
						
							|  |  |  |     return console.log(err.stdout.toString('utf8')); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   console.log(err); | 
					
						
							|  |  |  | } |