| 
									
										
										
										
											2016-05-28 19:32:30 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-19 03:18:51 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | Initial build | 
					
						
							|  |  |  | ============= | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The `Makefile` handles all the dependencies in all cases but the first run | 
					
						
							|  |  |  | on a clean system can take a while because `make` uses `npx` to bootstrap  | 
					
						
							|  |  |  | the required apps/libs. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | It is recommended for a clean setup to either run make twice or run an | 
					
						
							|  |  |  | `npm install` first, this needs to be done to avoid version leaking from | 
					
						
							|  |  |  | the bootstrapped or global node packages to the build as defined by `package.json` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-02 20:05:05 +03:00
										 |  |  | Version numbers | 
					
						
							|  |  |  | =============== | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The app version number is automatically synced between package.json (primary) | 
					
						
							| 
									
										
										
										
											2022-02-03 13:22:59 +03:00
										 |  |  | and version.js, all version changes should be made in the former. | 
					
						
							| 
									
										
										
										
											2022-02-02 20:05:05 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-19 03:18:51 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-26 00:41:39 +03:00
										 |  |  | Debugging startup errors | 
					
						
							|  |  |  | ======================== | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | If something goes wrong on startup -- the splash screen is shown but the  | 
					
						
							|  |  |  | main window is not, DevTools should be automatically started in about 5  | 
					
						
							|  |  |  | seconds. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | If DevTools does not run then they can be started manually by: | 
					
						
							|  |  |  | 	$ IMAGEGRID_DEBUG=1 ig.js gui | 
					
						
							|  |  |  | or: | 
					
						
							|  |  |  | 	$ IMAGEGRID_DEBUG=1 make run | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Common reasons for failure on startup: | 
					
						
							|  |  |  | 	- path set in cfg/requirejs.js (baseUrl) is not correct on this  | 
					
						
							|  |  |  | 	  version on node/electron | 
					
						
							|  |  |  | 	- electron compatibility issue  | 
					
						
							|  |  |  | 	- rarely: some feature fails to call .declareReady() and the  | 
					
						
							|  |  |  | 	  startup process stalls waiting for it, this can be manually | 
					
						
							|  |  |  | 	  overridden by calling .ready() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-19 03:18:51 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-28 19:32:30 +03:00
										 |  |  | Modules and RequireJS | 
					
						
							|  |  |  | ===================== | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Most of the system is loaded via browser context RequireJS loader, in  | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | node/electron/nw context node-specific stuff is loaded with a second  | 
					
						
							|  |  |  | node-enabled RequireJS instance or node require. | 
					
						
							| 
									
										
										
										
											2016-05-28 19:32:30 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-04 05:11:14 +03:00
										 |  |  | The ideal solution would be to use one require that sees both the browser | 
					
						
							|  |  |  | and node contexts, the problem is exactly in this, the browser requirejs | 
					
						
							|  |  |  | does not see either node or node modules while the node require loads code | 
					
						
							|  |  |  | that is not visible to devtools unless it is running at that exact moment. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Thus we are forced to use both mode requirejs loaders which may be  | 
					
						
							|  |  |  | confusing at times. | 
					
						
							| 
									
										
										
										
											2016-05-28 19:32:30 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | Different loaders | 
					
						
							|  |  |  | ----------------- | 
					
						
							| 
									
										
										
										
											2016-05-28 19:32:30 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | There are two RequireJS instances present in most contexts in nw.js  | 
					
						
							|  |  |  | within the define(..) runner: | 
					
						
							|  |  |  | 	- require(..)		 | 
					
						
							|  |  |  | 		Pure browser RequireJS instance, used to load local  | 
					
						
							|  |  |  | 		modules. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	- requirejs(..)		 | 
					
						
							|  |  |  | 		Node-enabled RequireJS instance, used to load node  | 
					
						
							|  |  |  | 		modules. | 
					
						
							|  |  |  | 		This is needed as the above require(..) overloads the  | 
					
						
							|  |  |  | 		node native loader. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | The future | 
					
						
							|  |  |  | ---------- | 
					
						
							| 
									
										
										
										
											2016-05-28 19:32:30 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | This seems a bit confusing, so at least the naming convention should be | 
					
						
							|  |  |  | revised. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-19 03:18:51 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-11 06:24:22 +03:00
										 |  |  | Entry points | 
					
						
							|  |  |  | ============ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | We have two entry points here for a reason, e.js is tuned to be as  | 
					
						
							|  |  |  | light/fast as possible for the general case, i.e. when run without  | 
					
						
							|  |  |  | arguments combining it with ig.js would make things much-much slower... | 
					
						
							| 
									
										
										
										
											2020-12-11 06:24:22 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	- index.html			- Browser | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 	- electron e.js				- electron | 
					
						
							|  |  |  | 		<-> ig.js		- parse args if given and optionally  | 
					
						
							|  |  |  | 					  return control back to e.js... | 
					
						
							| 
									
										
										
										
											2020-12-11 06:24:22 +03:00
										 |  |  | 	- ig.js				- node | 
					
						
							|  |  |  | 		-> e.js			- node can spawn an electron app | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 |