Skip to content

Commit 5cc3dfa

Browse files
committed
chore(build): add test build
1 parent f9fab1d commit 5cc3dfa

4 files changed

Lines changed: 21 additions & 8 deletions

File tree

config/electron-builder.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,39 @@ import type { Configuration } from 'electron-builder'
33
import path from 'path'
44

55
const isSponsored = process.env.VITE_SPONSORED === 'true'
6+
const isTestBuild = process.env.TEST_BUILD === 'true'
7+
const testMacArch = process.env.TEST_MAC_ARCH
68

79
const 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+
1123
export 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,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
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",

scripts/build.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@ import buildVue from './build-vue'
22
import buildElectron from './build-electron'
33
import chalk from 'chalk'
44

5+
const isTestBuild = process.env.TEST_BUILD === 'true'
6+
57
process.env.NODE_ENV = 'production'
68

9+
const buildType = isTestBuild ? 'Test' : 'Production'
10+
711
async 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

src/main/services/analytics/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'dotenv/config'
21
import type { TrackEvents } from '@shared/types/main/analytics'
32
import ua from 'universal-analytics'
43
import { version } from '../../../../package.json'

0 commit comments

Comments
 (0)