From 13945780889ea76ca33551fd73b70f3ef0733aec Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 13 Jan 2018 01:59:52 +0300 Subject: [PATCH] more cleanup, docs and refactoring... Signed-off-by: Alex A. Naanou --- ui (gen4)/Makefile | 8 ++- ui (gen4)/doc/BUILD-NOTES | 47 ++++++++-------- ui (gen4)/doc/NOTES | 30 +++++----- ui (gen4)/ig.js | 112 +++++++++++++++++++------------------- ui (gen4)/index.html | 4 +- 5 files changed, 104 insertions(+), 97 deletions(-) mode change 100644 => 100755 ui (gen4)/ig.js diff --git a/ui (gen4)/Makefile b/ui (gen4)/Makefile index 2c1c8745..de02fdd7 100755 --- a/ui (gen4)/Makefile +++ b/ui (gen4)/Makefile @@ -69,7 +69,8 @@ APP_NAME ?= ImageGrid.Viewer # XXX get actual version... -VERSION := $(strip $(shell node ./ig --version)) +# XXX need to make getting the version usable from a bare checkout... +VERSION := $(strip $(shell node ./ig --version || echo 4.0.0a)) DATE := $(strip $(shell date "+%Y%m%d %H%M")) COMMIT := $(strip $(shell git rev-parse HEAD)) @@ -269,6 +270,9 @@ $(BUILD_INFO): $(CSS_FILES) $(NODE_DIR) $(PROJECT_FILES) \ lessc $< > $@ +# XXX might be a good idea to install directly to $(BUILD_DIR) so as not +# to messup the current dir... +# npm install --prefix ./build # XXX need to make this arch/os specific for cross compiling... $(NODE_DIR): npm install @@ -373,7 +377,7 @@ $(BUILD_DIR)/$(APP_NAME)-%/: $(TARGET_DIR)/$(ELECTRON_DIST) \ # modify the archive in place (electron-specific)... # XXX need to setup app icons... -$(BUILD_DIR)/$(APP_NAME)-$(VERSION)-%.in-place.zip: $(TARGET_DIR)/$(ELECTRON_DIST) \ +$(BUILD_DIR)/$(APP_NAME)-%.in-place.zip: $(TARGET_DIR)/$(ELECTRON_DIST) \ $(BUILD_DIR)/app.asar $(BUILD_INFO) cp "$<" "$@.tmp" # # setup app icon... diff --git a/ui (gen4)/doc/BUILD-NOTES b/ui (gen4)/doc/BUILD-NOTES index cfd267ba..d648e96c 100755 --- a/ui (gen4)/doc/BUILD-NOTES +++ b/ui (gen4)/doc/BUILD-NOTES @@ -1,24 +1,39 @@ Basic build ----------- -Default desktop app build: +Default desktop electron app build (modifying the electron dist in-place): make -Build desktop app with full repack: +Build desktop electron app with full repack: (export BUILD_MODE=repack && make) -Build list of files for web: +Build package files for web: make web -Chromium flicker issue ----------------------- +Sharp and other native modules for nw/electron +---------------------------------------------- + +To build sharp for a specific version of node and nwjs: + + cd ./node_modules/sharp/ + nw-gyp rebuild --target=0.17.4 --arch=x64 + + +And for electron (done by make): + + electron-rebuild + + + +Chromium flicker issue (nw) +--------------------------- The UI sometimes flickers -- at first blanks out to black then re-draws, this is most noticeable on white or gray backgrounds. @@ -32,8 +47,8 @@ This will fix the issue temporarily, but we still need a better solution. -Remote debugging via DevTools ------------------------------ +Remote debugging via DevTools (nw) +---------------------------------- Set this in package.json: "chromium-args": "--remote-debugging-port=9222", @@ -42,22 +57,8 @@ Then open http://localhost:9222 in chrome. -Sharp and other native modules for nw/electron ----------------------------------------------- - -To build sharp for a specific version of node and nwjs: - - cd ./node_modules/sharp/ - nw-gyp rebuild --target=0.17.4 --arch=x64 - -And for electron: - - electron-rebuild - - - -Speedup loading of app ----------------------- +Speedup loading of app (nw) +--------------------------- One of the ways to speed up the load times when packed is to store Node's modules ./node_modules in a separate location, outside of the app.zip diff --git a/ui (gen4)/doc/NOTES b/ui (gen4)/doc/NOTES index b7b7fbb9..f2dfe1bf 100755 --- a/ui (gen4)/doc/NOTES +++ b/ui (gen4)/doc/NOTES @@ -46,34 +46,34 @@ ImageGrid.Viewer can be run in a number of runtimes on multiple platforms. Browser ------- -npm install -index.html + npm install + index.html Node.js ------- -npm install -node ig.js --help - - - -NW.js ------ - -npm install -npm start + npm install + node ig.js --help Electron -------- -XXX EXPERIMENTAL -- mostly runs in restricted (browser-like) mode... + npm install + npm start -npm install -electron e.js + + +NW.js +----- + +change "main" to "index.html" in package.json + + npm install + nw . diff --git a/ui (gen4)/ig.js b/ui (gen4)/ig.js old mode 100644 new mode 100755 index ddae11e6..38e659e4 --- a/ui (gen4)/ig.js +++ b/ui (gen4)/ig.js @@ -1,56 +1,56 @@ -#!/usr/bin/env node -/********************************************************************** -* -* ImageGrid.CLI entry point... -* -* -**********************************************************************/ - -//var DEBUG = DEBUG != null ? DEBUG : true - -require('./cfg/requirejs') - -nodeRequire = -global.nodeRequire = - require - -require = -requirejs = -global.requirejs = - require('requirejs') - - - -//--------------------------------------------------------------------- - -// XXX need to automate this... -var core = require('features/core') -var base = require('features/base') -var cli = require('features/cli') - -var meta = require('features/meta') - - - -/*********************************************************************/ - -// NOTE: this is here to simplify importing... -var ImageGridFeatures = -module.ImageGridFeatures = - core.ImageGridFeatures - - -//--------------------------------------------------------------------- - -// setup actions and start... -ImageGridFeatures - .setup([ - 'imagegrid-testing', - 'imagegrid-commandline', - ]) - .start() - - - -/********************************************************************** -* vim:set ts=4 sw=4 : */ +#!/usr/bin/env node +/********************************************************************** +* +* ImageGrid.CLI entry point... +* +* +**********************************************************************/ + +//var DEBUG = DEBUG != null ? DEBUG : true + +require('./cfg/requirejs') + +nodeRequire = +global.nodeRequire = + require + +require = +requirejs = +global.requirejs = + require('requirejs') + + + +//--------------------------------------------------------------------- + +// XXX need to automate this... +var core = require('features/core') +var base = require('features/base') +var cli = require('features/cli') + +var meta = require('features/meta') + + + +/*********************************************************************/ + +// NOTE: this is here to simplify importing... +var ImageGridFeatures = +module.ImageGridFeatures = + core.ImageGridFeatures + + +//--------------------------------------------------------------------- + +// setup actions and start... +ImageGridFeatures + .setup([ + 'imagegrid-testing', + 'imagegrid-commandline', + ]) + .start() + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */ diff --git a/ui (gen4)/index.html b/ui (gen4)/index.html index 4a1e88fb..8fb71f8e 100755 --- a/ui (gen4)/index.html +++ b/ui (gen4)/index.html @@ -89,7 +89,9 @@ if(window.require && window.nw){ - +