Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f022cdde4 | |||
| b235b7994f | |||
| b4c173759c | |||
| b8fcde6a0d | |||
| d85a4f556f | |||
| 57ca98a652 | |||
| afd81b1dfb | |||
| b9ccb55bf9 | |||
| 98dca413e6 | |||
| 90868221b5 | |||
| 327bf355fc | |||
| b999578e21 |
26
.github/workflows/electron-sandbox.yml
vendored
26
.github/workflows/electron-sandbox.yml
vendored
@@ -1,6 +1,9 @@
|
|||||||
name: Sandbox Clinic Desktop
|
name: Sandbox Clinic System
|
||||||
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -19,21 +22,24 @@ jobs:
|
|||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
- name: Use Node.js 10.x
|
- name: Use Node.js 16.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 16.x
|
||||||
- name: yarn install
|
- name: yarn install
|
||||||
run: |
|
run: |
|
||||||
yarn install
|
yarn install
|
||||||
- name: Publish
|
- name: Publish
|
||||||
run: |
|
run: |
|
||||||
yarn run dist
|
node build.js clinic && yarn dist
|
||||||
# - name: Cleanup artifacts Linux and macOS
|
node build.js dr && yarn dist
|
||||||
# if: matrix.os != 'windows-latest'
|
node build.js em && yarn dist
|
||||||
# run: |
|
node build.js kesor && yarn dist
|
||||||
# mkdir artifacts
|
- name: Cleanup artifacts Linux and macOS
|
||||||
# cp -R dist/{*.deb,*.dmg,*.AppImage} artifacts || true
|
if: matrix.os != 'windows-latest'
|
||||||
|
run: |
|
||||||
|
mkdir artifacts
|
||||||
|
cp -R dist/{*.deb,*.dmg,*.AppImage} artifacts || true
|
||||||
- name: Cleanup artifacts Windowns
|
- name: Cleanup artifacts Windowns
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@ node_modules
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
dist
|
dist
|
||||||
|
electron-builder.env
|
||||||
|
lib.js
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# CUBETIQ Clinic Application
|
# CUBETIQ Clinic System Management
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
BIN
assets/images/icon.ico
Normal file
BIN
assets/images/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/images/icon.png
Normal file
BIN
assets/images/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
62
build.js
Normal file
62
build.js
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const argProfile = process.argv.slice(2);
|
||||||
|
// const { exec } = require('child_process');
|
||||||
|
|
||||||
|
if (argProfile.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
argProfile.forEach((profile) => {
|
||||||
|
const profileEnv = `./profile/${profile}.dev`;
|
||||||
|
const profileJs = `./profile/${profile}.js`;
|
||||||
|
|
||||||
|
console.log("Generating for electron-builder.env");
|
||||||
|
fs.readFile(profileEnv, "utf8", (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
fs.writeFile("./electron-builder.env", data, "utf8", (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("file saved");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Generating for lib.js");
|
||||||
|
fs.readFile(profileJs, "utf8", (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
fs.writeFile("./lib.js", data, "utf8", (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("file saved");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log("Building for " + profile + "...!");
|
||||||
|
// exec('yarn dist', (err, stdout, stderr) => {
|
||||||
|
// if (err) {
|
||||||
|
// console.log(err);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// console.log(`stdout: ${stdout}`);
|
||||||
|
// console.log(`stderr: ${stderr}`);
|
||||||
|
// });
|
||||||
|
|
||||||
|
});
|
||||||
11
build.sh
Executable file
11
build.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
BUILD_PROFILE=${1:-clinic}
|
||||||
|
echo "Build for profile ${BUILD_PROFILE}"
|
||||||
|
|
||||||
|
cat profile/${BUILD_PROFILE}.js > lib.js
|
||||||
|
cat profile/${BUILD_PROFILE}.dev > electron-builder.env
|
||||||
|
|
||||||
|
echo "Verify lib.js and electron-builder.env"
|
||||||
|
cat lib.js
|
||||||
|
cat electron-builder.env
|
||||||
|
|
||||||
|
yarn dist
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
"productName": "Clinic-Dev",
|
"productName": "Clinic-Dev",
|
||||||
"appId": "com.cubetiqs.clinic",
|
"appId": "com.cubetiqs.clinic",
|
||||||
"mac": {
|
"mac": {
|
||||||
"category": "com.cubetiqs.pro.clinic"
|
"category": "com.cubetiqs.clinic"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"category": "com.cubetiqs.pro.clinic",
|
"category": "com.cubetiqs.clinic",
|
||||||
"target": ["AppImage", "deb"]
|
"target": ["AppImage", "deb"]
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
"productName": "Clinic-Sandbox",
|
"productName": "Clinic-Sandbox",
|
||||||
"appId": "com.cubetiqs.clinic",
|
"appId": "com.cubetiqs.clinic",
|
||||||
"mac": {
|
"mac": {
|
||||||
"category": "com.cubetiqs.pro.clinic"
|
"category": "com.cubetiqs.clinic"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"category": "com.cubetiqs.pro.clinic",
|
"category": "com.cubetiqs.clinic",
|
||||||
"target": ["AppImage", "deb"]
|
"target": ["AppImage", "deb"]
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
DR_URL=https://clinic-dev.cubetiqs.com?platform=desktop
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DR_URL=https://clinic.cubetiqs.com?platform=desktop
|
|
||||||
42
electron-builder.yaml
Normal file
42
electron-builder.yaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
appId: "github.com/cubetiq/sandbox-clinic"
|
||||||
|
artifactName: ${name}-${version}-${os}-${arch}-${env.ARTIFACT_NAME_POSTFIX}.${ext}
|
||||||
|
productName: "Sandbox Clinic"
|
||||||
|
publish: { provider: github, releaseType: draft, vPrefixedTagName: true }
|
||||||
|
forceCodeSigning: false
|
||||||
|
compression: normal
|
||||||
|
npmRebuild: false
|
||||||
|
asar: true
|
||||||
|
|
||||||
|
directories:
|
||||||
|
output: ./dist
|
||||||
|
buildResources: build
|
||||||
|
app: .
|
||||||
|
|
||||||
|
mac:
|
||||||
|
category: public.app-category.productivity
|
||||||
|
darkModeSupport: true
|
||||||
|
target:
|
||||||
|
- { target: dmg }
|
||||||
|
|
||||||
|
dmg:
|
||||||
|
contents:
|
||||||
|
- { x: 380, y: 240, type: link, path: /Applications }
|
||||||
|
- { x: 122, y: 240, type: file }
|
||||||
|
|
||||||
|
linux:
|
||||||
|
category: Productivity
|
||||||
|
packageCategory: Productivity
|
||||||
|
executableArgs:
|
||||||
|
- '--js-flags="--max-old-space-size=12288"'
|
||||||
|
target:
|
||||||
|
- target: deb
|
||||||
|
- target: AppImage
|
||||||
|
|
||||||
|
win:
|
||||||
|
artifactName: ${name}-${version}-windows-${arch}-${env.ARTIFACT_NAME_POSTFIX}.${ext}
|
||||||
|
icon: ./assets/images/icon.ico
|
||||||
|
target:
|
||||||
|
- { target: nsis }
|
||||||
|
|
||||||
|
nsis:
|
||||||
|
artifactName: ${name}-${version}-nsis-${arch}-${env.ARTIFACT_NAME_POSTFIX}.${ext}
|
||||||
30
main.js
30
main.js
@@ -1,26 +1,34 @@
|
|||||||
const electron = require("electron");
|
const electron = require("electron");
|
||||||
const { app, BrowserWindow } = electron;
|
const { app, BrowserWindow } = electron;
|
||||||
|
const os = require("os");
|
||||||
|
const APP_URL = require("./lib");
|
||||||
|
|
||||||
const DR_URL = process.env.DR_URL || "https://clinic.cubetiqs.com?platform=desktop&offline=true&source=" + (process.env.USERNAME || "unknown");
|
const URL = APP_URL || "https://clinic.cubetiqs.com";
|
||||||
const DR_TITLE = "CUBETIQ CLINIC"
|
const MAIN_URL = `${URL}?platform=desktop&offline=true&os=${os.platform()}&hostname=${os.hostname()}&arch=${os.arch()}&source=${process.env.USERNAME || "unknown"}`
|
||||||
|
const APP_TITLE = "Clinic System";
|
||||||
|
|
||||||
let mainApp;
|
let mainApp;
|
||||||
app.allowRendererProcessReuse = true;
|
app.allowRendererProcessReuse = true;
|
||||||
app.on("ready", () => {
|
app.on("ready", () => {
|
||||||
|
|
||||||
mainApp = new BrowserWindow({
|
mainApp = new BrowserWindow({
|
||||||
width: 1000,
|
width: 1024,
|
||||||
height: 700
|
height: 768,
|
||||||
|
title: APP_TITLE,
|
||||||
});
|
});
|
||||||
|
|
||||||
mainApp.webContents.executeJavaScript(`localStorage.setItem("author", "Sambo Chea <sombochea@cubetiqs.com>")`)
|
mainApp.webContents.executeJavaScript(
|
||||||
mainApp.webContents.executeJavaScript(`localStorage.setItem("IS_ELECTRON", true)`)
|
`localStorage.setItem("author", "Sambo Chea <sombochea@cubetiqs.com>")`
|
||||||
|
);
|
||||||
|
|
||||||
mainApp.setFullScreen(true)
|
mainApp.webContents.executeJavaScript(
|
||||||
mainApp.setTitle(DR_TITLE);
|
`localStorage.setItem("IS_ELECTRON", true)`
|
||||||
|
);
|
||||||
|
|
||||||
console.log("Starting from:", DR_URL)
|
mainApp.setFullScreen(true);
|
||||||
mainApp.loadURL(DR_URL);
|
mainApp.setTitle(APP_TITLE);
|
||||||
|
|
||||||
|
console.log("Starting from:", MAIN_URL);
|
||||||
|
mainApp.loadURL(MAIN_URL);
|
||||||
|
|
||||||
mainApp.on("closed", () => {
|
mainApp.on("closed", () => {
|
||||||
mainApp = null;
|
mainApp = null;
|
||||||
|
|||||||
36
package.json
36
package.json
@@ -1,32 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "clinic",
|
"name": "sandbox-clinic",
|
||||||
"version": "1.0.0",
|
"version": "1.0.3",
|
||||||
"description": "Clinic Application",
|
"description": "CUBETIQ Clinic System Management",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"build": {
|
"icon": "./assets/images/icon.ico",
|
||||||
"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": {
|
"devDependencies": {
|
||||||
"cross-env": "^7.0.0",
|
"cross-env": "^7.0.0",
|
||||||
"electron": "^8.0.0",
|
"electron": "^9.4.0",
|
||||||
"electron-builder": "^22.3.2"
|
"electron-builder": "^22.11.7"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"start": "yarn && cross-env DR_URL=https://clinic.cubetiqs.com?platform=desktop electron ./main",
|
"start": "yarn && cross-env APP_URL=https://clinic.cubetiqs.com?platform=desktop electron ./main",
|
||||||
"pack": "electron-builder --dir",
|
"pack": "electron-builder --dir",
|
||||||
"dist": "electron-builder",
|
"dist": "electron-builder --publish never",
|
||||||
|
"build-icon": "electron-icon-builder --input=icon.png --output=dist/icons",
|
||||||
"builder-help": "electron-builder --help",
|
"builder-help": "electron-builder --help",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
@@ -45,5 +34,8 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/CUBETIQ/sandbox-clinic/issues"
|
"url": "https://github.com/CUBETIQ/sandbox-clinic/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/CUBETIQ/sandbox-clinic#readme"
|
"homepage": "https://github.com/CUBETIQ/sandbox-clinic#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"electron-icon-builder": "^2.0.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
profile/clinic.dev
Normal file
1
profile/clinic.dev
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ARTIFACT_NAME_POSTFIX=cubetiqclinic
|
||||||
3
profile/clinic.js
Normal file
3
profile/clinic.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
const APP_URL = 'https://clinic.cubetiqs.com';
|
||||||
|
|
||||||
|
module.exports = APP_URL;
|
||||||
1
profile/dr.dev
Normal file
1
profile/dr.dev
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ARTIFACT_NAME_POSTFIX=drclinic
|
||||||
3
profile/dr.js
Normal file
3
profile/dr.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
const APP_URL = 'https://app.drprofessionalglobal.com';
|
||||||
|
|
||||||
|
module.exports = APP_URL;
|
||||||
1
profile/em.dev
Normal file
1
profile/em.dev
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ARTIFACT_NAME_POSTFIX=emclinic
|
||||||
3
profile/em.js
Normal file
3
profile/em.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
const APP_URL = 'https://app.embeautyclinic.com';
|
||||||
|
|
||||||
|
module.exports = APP_URL;
|
||||||
1
profile/kesor.dev
Normal file
1
profile/kesor.dev
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ARTIFACT_NAME_POSTFIX=kesorclinic
|
||||||
3
profile/kesor.js
Normal file
3
profile/kesor.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
const APP_URL = 'https://claris.cubetiqs.com';
|
||||||
|
|
||||||
|
module.exports = APP_URL;
|
||||||
Reference in New Issue
Block a user