File tree Expand file tree Collapse file tree
src/main/services/analytics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,30 +3,39 @@ import type { Configuration } from 'electron-builder'
33import path from 'path'
44
55const isSponsored = process . env . VITE_SPONSORED === 'true'
6+ const isTestBuild = process . env . TEST_BUILD === 'true'
7+ const testMacArch = process . env . TEST_MAC_ARCH
68
79const artifactName = isSponsored
810 ? '${productName}-${version}-${arch}-sponsored.${ext}'
911 : undefined
1012
13+ const macTarget = [
14+ { target : 'dmg' , arch : 'arm64' } ,
15+ { target : 'dmg' , arch : 'x64' }
16+ ]
17+
18+ if ( isTestBuild ) {
19+ if ( testMacArch === 'arm64' ) macTarget . pop ( )
20+ if ( testMacArch === 'x64' ) macTarget . shift ( )
21+ }
22+
1123export default {
1224 appId : 'io.masscode.app' ,
1325 artifactName,
1426 productName : 'massCode' ,
1527 directories : {
1628 output : path . resolve ( __dirname , '../../dist' )
1729 } ,
18- afterSign : 'build/scripts/notarize.js' ,
30+ afterSign : ! isTestBuild ? 'build/scripts/notarize.js' : undefined ,
1931 nsis : {
2032 oneClick : false ,
2133 perMachine : false ,
2234 allowToChangeInstallationDirectory : true ,
2335 shortcutName : 'massCode'
2436 } ,
2537 mac : {
26- target : [
27- { target : 'dmg' , arch : 'arm64' } ,
28- { target : 'dmg' , arch : 'x64' }
29- ] ,
38+ target : macTarget ,
3039 icon : 'config/icons/icon.icns' ,
3140 category : 'public.app-category.productivity' ,
3241 hardenedRuntime : true ,
Original file line number Diff line number Diff line change 1111 "dev:server" : " node build/scripts/dev-server.js" ,
1212 "dev:vue-devtools" : " vue-devtools" ,
1313 "build" : " npm run ts-check:vue && npm run copy:plist && npm run build:ts && node build/scripts/build.js " ,
14+ "build:test" : " TEST_BUILD=true TEST_MAC_ARCH=arm64 npm run build" ,
1415 "build:ts" : " tsc -p tsconfig.electron.json" ,
1516 "ts-check:vue" : " vue-tsc --noEmit --skipLibCheck" ,
1617 "lint" : " eslint --ext .js,.ts,.vue . src" ,
Original file line number Diff line number Diff line change @@ -2,18 +2,22 @@ import buildVue from './build-vue'
22import buildElectron from './build-electron'
33import chalk from 'chalk'
44
5+ const isTestBuild = process . env . TEST_BUILD === 'true'
6+
57process . env . NODE_ENV = 'production'
68
9+ const buildType = isTestBuild ? 'Test' : 'Production'
10+
711async function build ( ) {
812 console . log ( )
9- console . log ( `${ chalk . blueBright ( 'Build started...' ) } ` )
13+ console . log ( `${ chalk . blueBright ( ` ${ buildType } build started...` ) } ` )
1014 console . log ( )
1115
1216 await buildVue ( )
1317 await buildElectron ( )
1418
1519 console . log ( )
16- console . log ( `${ chalk . greenBright ( 'Build success!' ) } ` )
20+ console . log ( `${ chalk . greenBright ( ` ${ buildType } build success!` ) } ` )
1721 console . log ( )
1822}
1923
Original file line number Diff line number Diff line change 1- import 'dotenv/config'
21import type { TrackEvents } from '@shared/types/main/analytics'
32import ua from 'universal-analytics'
43import { version } from '../../../../package.json'
You can’t perform that action at this time.
0 commit comments