diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml new file mode 100644 index 000000000..d5ef04dfa --- /dev/null +++ b/.github/workflows/build-desktop.yml @@ -0,0 +1,65 @@ +name: Build Desktop App + +on: + push: + branches: [ master, feature/nwjs ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 +# - name: Install wine +# run: sudo apt-get install wine +# - name: Install wine gecko +# run: | +# wget http://dl.winehq.org/wine/wine-gecko/2.47.2/wine-gecko-2.47.2-x86_64.msi +# wine msiexec /i wine-gecko-2.47.2-x86_64.msi + - uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - id: set_var + shell: bash + run: | + sed -i 's/"name": "grid-apps"/"name": "kiri-moto"/g' package.json + content=`cat ./package.json` + # the following lines are only required for multi line json + content="${content//'%'/'%25'}" + content="${content//$'\n'/'%0A'}" + content="${content//$'\r'/'%0D'}" + # end of optional handling for multi line json + echo "::set-output name=packageJson::$content" + - run: | + echo "${{fromJson(steps.set_var.outputs.packageJson).name}}" + echo "${{fromJson(steps.set_var.outputs.packageJson).version}}" + shell: bash + - name: Build App + shell: bash + run: | + npm install + npm run build:nw + - uses: actions/upload-artifact@v2 + name: Store Linux x64 + with: + name: kiri-moto-linux-x64 + path: dist/${{fromJson(steps.set_var.outputs.packageJson).name}}-${{fromJson(steps.set_var.outputs.packageJson).version}}-linux-x64.zip + - uses: actions/upload-artifact@v2 + name: Store Linux x86 + with: + name: kiri-moto-linux-x86 + path: dist/${{fromJson(steps.set_var.outputs.packageJson).name}}-${{fromJson(steps.set_var.outputs.packageJson).version}}-linux-x86.zip + - uses: actions/upload-artifact@v2 + name: Store macOS x86 + with: + name: kiri-moto-mac-x64 + path: dist/${{fromJson(steps.set_var.outputs.packageJson).name}}-${{fromJson(steps.set_var.outputs.packageJson).version}}-mac-x64.zip + - uses: actions/upload-artifact@v2 + name: Store Windows x64 + with: + name: kiri-moto-win-x64 + path: dist/${{fromJson(steps.set_var.outputs.packageJson).name}}-${{fromJson(steps.set_var.outputs.packageJson).version}}-win-x64.zip diff --git a/.gitignore b/.gitignore index 02a385d7c..05e73f56c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules package-lock.json logs/* data/* +dist/* diff --git a/package.json b/package.json index 013180c81..7eb684c82 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,16 @@ "author": "Stewart Allen ", "license": "MIT", "private": false, + "main": "http://localhost:8080/kiri/", + "node-remote": "http://localhost:8080/kiri/", + "node-main": "", + "window": { + "width": 960, + "height": 700, + "min_width": 700, + "min_height": 500, + "icon": "web/meta/favicon-mobile.png" + }, "repository": { "type": "git", "url": "https://github.com/gridspace/apps.git" @@ -21,6 +31,7 @@ "slicer" ], "dependencies": { + "@gridspace/app-server": "^0.0.7", "base64-js": "^1.5.1", "buffer-crc32": "^0.2.13", "compression": "^1.7.4", @@ -36,5 +47,80 @@ "uglify-es": "3.3.9", "validator": "^8.2.0", "ws": "^7.2.3" + }, + "devDependencies": { + "concurrently": "^6.2.0", + "nw": "0.54.0-sdk", + "nwjs-builder-phoenix": "^1.15.0", + "rimraf": "^3.0.2", + "wait-on": "^5.3.0" + }, + "scripts": { + "debug": "gs-app-server --debug", + "server": "gs-app-server", + "start": "concurrently -k \"npm run debug\" \"wait-on http://localhost:8080/kiri/ && nw .\"", + "build": "npm run build:clean && npm run build:nw", + "build:clean": "rimraf ./dist", + "build:nw": "build --concurrent --tasks win-x64,linux-x86,linux-x64,mac-x64 --mirror https://dl.nwjs.io/ .", + "build:win": "npm run build:win:clean && build --tasks win-x64 --mirror https://dl.nwjs.io/ .", + "build:lin": "npm run build:lin:clean && build --tasks linux-x64 --mirror https://dl.nwjs.io/ .", + "build:win:clean": "rimraf ./dist/grid-apps-3.0.15D-win-x64 ./dist/grid-apps-3.0.15D-win-x86.zip ./dist/grid-apps-3.0.15D-win-x86.7z ./dist/grid-apps-3.0.15D-win-x86-Setup.exe", + "build:lin:clean": "rimraf ./dist/grid-apps-3.0.15D-linux-x64 ./dist/grid-apps-3.0.15D-linux-x64.zip", + "run:win": "dist\\grid-apps-3.0.15D-win-x86\\grid-apps.exe", + "run:lin": "./dist/grid-apps-3.0.15D-linux-x64/grid-apps", + "nw": "nw ." + }, + "build": { + "nwVersion": "v0.54.0", + "nwFlavor": "normal", + "targets": [ + "zip" + ], + "files": [ + "**/*" + ], + "excludes": [ + "src/**", + "logs/**", + "apps/grid/apps/**", + "apps/grid/node_modules/nwjs-builder-phoenix/caches/**", + "apps/grid/dist/**", + "apps/grid/logs/**", + "apps/grid/node_modules/**", + "web/**" + ], + "strippedProperties": [ + "ManifestComments", + "scripts", + "devDependencies", + "build" + ], + "overriddenProperties": { + "main": "http://localhost:19757/kiri/", + "node-remote": "http://localhost:19757/kiri/", + "node-main": "./server.js", + "window": { + "width": 960, + "height": 700, + "min_width": 700, + "min_height": 500, + "icon": "web/meta/favicon-mobile.png" + }, + "win": { + "icon": "web/meta/favicon.ico" + }, + "mac": { + "icon": "web/meta/favicon-mobile.png" + }, + "nsis": { + "icon": "web/meta/favicon.ico", + "unIcon": "web/meta/favicon.ico", + "languages": [ + "English" + ], + "diffUpdaters": false, + "hashCalculation": true + } + } } } diff --git a/server.js b/server.js new file mode 100644 index 000000000..3aa78d151 --- /dev/null +++ b/server.js @@ -0,0 +1,5 @@ +#!/usr/bin/env node + +// use some high port, so it doesn't collide with other services +// debug was needed to actually run the app +require('@gridspace/app-server/app-server.js')({'port': 19757, 'debug': true});