From e1615cc7df78ead68cf9d58c8a11d1c613b670c9 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 30 Jan 2018 06:36:48 +0300 Subject: [PATCH] fixing nw runtime compatibility... Signed-off-by: Alex A. Naanou --- ui (gen4)/Makefile | 12 +++++++++--- ui (gen4)/e.js | 3 ++- ui (gen4)/electron.html | 6 +++--- ui (gen4)/index.html | 14 +++++++++----- ui (gen4)/package.json | 6 ++++-- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/ui (gen4)/Makefile b/ui (gen4)/Makefile index d82bcd86..569a2577 100755 --- a/ui (gen4)/Makefile +++ b/ui (gen4)/Makefile @@ -162,7 +162,7 @@ ELECTRON_DIST ?= electron-$(ELECTRON_VERSION)-$(TARGET_OS)-$(ARCH).zip # NW... # # XXX get the version dynamically... (???) -NW_VERSION ?= v0.27.5 +NW_VERSION ?= v0.28.0 NW_DIST ?= nwjs-sdk-$(NW_VERSION)-$(NW_OS)-$(ARCH).zip NW_DOWNOAD_URL ?= https://dl.nwjs.io/$(NW_VERSION) @@ -554,13 +554,18 @@ $(TARGET_DIR)/$(ELECTRON_DIST): # pack app.asar (electron-specific)... +# XXX should this update package.json -> set "main" to "e.js"... .PRECIOUS: $(BUILD_DIR)/app.asar # XXX do we need to track changes to pack-full or to build it only if # app.asar is deleted? +# ...should we bakup the original package.json??? #$(BUILD_DIR)/app.asar: # make check $(PACK_FULL) $(BUILD_DIR)/app.asar: $(PACK_FULL) - cd $(BUILD_DIR) ; \ + # update package.json to start electron... + cd "$(BUILD_DIR)/$(APP_NAME)/" ; \ + cat package.json | sed 's/"index.html"/"e.js"/g' > package.json + cd "$(BUILD_DIR)" ; \ asar p "$(APP_NAME)" app.asar \ --exclude-hidden \ --unpack-dir node_modules/sharp @@ -641,12 +646,13 @@ $(TARGET_DIR)/$(NW_DIST): # NOTE: this needs a clean app dir... +# XXX this is not runnable yet... .PRECIOUS: $(BUILD_DIR)/package.nw $(BUILD_DIR)/package.nw: INCLUDE_NODE_MODULES += $(INCLUDE_NW_NODE_MODULES) $(BUILD_DIR)/package.nw: PACK_MINIMAL = $(BUILD_DIR)/$(APP_NAME)/ \ $(call includeNodeModules,$(INCLUDE_NODE_MODULES)) $(BUILD_DIR)/package.nw: $$(PACK_MINIMAL) - # update package.json... + # update package.json to start nw... cd "$<" ; \ cat package.json | sed 's/"e.js"/"index.html"/g' > package.json $(call zipFrom,$<,$@,*) diff --git a/ui (gen4)/e.js b/ui (gen4)/e.js index 73841aaf..d4d82f4a 100644 --- a/ui (gen4)/e.js +++ b/ui (gen4)/e.js @@ -52,7 +52,8 @@ function createWindow(){ // and load the index.html of the app. win.loadURL(url.format({ // XXX unify this with index.html - pathname: path.join(__dirname, 'electron.html'), + //pathname: path.join(__dirname, 'electron.html'), + pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true })) diff --git a/ui (gen4)/electron.html b/ui (gen4)/electron.html index 5a1f3598..d0f3d5b2 100755 --- a/ui (gen4)/electron.html +++ b/ui (gen4)/electron.html @@ -31,7 +31,7 @@ - + @@ -81,7 +81,7 @@ if(window.require && window.nw){ - + - + @@ -83,14 +83,18 @@ if(window.require && window.nw){ - + - diff --git a/ui (gen4)/package.json b/ui (gen4)/package.json index 03b50921..de3ca5c3 100755 --- a/ui (gen4)/package.json +++ b/ui (gen4)/package.json @@ -1,6 +1,6 @@ { "name": "ImageGrid.Viewer.g4", - "main": "e.js", + "main": "index.html", "version": "4.0.0a", "author": "Alex A. Naanou (https://github.com/flynx)", "contributors": [], @@ -54,7 +54,9 @@ "scripts": { "build-css": "lessc css/layout.less css/layout.css", "build-dist": "make dist", - "start": "electron e.js" + "start": "electron e.js", + "start-nw": "nw .", + "start-electron": "electron e.js ." }, "vim-cfg": " vim:set ts=2 sw=2 expandtab : " }