From 07eea858c9d78de1f352a2ef2703c0c9fdee360c Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Tue, 6 Aug 2019 13:51:08 +0100 Subject: [PATCH] Enable standalone with electron-builder Former-commit-id: be069aff1f580a2d9dff44e9b89bc6da9676da5a [formerly 86a957be8e6362f75c29b220970315371ca909d8] Former-commit-id: a84c3caaed445853177feca1dd8a5c410387466b --- package.json | 30 +++++++++++++++++++++++++++++- www/js/init.js | 8 ++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 525bde89..2deb9b6b 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,37 @@ "version": "1.0.0", "description": "Kiwix JS Windows Electron", "main": "main.js", + "build": { + "appId": "kiwix.js.windows", + "productName": "Kiwix JS Windows Electron Edition", + "directories": { + "output": "bld/Electron" + }, + "win": { + "target": [ + { + "target": "portable", + "arch": "ia32" + } + ] + }, + "asar": true, + "files": [ + "!**/archives/*", + "!**/AppPackages/*", + "!**/BundleArtifacts/*", + "!**/images/*", + "!**/bin/*", + "!**/bld/*", + "!**/{ KiwixWebApp.*, [pP]ackage.[aSl] }" + ] + }, "scripts": { "start": "electron .", + "dist": "electron-builder", "package-mac": "electron-packager . kiwix-js-windows --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds", - "package-win": "electron-packager . kiwix-js-windows --asar=true --ignore=archives --ignore=AppPackages --ignore=BundleArtifacts --ignore=images$ --ignore=bin$ --ignore=bld$ --ignore=KiwixWebApp.* --ignore=Timing.* --ignore=[pP]ackage.[aSl] --ignore=node_ --ignore=[.]git[hi][ug][bn] --ignore=[.]vs$ --ignore=vscode --overwrite --platform=win32 --arch=ia32 --icon=www/img/icons/kiwix-64.ico --prune=true --out=bld/electron --version-string.CompanyName=Kiwix --version-string.FileDescription='Kiwix JS ZIM File Reader' --version-string.ProductName='Kiwix JS for Windows Electron Edition'", + "package-win": "electron-packager . kiwix-js-windows --asar --ignore=archives --ignore=AppPackages --ignore=BundleArtifacts --ignore=images$ --ignore=bin$ --ignore=bld$ --ignore=KiwixWebApp.* --ignore=[pP]ackage.[aSl] --ignore=node_ --ignore=[.]git[hi][ug][bn] --ignore=[.]vs$ --ignore=vscode --overwrite --platform=win32 --arch=ia32 --icon=www/img/icons/kiwix-64.ico --prune=true --out=bld/electron --version-string.CompanyName=Kiwix --version-string.FileDescription='Kiwix JS ZIM File Reader' --version-string.ProductName='Kiwix JS for Windows Electron Edition'", + "postpackage-win": "(robocopy archives bld\\Electron\\kiwix-js-windows-win32-ia32\\archives\\ /XF wikiv*.* > null) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0", "package-linux": "electron-packager . kiwix-js-windows --overwrite --platform=linux --arch=x64 --icon=www/img/icons/kiwix-64.png --prune=true --out=bld/electron" }, "repository": "https://github.com/kiwix/kiwix-js-windows", @@ -22,6 +49,7 @@ "license": "CC0-1.0", "devDependencies": { "electron": "^5.0.8", + "electron-builder": "^21.2.0", "electron-packager": "^14.0.3" } } diff --git a/www/js/init.js b/www/js/init.js index dcb8f94e..8791b193 100644 --- a/www/js/init.js +++ b/www/js/init.js @@ -32,10 +32,10 @@ var state = {}; // Parameters that define overall operation of app var params = {}; params['version'] = "0.9.9.92 Beta-dev"; //DEV: do not set this dynamically -- it is compared to the cookie "version" in order to show first-time info, and the cookie is updated in app.js -params['packagedFile'] = "wikipedia_en_100.zim"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage -params['archivePath'] = "archives"; //The directory containing the packaged archive(s) (relative to app's root directory) -params['fileVersion'] = "wikipedia_en_100_2019-01 (Jan-2019)"; //Use generic name for actual file, and give version here -params['cachedStartPage'] = "index.htm"; //If you have cached the start page for quick start, give its URI here +params['packagedFile'] = false; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage +params['archivePath'] = false; //The directory containing the packaged archive(s) (relative to app's root directory) +params['fileVersion'] = false; //Use generic name for actual file, and give version here +params['cachedStartPage'] = false; //If you have cached the start page for quick start, give its URI here params['kiwixDownloadLink'] = "https://download.kiwix.org/zim/"; //Include final slash params['results'] = params['results'] || 50; //Number of search results to display