fix: process is not defined

This commit is contained in:
kangfenmao 2024-07-16 20:18:30 +08:00
parent e962351b13
commit 7aa6d6ebeb
3 changed files with 33 additions and 22 deletions

View File

@ -6,9 +6,14 @@ exports.default = async function notarizing(context) {
return
}
if (!process.env.APPLE_ID || !process.env.APPLE_APP_SPECIFIC_PASSWORD || !process.env.APPLE_TEAM_ID) {
console.log('Skipping notarization')
return
}
const appName = context.packager.appInfo.productFilename
const notarized = await notarize({
await notarize({
appPath: `${context.appOutDir}/${appName}.app`,
appBundleId: 'com.kangfenmao.CherryStudio',
appleId: process.env.APPLE_ID,
@ -16,7 +21,5 @@ exports.default = async function notarizing(context) {
teamId: process.env.APPLE_TEAM_ID
})
console.log('Notarized:', notarized)
return notarized
console.log('Notarized app:', appName)
}

View File

@ -1,13 +1,10 @@
import localforage from 'localforage'
import KeyvStorage from '@kangfenmao/keyv-storage'
import * as Sentry from '@sentry/electron/renderer'
import { isProduction } from './utils'
function initSentry() {
// Disable sentry in development mode
if (process?.env?.NODE_ENV === 'development') {
return
}
async function initSentry() {
if (await isProduction()) {
Sentry.init({
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
@ -21,6 +18,7 @@ function initSentry() {
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0
})
}
}
function init() {

View File

@ -98,3 +98,13 @@ export const firstLetter = (str?: string) => {
export function isFreeModel(model: Model) {
return (model.id + model.name).toLocaleLowerCase().includes('free')
}
export async function isProduction() {
const { isPackaged } = await window.api.getAppInfo()
return isPackaged
}
export async function isDev() {
const isProd = await isProduction()
return !isProd
}