| 
									
										
										
										
											2019-06-20 15:45:14 +02:00
										 |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const commander = require('commander'); | 
					
						
							|  |  |  | const packageJson = require('./package.json'); | 
					
						
							|  |  |  | const generateNewApp = require('strapi-generate-new'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const program = new commander.Command(packageJson.name); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let projectName; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | program | 
					
						
							|  |  |  |   .version(packageJson.version) | 
					
						
							|  |  |  |   .arguments('<directory>') | 
					
						
							| 
									
										
										
										
											2019-07-08 09:20:34 +02:00
										 |  |  |   .option('--no-run', 'Do not start the application after it is created') | 
					
						
							| 
									
										
										
										
											2019-07-02 17:38:06 +02:00
										 |  |  |   .option( | 
					
						
							|  |  |  |     '--use-npm', | 
					
						
							|  |  |  |     'Force usage of npm instead of yarn to create the project' | 
					
						
							|  |  |  |   ) | 
					
						
							| 
									
										
										
										
											2019-06-20 15:45:14 +02:00
										 |  |  |   .option('--debug', 'Display database connection error') | 
					
						
							|  |  |  |   .option('--quickstart', 'Quickstart app creation') | 
					
						
							|  |  |  |   .option('--dbclient <dbclient>', 'Database client') | 
					
						
							|  |  |  |   .option('--dbhost <dbhost>', 'Database host') | 
					
						
							|  |  |  |   .option('--dbsrv <dbsrv>', 'Database srv') | 
					
						
							|  |  |  |   .option('--dbport <dbport>', 'Database port') | 
					
						
							|  |  |  |   .option('--dbname <dbname>', 'Database name') | 
					
						
							|  |  |  |   .option('--dbusername <dbusername>', 'Database username') | 
					
						
							|  |  |  |   .option('--dbpassword <dbpassword>', 'Database password') | 
					
						
							|  |  |  |   .option('--dbssl <dbssl>', 'Database SSL') | 
					
						
							|  |  |  |   .option('--dbauth <dbauth>', 'Authentication Database') | 
					
						
							|  |  |  |   .option('--dbfile <dbfile>', 'Database file path for sqlite') | 
					
						
							|  |  |  |   .option('--dbforce', 'Overwrite database content if any') | 
					
						
							|  |  |  |   .description('create a new application') | 
					
						
							|  |  |  |   .action(directory => { | 
					
						
							|  |  |  |     projectName = directory; | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  |   .parse(process.argv); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (projectName === undefined) { | 
					
						
							|  |  |  |   console.error('Please specify the <directory> of your project'); | 
					
						
							|  |  |  |   process.exit(1); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | generateNewApp(projectName, program); |