From f5a024b01ea3f9acfb9d38e9e08424f11991f38f Mon Sep 17 00:00:00 2001 From: Olivier Savignac Date: Sun, 23 Jun 2024 17:58:58 -0400 Subject: [PATCH] fix: text more hooks --- .github/workflows/build.yml | 8 +++---- quasar.config.js | 45 ++++++++++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d847acc..32f513a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,12 +45,12 @@ jobs: GITHUB_TOKEN: ${{ github.token }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - - run: yarn install && yarn global add @sentry/cli - name: Install Sentry CLI + # - run: yarn install && yarn global add @sentry/cli + # name: Install Sentry CLI # TODO: Eventually switch over to Debug IDs instead of Source Maps by hooking into the Electron build before it's published # - run: yarn sentry-cli sourcemaps inject ./dist/electron/UnPackaged/assets # name: Inject Debug IDs into Artifacts - - run: yarn sentry-cli --auth-token ${{ secrets.SENTRY_AUTH_TOKEN }} sourcemaps upload --org 'jw-projects' --project 'mmm-v2' --release ${{ steps.package-version.outputs.version}} . - name: Upload Source Maps to Sentry + # - run: yarn sentry-cli --auth-token ${{ secrets.SENTRY_AUTH_TOKEN }} sourcemaps upload --org 'jw-projects' --project 'mmm-v2' --release ${{ steps.package-version.outputs.version}} . + # name: Upload Source Maps to Sentry diff --git a/quasar.config.js b/quasar.config.js index b6221490..3b416ed7 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -9,10 +9,14 @@ // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js // const { sentryVitePlugin } = require('@sentry/vite-plugin'); const { sentryEsbuildPlugin } = require('@sentry/esbuild-plugin'); +// use mergeConfig helper to avoid overwriting the default config +const { mergeConfig } = require('vite'); const { configure } = require('quasar/wrappers'); const path = require('path'); // const inject = require('@rollup/plugin-inject') +import { version } from 'package.json'; + module.exports = configure(function (/* ctx */) { return { @@ -42,15 +46,30 @@ module.exports = configure(function (/* ctx */) { chain.plugin('node-polyfill').use(nodePolyfillWebpackPlugin); }, extendViteConf(viteConf) { - if (!viteConf.optimizeDeps) viteConf.optimizeDeps = {}; + // if (!viteConf.optimizeDeps) viteConf.optimizeDeps = {}; // if (!viteConf.optimizeDeps.exclude) viteConf.optimizeDeps.exclude = [ // 'pdfjs-dist', // ]; - if (!viteConf.optimizeDeps.esbuildOptions) - viteConf.optimizeDeps.esbuildOptions = {}; - if (!viteConf.optimizeDeps.esbuildOptions.define) - viteConf.optimizeDeps.esbuildOptions.define = {}; - viteConf.optimizeDeps.esbuildOptions.define.global = 'window'; + viteConf.optimizeDeps = mergeConfig(viteConf, { + esbuildOptions: { + define: { + global: 'window', + }, + }, + }); + viteConf.plugins = mergeConfig(viteConf.plugins, [ + sentryEsbuildPlugin({ + authToken: process.env.SENTRY_AUTH_TOKEN, + org: 'jw-projects', + project: 'mmm-v2', + release: version, + }), + ]); + // if (!viteConf.optimizeDeps.esbuildOptions) + // viteConf.optimizeDeps.esbuildOptions = {}; + // if (!viteConf.optimizeDeps.esbuildOptions.define) + // viteConf.optimizeDeps.esbuildOptions.define = {}; + // viteConf.optimizeDeps.esbuildOptions.define.global = 'window'; // if (!viteConf.build) viteConf.build = {}; // viteConf.build.sourcemap = true; // if (!viteConf.build.plugins) viteConf.build.plugins = []; @@ -189,6 +208,20 @@ module.exports = configure(function (/* ctx */) { authToken: process.env.SENTRY_AUTH_TOKEN, org: 'jw-projects', project: 'mmm-v2', + release: version, + }), + ); + }, + + extendElectronPreloadConf: (esbuildConf) => { + esbuildConf.sourcemap = true; + if (!esbuildConf.plugins) esbuildConf.plugins = []; + esbuildConf.plugins.push( + sentryEsbuildPlugin({ + authToken: process.env.SENTRY_AUTH_TOKEN, + org: 'jw-projects', + project: 'mmm-v2', + release: version, }), ); },