]> Repos - mime-chat/commitdiff
testing
authorriqo <hernandeze2@xavier.edu>
Tue, 13 Apr 2021 12:28:12 +0000 (07:28 -0500)
committerriqo <hernandeze2@xavier.edu>
Tue, 13 Apr 2021 12:28:12 +0000 (07:28 -0500)
.gitlab-ci.yml
electron.builder.yml [new file with mode: 0644]
package.json
src/App.vue
src/background/init.ts
src/background/window.ts

index ef8a58264b56ecb29e27881d10beb0fd43a09443..0de552ed8c4392ec4a36b5528bcaa02a1d414095 100644 (file)
@@ -11,5 +11,4 @@ build:
         paths:
             - $CI_PROJECT_DIR/dist/*.*
         script:
-            - sed "s/0.0.0/${VERSION_ID}/g" package.json > _package.json && mv _package.json package.json
-            - yarn && yarn electron:build
+            - yarn dist
diff --git a/electron.builder.yml b/electron.builder.yml
new file mode 100644 (file)
index 0000000..2590695
--- /dev/null
@@ -0,0 +1,51 @@
+electronVersion: 9.0.0
+compression: normal
+npmRebuild: false
+# TODO: enable this in the future once we sign all the linux builds.
+#forceCodeSigning: true
+directories:
+  output: dist
+  buildResources: build
+  app: .
+
+mac:
+  category: Reference
+  icon: ./icons/icon.icns
+  target:
+    - target: dmg
+    - target: zip
+
+  # steps for notarizing the MacOS builds:
+  # https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
+
+  hardenedRuntime: true
+  gatekeeperAssess: false
+  entitlements: build/macos/entitlements.mac.plist
+  entitlementsInherit: build/macos/entitlements.mac.plist
+
+dmg:
+  # The inner app inside the .dmg is signed and there is some broken logic
+  # which requires that the DMG itself is not signed.
+  sign: false
+
+
+nsis:
+  artifactName: ${name}-${version}-${arch}.${ext}
+
+appx:
+  artifactName: ${name}-${version}-${arch}.${ext}
+  applicationId: polar
+  identityName: 25130KevinBurton.PolarBookshelf
+  publisher: CN=D3591277-F57D-4C75-B342-D158E6C4AAF5
+  publisherDisplayName: Kevin Burton
+
+
+# https://www.electron.build/configuration/publish
+# https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
+publish:
+  provider: github
+  publishAutoUpdate: true
+
+asar: true
+afterPack: "./electron-builder-afterpack.js"
+afterSign: "./build/macos/notarize.js"
index 7117a2c74ff83d649fb435a7d99acae9bb9cbec7..587010a328929b5ee7245ed8b296bb9992a3a141 100644 (file)
@@ -7,7 +7,7 @@
   "author": {
     "name": "Enrique Hernandez"
   },
-  "main": "background.js",
+  "main": "./src/background.ts",
   "scripts": {
     "dev": "yarn electron:serve",
     "serve": "vue-cli-service serve",
@@ -17,7 +17,8 @@
     "electron:build": "vue-cli-service electron:build",
     "electron:serve": "vue-cli-service electron:serve",
     "postinstall": "electron-builder install-app-deps",
-    "postuninstal": "electron-builder install-app-deps"
+    "postuninstal": "electron-builder install-app-deps",
+    "dist":"electron-builder --publish always"
   },
   "dependencies": {
     "@google-cloud/speech": "^4.2.0",
index a8247ea8f54105c7f0828fcdee07e0350e528a9e..320b62f88aa83aca9f6ad41690a534386e7a0df5 100644 (file)
@@ -6,19 +6,19 @@
 
     <!-- Minimize and exit buttons. -->
     <span class="menu">
-      <button 
-        class="menuButton exitButton" 
-        @click.prevent="post('nav-bar', 'close')" 
+      <button
+        class="menuButton exitButton"
+        @click.prevent="post('nav-bar', 'close')"
       />
-      <button 
-        class="menuButton minimizeButton" 
-        @click.prevent="post('nav-bar', 'min')" 
+      <button
+        class="menuButton minimizeButton"
+        @click.prevent="post('nav-bar', 'min')"
       />
     </span>
 
     <!-- Main Pages -->
-    <Messenger 
-      v-if="profile" 
+    <Messenger
+      v-if="profile"
       :profile="profile"
       :newMessages="newMessages"
     />
@@ -28,7 +28,7 @@
 
   <!-- Show spash screen if ready is false -->
   <Splash v-else />
-  
+
 </template>
 
 <script lang="ts">
@@ -41,7 +41,7 @@ import Messenger from "@/components/messenger.vue";
 import Login from "@/components/login.vue";
 
 export default defineComponent({
-  components: { 
+  components: {
     Splash,
     Messenger,
     Login
@@ -82,6 +82,13 @@ export default defineComponent({
     onMounted(() => {
       console.log("APP:mounted.")
       window.ipcRenderer.on("update-state", updateState)
+      window.ipcRenderer.on("update_available", () => {
+          console.log('testing auto update');
+      })
+
+      window.ipcRenderer.on("update_downloaded", () => {
+          console.log('testing update download');
+      })
       post("app-mounted", "")
     });
 
index f9c8e86d208ced9f05507d8d79adfabdec10e78c..52e184a2e5923d9937ece7e5345301aa970ea36b 100644 (file)
@@ -4,8 +4,9 @@
 import { app } from "electron";
 import { createWindow } from './window';
 import { initSession } from './session';
-import { initAudioIO, stopStream } from './audio';
+import { initAudioIO } from './audio';
 import { backgroundMitt } from '@/modules/emitter';
+const { autoUpdater } = require('electron-updater');
 
 let win: boolean;
 
index b344e80861747ffb50824d81435d9e79ab05a1e5..e3125721eb5c6275e453a90a02d4ebf3b9ebf890 100644 (file)
@@ -6,6 +6,7 @@ import { backgroundMitt } from '@/modules/emitter';
 import { RenderMessage, WindowState } from "@/types";
 import { loadWinState, saveToJson } from "./helpers";
 import * as path from "path";
+const { autoUpdater } = require('electron-updater');
 
 interface IpcRendererPayload {
   endpoint: string;
@@ -64,7 +65,7 @@ const onWindowMount = (): void => {
     // Handle win nav-bar event.
     ipcMain.removeAllListeners("nav-bar") // avoid setting duplicate handlers
     ipcMain.on("nav-bar", onNavBar);
-    
+
     // Gateway for messages to the frontend.
     backgroundMitt.removeAllListeners("ipc-renderer")
     backgroundMitt.on("ipc-renderer", renderMessage);
@@ -109,7 +110,7 @@ export async function createWindow(): Promise<void> {
     // Load the URL.
     if (process.env.WEBPACK_DEV_SERVER_URL) {
       win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string); // dev
-    } 
+    }
 
     else {
       createProtocol("app");
@@ -124,6 +125,7 @@ export async function createWindow(): Promise<void> {
     win.on("resize", saveWindowState);
 
     win.once('ready-to-show', () => {
+    autoUpdater.checkForUpdatesAndNotify();
       if (win) win.show()
     })
 
@@ -139,3 +141,11 @@ export async function createWindow(): Promise<void> {
 
   });
 }
+
+autoUpdater.on('update-available', () => {
+  if (win) win.webContents.send('update_available');
+});
+
+autoUpdater.on('update-downloaded', () => {
+  if (win) win.webContents.send('update_downloaded');
+});