redesign and add versions/links
This commit is contained in:
		
					parent
					
						
							
								24913a5ef9
							
						
					
				
			
			
				commit
				
					
						0f34967648
					
				
			
		
					 3 changed files with 181 additions and 120 deletions
				
			
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -7,7 +7,16 @@ const url = require('url') | ||||||
| 
 | 
 | ||||||
| // Parse command line options.
 | // Parse command line options.
 | ||||||
| const argv = process.argv.slice(1) | const argv = process.argv.slice(1) | ||||||
| const option = { file: null, help: null, default: null, version: null, webdriver: null, modules: [] } | 
 | ||||||
|  | const option = { | ||||||
|  |   file: null, | ||||||
|  |   help: null, | ||||||
|  |   default: null, | ||||||
|  |   version: null, | ||||||
|  |   webdriver: null, | ||||||
|  |   modules: [] | ||||||
|  | } | ||||||
|  | 
 | ||||||
| for (let i = 0; i < argv.length; i++) { | for (let i = 0; i < argv.length; i++) { | ||||||
|   if (argv[i] === '--version' || argv[i] === '-v') { |   if (argv[i] === '--version' || argv[i] === '-v') { | ||||||
|     option.version = true |     option.version = true | ||||||
|  | @ -18,7 +27,8 @@ for (let i = 0; i < argv.length; i++) { | ||||||
|   } else if (argv[i] === '--default' || argv[i] === '-d') { |   } else if (argv[i] === '--default' || argv[i] === '-d') { | ||||||
|     option.default = true |     option.default = true | ||||||
|     break |     break | ||||||
|   } else if (argv[i] === '--interactive' || argv[i] === '-i') { |   } else if (argv[i] === '--interactive' || argv[i] === '-i' || | ||||||
|  |     argv[i] === '-repl' || argv[i] === '-r') { | ||||||
|     option.interactive = true |     option.interactive = true | ||||||
|   } else if (argv[i] === '--test-type=webdriver') { |   } else if (argv[i] === '--test-type=webdriver') { | ||||||
|     option.webdriver = true |     option.webdriver = true | ||||||
|  | @ -44,11 +54,9 @@ app.on('window-all-closed', () => { | ||||||
| app.once('ready', () => { | app.once('ready', () => { | ||||||
|   if (Menu.getApplicationMenu()) return |   if (Menu.getApplicationMenu()) return | ||||||
| 
 | 
 | ||||||
|   const template = [ |   const template = [{ | ||||||
|     { |  | ||||||
|       label: 'Edit', |       label: 'Edit', | ||||||
|       submenu: [ |       submenu: [{ | ||||||
|         { |  | ||||||
|           role: 'undo' |           role: 'undo' | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|  | @ -79,8 +87,7 @@ app.once('ready', () => { | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       label: 'View', |       label: 'View', | ||||||
|       submenu: [ |       submenu: [{ | ||||||
|         { |  | ||||||
|           role: 'reload' |           role: 'reload' | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|  | @ -111,8 +118,7 @@ app.once('ready', () => { | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       role: 'window', |       role: 'window', | ||||||
|       submenu: [ |       submenu: [{ | ||||||
|         { |  | ||||||
|           role: 'minimize' |           role: 'minimize' | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|  | @ -122,16 +128,15 @@ app.once('ready', () => { | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       role: 'help', |       role: 'help', | ||||||
|       submenu: [ |       submenu: [{ | ||||||
|         { |  | ||||||
|           label: 'Learn More', |           label: 'Learn More', | ||||||
|           click () { |           click() { | ||||||
|             shell.openExternal('https://electron.atom.io') |             shell.openExternal('https://electron.atom.io') | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           label: 'Documentation', |           label: 'Documentation', | ||||||
|           click () { |           click() { | ||||||
|             shell.openExternal( |             shell.openExternal( | ||||||
|               `https://github.com/electron/electron/tree/v${process.versions.electron}/docs#readme` |               `https://github.com/electron/electron/tree/v${process.versions.electron}/docs#readme` | ||||||
|             ) |             ) | ||||||
|  | @ -139,13 +144,13 @@ app.once('ready', () => { | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           label: 'Community Discussions', |           label: 'Community Discussions', | ||||||
|           click () { |           click() { | ||||||
|             shell.openExternal('https://discuss.atom.io/c/electron') |             shell.openExternal('https://discuss.atom.io/c/electron') | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           label: 'Search Issues', |           label: 'Search Issues', | ||||||
|           click () { |           click() { | ||||||
|             shell.openExternal('https://github.com/electron/electron/issues') |             shell.openExternal('https://github.com/electron/electron/issues') | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|  | @ -156,8 +161,7 @@ app.once('ready', () => { | ||||||
|   if (process.platform === 'darwin') { |   if (process.platform === 'darwin') { | ||||||
|     template.unshift({ |     template.unshift({ | ||||||
|       label: 'Electron', |       label: 'Electron', | ||||||
|       submenu: [ |       submenu: [{ | ||||||
|         { |  | ||||||
|           role: 'about' |           role: 'about' | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|  | @ -187,24 +191,19 @@ app.once('ready', () => { | ||||||
|         } |         } | ||||||
|       ] |       ] | ||||||
|     }) |     }) | ||||||
|     template[1].submenu.push( |     template[1].submenu.push({ | ||||||
|       { |  | ||||||
|       type: 'separator' |       type: 'separator' | ||||||
|       }, |     }, { | ||||||
|       { |  | ||||||
|       label: 'Speech', |       label: 'Speech', | ||||||
|         submenu: [ |       submenu: [{ | ||||||
|           { |  | ||||||
|           role: 'startspeaking' |           role: 'startspeaking' | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           role: 'stopspeaking' |           role: 'stopspeaking' | ||||||
|         } |         } | ||||||
|       ] |       ] | ||||||
|       } |     }) | ||||||
|     ) |     template[3].submenu = [{ | ||||||
|     template[3].submenu = [ |  | ||||||
|       { |  | ||||||
|         role: 'close' |         role: 'close' | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|  | @ -223,11 +222,9 @@ app.once('ready', () => { | ||||||
|   } else { |   } else { | ||||||
|     template.unshift({ |     template.unshift({ | ||||||
|       label: 'File', |       label: 'File', | ||||||
|       submenu: [ |       submenu: [{ | ||||||
|         { |  | ||||||
|         role: 'quit' |         role: 'quit' | ||||||
|         } |       }] | ||||||
|       ] |  | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | @ -239,7 +236,7 @@ if (option.modules.length > 0) { | ||||||
|   Module._preloadModules(option.modules) |   Module._preloadModules(option.modules) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function loadApplicationPackage (packagePath) { | function loadApplicationPackage(packagePath) { | ||||||
|   // Add a flag indicating app is started from default app.
 |   // Add a flag indicating app is started from default app.
 | ||||||
|   process.defaultApp = true |   process.defaultApp = true | ||||||
| 
 | 
 | ||||||
|  | @ -285,17 +282,17 @@ function loadApplicationPackage (packagePath) { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function showErrorMessage (message) { | function showErrorMessage(message) { | ||||||
|   app.focus() |   app.focus() | ||||||
|   dialog.showErrorBox('Error launching app', message) |   dialog.showErrorBox('Error launching app', message) | ||||||
|   process.exit(1) |   process.exit(1) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function loadApplicationByUrl (appUrl) { | function loadApplicationByUrl(appUrl) { | ||||||
|   require('./default_app').load(appUrl) |   require('./default_app').load(appUrl) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function startRepl () { | function startRepl() { | ||||||
|   if (process.platform === 'win32') { |   if (process.platform === 'win32') { | ||||||
|     console.error('Electron REPL not currently supported on Windows') |     console.error('Electron REPL not currently supported on Windows') | ||||||
|     process.exit(1) |     process.exit(1) | ||||||
|  |  | ||||||
|  | @ -9,8 +9,9 @@ document.onclick = (e) => { | ||||||
|   return false |   return false | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const version = process.versions.electron | document.querySelector('.electron-version').innerText = `Electron v${process.versions.electron}` | ||||||
| document.querySelector('.header-version').innerText = version | document.querySelector('.chrome-version').innerText = `Chrome v${process.versions.chrome}` | ||||||
| document.querySelector('.command-example').innerText = `${execPath} path-to-your-app` | document.querySelector('.node-version').innerText = `Node v${process.versions.node}` | ||||||
| document.querySelector('.quick-start-link').href = `https://github.com/electron/electron/blob/v${version}/docs/tutorial/quick-start.md` | document.querySelector('.v8-version').innerText = `v8 v${process.versions.v8}` | ||||||
| document.querySelector('.docs-link').href = `https://github.com/electron/electron/tree/v${version}/docs#readme` | 
 | ||||||
|  | document.querySelector('.command-example').innerText = `${execPath} path-to-app` | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Shelley Vohr
				Shelley Vohr