From b8fcde6a0d0551eb878d8fa090430a398875b4fc Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Mon, 9 Aug 2021 11:42:07 +0700 Subject: [PATCH] Task: Add electron build profiles and changed from build in package.json tp electron-build.yaml with multiple profiles in sandbox clinic --- build.sh | 6 +++-- builder-config.yaml | 0 electron-builder.yaml | 42 +++++++++++++++++++++++++++++++ main.js | 1 - package.json | 19 +------------- profile/clinic.dev | 1 + profile/{clinic.env => clinic.js} | 0 profile/dr.dev | 1 + profile/{dr.env => dr.js} | 0 profile/em.dev | 1 + profile/{em.env => em.js} | 0 profile/kesor.dev | 1 + profile/{kesor.env => kesor.js} | 0 13 files changed, 51 insertions(+), 21 deletions(-) delete mode 100644 builder-config.yaml create mode 100644 electron-builder.yaml create mode 100644 profile/clinic.dev rename profile/{clinic.env => clinic.js} (100%) create mode 100644 profile/dr.dev rename profile/{dr.env => dr.js} (100%) create mode 100644 profile/em.dev rename profile/{em.env => em.js} (100%) create mode 100644 profile/kesor.dev rename profile/{kesor.env => kesor.js} (100%) diff --git a/build.sh b/build.sh index 0625ca9..cea9546 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,11 @@ BUILD_PROFILE=${1:-clinic} echo "Build for profile ${BUILD_PROFILE}" -cat profile/${BUILD_PROFILE}.env > lib.js +cat profile/${BUILD_PROFILE}.js > lib.js +cat profile/${BUILD_PROFILE}.dev > electron-builder.env -echo "Verify lib.js" +echo "Verify lib.js and electron-builder.env" cat lib.js +cat electron-builder.env yarn dist \ No newline at end of file diff --git a/builder-config.yaml b/builder-config.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/electron-builder.yaml b/electron-builder.yaml new file mode 100644 index 0000000..316f7ff --- /dev/null +++ b/electron-builder.yaml @@ -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}.${ext} + icon: ./assets/images/icon.ico + target: + - { target: nsis } + +nsis: + artifactName: ${name}-${version}-${arch}.${ext} diff --git a/main.js b/main.js index 5b86db3..c83b93b 100644 --- a/main.js +++ b/main.js @@ -13,7 +13,6 @@ app.on("ready", () => { mainApp = new BrowserWindow({ width: 1024, height: 768, - icon: "./assets/images/icon.png", title: APP_TITLE, }); diff --git a/package.json b/package.json index c63a61e..aee1b78 100644 --- a/package.json +++ b/package.json @@ -4,24 +4,7 @@ "description": "CUBETIQ Clinic System Management", "main": "main.js", "icon": "./assets/images/icon.ico", - "build": { - "productName": "Sandbox-Clinic", - "appId": "com.cubetiqs.clinic", - "mac": { - "category": "com.cubetiqs.clinic" - }, - "linux": { - "category": "com.cubetiqs.clinic", - "target": [ - "AppImage", - "deb" - ] - }, - "win": { - "target": "nsis", - "icon": "./assets/images/icon.ico" - } - }, + "devDependencies": { "cross-env": "^7.0.0", "electron": "^9.4.0", diff --git a/profile/clinic.dev b/profile/clinic.dev new file mode 100644 index 0000000..aaa8452 --- /dev/null +++ b/profile/clinic.dev @@ -0,0 +1 @@ +ARTIFACT_NAME_POSTFIX=cubetiqclinic \ No newline at end of file diff --git a/profile/clinic.env b/profile/clinic.js similarity index 100% rename from profile/clinic.env rename to profile/clinic.js diff --git a/profile/dr.dev b/profile/dr.dev new file mode 100644 index 0000000..34cb8ee --- /dev/null +++ b/profile/dr.dev @@ -0,0 +1 @@ +ARTIFACT_NAME_POSTFIX=drclinic \ No newline at end of file diff --git a/profile/dr.env b/profile/dr.js similarity index 100% rename from profile/dr.env rename to profile/dr.js diff --git a/profile/em.dev b/profile/em.dev new file mode 100644 index 0000000..664aec6 --- /dev/null +++ b/profile/em.dev @@ -0,0 +1 @@ +ARTIFACT_NAME_POSTFIX=emclinic \ No newline at end of file diff --git a/profile/em.env b/profile/em.js similarity index 100% rename from profile/em.env rename to profile/em.js diff --git a/profile/kesor.dev b/profile/kesor.dev new file mode 100644 index 0000000..f003ce4 --- /dev/null +++ b/profile/kesor.dev @@ -0,0 +1 @@ +ARTIFACT_NAME_POSTFIX=kesorclinic \ No newline at end of file diff --git a/profile/kesor.env b/profile/kesor.js similarity index 100% rename from profile/kesor.env rename to profile/kesor.js