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... # 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")) DATE := $(strip $(shell date "+%Y%m%d %H%M"))
COMMIT := $(strip $(shell git rev-parse HEAD)) COMMIT := $(strip $(shell git rev-parse HEAD))
@ -269,6 +270,9 @@ $(BUILD_INFO): $(CSS_FILES) $(NODE_DIR) $(PROJECT_FILES) \
lessc $< > $@ 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... # XXX need to make this arch/os specific for cross compiling...
$(NODE_DIR): $(NODE_DIR):
npm install npm install
@ -373,7 +377,7 @@ $(BUILD_DIR)/$(APP_NAME)-%/: $(TARGET_DIR)/$(ELECTRON_DIST) \
# modify the archive in place (electron-specific)... # modify the archive in place (electron-specific)...
# XXX need to setup app icons... # 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) $(BUILD_DIR)/app.asar $(BUILD_INFO)
cp "$<" "$@.tmp" cp "$<" "$@.tmp"
# # setup app icon... # # setup app icon...

View File

@ -1,24 +1,39 @@
Basic build Basic build
----------- -----------
Default desktop app build: Default desktop electron app build (modifying the electron dist in-place):
make make
Build desktop app with full repack: Build desktop electron app with full repack:
(export BUILD_MODE=repack && make) (export BUILD_MODE=repack && make)
Build list of files for web: Build package files for web:
make 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, The UI sometimes flickers -- at first blanks out to black then re-draws,
this is most noticeable on white or gray backgrounds. 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: Set this in package.json:
"chromium-args": "--remote-debugging-port=9222", "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 Speedup loading of app (nw)
---------------------------------------------- ---------------------------
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
----------------------
One of the ways to speed up the load times when packed is to store Node's 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 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 Browser
------- -------
npm install npm install
index.html index.html
Node.js Node.js
------- -------
npm install npm install
node ig.js --help node ig.js --help
NW.js
-----
npm install
npm start
Electron 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 .

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

View File

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