add and remove

This commit is contained in:
Sambo Chea 2020-02-13 19:30:58 +07:00
parent 3afe5705c0
commit 2d415933c5
10 changed files with 237 additions and 0 deletions

53
.github/workflows/electron-dev.yml vendored Normal file
View File

@ -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}}

53
.github/workflows/electron-sandbox.yml vendored Normal file
View File

@ -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}}

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
node_modules
package-lock.json
yarn.lock
dist

14
README.MD Normal file
View File

@ -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
```

View File

@ -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"
}
}

View File

@ -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"
}
}

1
electron-builder.dev.yml Normal file
View File

@ -0,0 +1 @@
DR_URL=http://clinic.cubetiq.online?platform=desktop

View File

@ -0,0 +1 @@
DR_URL=http://sandbox.clinic.cubetiq.online?platform=desktop

28
main.js Normal file
View File

@ -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 <sombochea@cubetiqs.com>")`)
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;
});
});

49
package.json Normal file
View File

@ -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"
}