more cleanup, docs and refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-01-13 01:59:52 +03:00
parent d498bd6263
commit 1394578088
5 changed files with 104 additions and 97 deletions

View File

@ -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...

View File

@ -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

View File

@ -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 .

112
ui (gen4)/ig.js Normal file → Executable file
View File

@ -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 : */

View File

@ -89,7 +89,9 @@ if(window.require && window.nw){
<!--script data-main="ui" src="ext-lib/require.js"></script-->
<script src="ext-lib/require.js"></script>
<script src="cfg/requirejs.js"></script>
<script> requirejs(['ui']) </script>
<script>
requirejs(['cfg/requirejs.js', 'ui'])
</script>
</head>
<body>