| 
									
										
										
										
											2020-12-23 00:12:32 +03:00
										 |  |  | In general | 
					
						
							|  |  |  | ---------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The idea is to make the project as simple as possible and the dev cycle  | 
					
						
							|  |  |  | as efficient as possible, for this reason only one lib manager is used  | 
					
						
							|  |  |  | (npm), only one build system (make) and any translation layers are  | 
					
						
							|  |  |  | avoided (less is likely to be phased out). | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | With this approach for most cases and for testing in the browser after  | 
					
						
							|  |  |  | the initial setup only refreshing the page is required to load most of  | 
					
						
							|  |  |  | the changes (./css/layout.less being the only exception). | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-15 17:02:24 +03:00
										 |  |  | General environment | 
					
						
							|  |  |  | ------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ImageGrid will require the following installed and in path: | 
					
						
							|  |  |  | 	- bash | 
					
						
							|  |  |  | 	- make (GNU Make) | 
					
						
							|  |  |  | 	- git | 
					
						
							|  |  |  | 	- wget | 
					
						
							|  |  |  | 	- zip / unzip / zipnote | 
					
						
							|  |  |  | 	- grep / egrep / fgrep | 
					
						
							|  |  |  | 	- sed | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Some more dependencies will be installed by make via npm locally. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Dependencies can be checked with: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	$ make check | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Then the build system/process is generally the same on all platforms: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - Clone the repository: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	$ git clone https://github.com/flynx/ImageGrid.git | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - Build the dev envioronment (bash): | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	$ make dev | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - Run in-place: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	$ make run | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - Build a distro: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	$ make dist | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Windows environment | 
					
						
							|  |  |  | ------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This will require a UN*X-like build environment to run make and friends. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | One way to go about this is (admin PowerShell): | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - Install Chocolate | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   For more info see: https://chocolatey.org/install | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - Install git-bash based env: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	> choco install git nodejs wget zip sed grep | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Now we can proceed with the normal build. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The Makefile | 
					
						
							|  |  |  | ------------ | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | For make help to work make requires: bash, sed, grep/fgrep and printf to  | 
					
						
							|  |  |  | be available in the path, run this to double check: | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | 	$ make check-help | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-23 00:12:32 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | To check the full list of dependencies run: | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | 	$ make check | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | The make file is largely self-documented so run this for more info: | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | 	$ make help | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | Sharp and other native modules for nw/electron | 
					
						
							|  |  |  | ---------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | And for electron (done by make): | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | 	electron-rebuild | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | To build sharp for a specific version of node and nwjs (outdated): | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | 	cd ./node_modules/sharp/ | 
					
						
							|  |  |  | 	nw-gyp rebuild --target=0.17.4 --arch=x64 | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | Chromium flicker issue (nw/outdated) | 
					
						
							|  |  |  | ------------------------------------ | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-04 05:18:12 +03:00
										 |  |  | The UI sometimes flickers -- at first blanks out to black then re-draws, | 
					
						
							|  |  |  | this is most noticeable on white or gray backgrounds.  | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | This appears to be GPU related. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | package.json: | 
					
						
							|  |  |  | 	"chromium-args": "--disable-gpu-compositing", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-04 05:18:12 +03:00
										 |  |  | This will fix the issue temporarily, but we still need a better solution. | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | Remote debugging via DevTools (nw/outdated) | 
					
						
							|  |  |  | ------------------------------------------- | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | Set this in package.json: | 
					
						
							|  |  |  |   "chromium-args": "--remote-debugging-port=9222", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Then open http://localhost:9222 in chrome. | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | Speedup loading of app (nw/outdated) | 
					
						
							|  |  |  | ------------------------------------ | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | One of the ways to speed up the load times when packed is to store Node's | 
					
						
							| 
									
										
										
										
											2016-10-04 05:18:12 +03:00
										 |  |  | modules ./node_modules in a separate location, outside of the app.zip | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | or package.nw | 
					
						
							|  |  |  | To enable require(..) to find them: | 
					
						
							|  |  |  | 	- > npm install --save app-module-path | 
					
						
							|  |  |  | 	- when building the zip move all the modules out to a new location | 
					
						
							|  |  |  | 	  *except* app-module-path | 
					
						
							|  |  |  | 	- add this line to all root js modules *before* any other  | 
					
						
							|  |  |  | 	  require(..) is called: | 
					
						
							|  |  |  | 	  	if(process.__nwjs){ | 
					
						
							|  |  |  | 			var path = require('path') | 
					
						
							|  |  |  | 			require('app-module-path') | 
					
						
							|  |  |  | 				.addPath(path.dirname(process.execPath)  | 
					
						
							| 
									
										
										
										
											2020-08-31 17:37:06 +03:00
										 |  |  | 					+ '/node_modules/') } | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 |