diff --git a/.github/workflows/electron-dev.yml b/.github/workflows/electron-dev.yml new file mode 100644 index 0000000..34cd3cf --- /dev/null +++ b/.github/workflows/electron-dev.yml @@ -0,0 +1,53 @@ +name: Sandbox Clinic Desktop For Dev + +on: [push] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - name: Starting Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Checkout Git Repository + uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js 10.x + uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: yarn install + run: | + yarn install + - name: Publish + run: | + yarn run dist + - name: Cleanup artifacts Linux and macOS + if: matrix.os != 'windows-latest' + run: | + mkdir artifacts + cp -R dist/dev/* artifacts + - name: Cleanup artifacts Windowns + if: matrix.os == 'windows-latest' + run: | + mkdir artifacts + mv dist/dev/*.exe artifacts + - name: Upload artifacts + uses: actions/upload-artifact@v1 + with: + name: ${{matrix.os}} + path: artifacts + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + files: "artifacts/**" + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/electron-sandbox.yml b/.github/workflows/electron-sandbox.yml new file mode 100644 index 0000000..0595ebe --- /dev/null +++ b/.github/workflows/electron-sandbox.yml @@ -0,0 +1,53 @@ +name: Sandbox Clinic Desktop + +on: [push] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - name: Starting Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Checkout Git Repository + uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js 10.x + uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: yarn install + run: | + yarn install + - name: Publish + run: | + yarn run sandbox + - name: Cleanup artifacts Linux and macOS + if: matrix.os != 'windows-latest' + run: | + mkdir artifacts + cp -R dist/sandbox/* artifacts + - name: Cleanup artifacts Windowns + if: matrix.os == 'windows-latest' + run: | + mkdir artifacts + mv dist/sandbox/*.exe artifacts + - name: Upload artifacts + uses: actions/upload-artifact@v1 + with: + name: ${{matrix.os}} + path: artifacts + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + files: "artifacts/**" + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6047073 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +package-lock.json +yarn.lock +dist \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..957d48c --- /dev/null +++ b/README.MD @@ -0,0 +1,14 @@ +# CUBETIQ Clinic Application + +![Sandbox Clinic Desktop](https://github.com/CUBETIQ/sandbox-clinic/workflows/Sandbox%20Clinic%20Desktop/badge.svg) + +#### Run Dev Application +```sh +npm start +``` + +#### Run Product Application +```sh +npm run dist +``` + diff --git a/config/electron-builder-dev.json b/config/electron-builder-dev.json new file mode 100644 index 0000000..2d68f4e --- /dev/null +++ b/config/electron-builder-dev.json @@ -0,0 +1,17 @@ +{ + "productName": "Clinic-Dev", + "appId": "com.cubetiqs.clinic", + "mac": { + "category": "com.cubetiqs.pro.clinic" + }, + "linux": { + "category": "com.cubetiqs.pro.clinic", + "target": ["AppImage", "deb"] + }, + "win": { + "target": "nsis" + }, + "directories": { + "output": "./dist/dev" + } +} diff --git a/config/electron-builder-sandbox.json b/config/electron-builder-sandbox.json new file mode 100644 index 0000000..a4917e0 --- /dev/null +++ b/config/electron-builder-sandbox.json @@ -0,0 +1,17 @@ +{ + "productName": "Clinic-Sandbox", + "appId": "com.cubetiqs.clinic", + "mac": { + "category": "com.cubetiqs.pro.clinic" + }, + "linux": { + "category": "com.cubetiqs.pro.clinic", + "target": ["AppImage", "deb"] + }, + "win": { + "target": "nsis" + }, + "directories": { + "output": "./dist/sandbox" + } +} diff --git a/electron-builder.dev.yml b/electron-builder.dev.yml new file mode 100644 index 0000000..29c85db --- /dev/null +++ b/electron-builder.dev.yml @@ -0,0 +1 @@ +DR_URL=http://clinic.cubetiq.online?platform=desktop \ No newline at end of file diff --git a/electron-builder.prod.yml b/electron-builder.prod.yml new file mode 100644 index 0000000..e89ccd1 --- /dev/null +++ b/electron-builder.prod.yml @@ -0,0 +1 @@ +DR_URL=http://sandbox.clinic.cubetiq.online?platform=desktop \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..0669433 --- /dev/null +++ b/main.js @@ -0,0 +1,28 @@ +const electron = require("electron"); +const { app, BrowserWindow } = electron; + +const DR_URL = process.env.DR_URL || "http://sandbox.clinic.cubetiq.online?platform=desktop&offline=true&source=" + (process.env.USERNAME || "unknown"); +const DR_TITLE = "DR PROFESSIONAL CLINIC" + +let mainApp; +app.allowRendererProcessReuse = true; +app.on("ready", () => { + + mainApp = new BrowserWindow({ + width: 1000, + height: 700 + }); + + mainApp.webContents.executeJavaScript(`localStorage.setItem("author", "Sambo Chea ")`) + mainApp.webContents.executeJavaScript(`localStorage.setItem("IS_ELECTRON", true)`) + + mainApp.setFullScreen(true) + mainApp.setTitle(DR_TITLE); + + console.log("Starting from:", DR_URL) + mainApp.loadURL(DR_URL); + + mainApp.on("closed", () => { + mainApp = null; + }); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..725423e --- /dev/null +++ b/package.json @@ -0,0 +1,49 @@ +{ + "name": "clinic", + "version": "1.0.0", + "description": "Clinic Application", + "main": "main.js", + "build": { + "productName": "Clinic-Sandbox", + "appId": "com.cubetiqs.clinic", + "mac": { + "category": "com.cubetiqs.pro.clinic" + }, + "linux": { + "category": "com.cubetiqs.pro.clinic", + "target": ["AppImage", "deb"] + }, + "win": { + "target": "nsis" + } + }, + "devDependencies": { + "cross-env": "^7.0.0", + "electron": "^8.0.0", + "electron-builder": "^22.3.2" + }, + "scripts": { + "postinstall": "electron-builder install-app-deps", + "start": "yarn && cross-env DR_URL=http://clinic.cubetiq.online?platform=desktop electron ./main", + "pack": "electron-builder --dir", + "dist": "electron-builder", + "builder-help": "electron-builder --help", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/CUBETIQ/sandbox-clinic.git" + }, + "keywords": [ + "clinic" + ], + "author": { + "name": "Sambo Chea", + "email": "sombochea@cubetiqs.com" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/CUBETIQ/sandbox-clinic/issues" + }, + "homepage": "https://github.com/CUBETIQ/sandbox-clinic#readme" +}