diff --git a/configs/electron-builder.config.mjs b/configs/electron-builder.config.mjs deleted file mode 100644 index 4895de1..0000000 --- a/configs/electron-builder.config.mjs +++ /dev/null @@ -1,41 +0,0 @@ - -/** - * @type {import('electron-builder').Configuration} - */ -const config = { - appId: "308487730@qq.com", - asar: true, - directories: { - output: "release/${version}" - }, - files: [ - "!node_modules", - "dist", - "package.json" - ], - mac: { - artifactName: "${productName}_${version}.${ext}", - target: [ - "dmg" - ] - }, - win: { - target: [ - { - target: "nsis", - arch: [ - "x64" - ] - } - ], - artifactName: "${productName}_${version}.${ext}" - }, - nsis: { - oneClick: false, - perMachine: false, - allowToChangeInstallationDirectory: true, - deleteAppDataOnUninstall: false - } -} - -export { config } diff --git a/electron-builder.json b/electron-builder.json new file mode 100644 index 0000000..e19332e --- /dev/null +++ b/electron-builder.json @@ -0,0 +1,35 @@ +{ + "appId": "308487730@qq.com", + "asar": true, + "directories": { + "output": "release/${version}" + }, + "files": [ + "!node_modules", + "dist", + "package.json" + ], + "mac": { + "artifactName": "${productName}_${version}.${ext}", + "target": [ + "dmg" + ] + }, + "win": { + "target": [ + { + "target": "nsis", + "arch": [ + "x64" + ] + } + ], + "artifactName": "${productName}_${version}.${ext}" + }, + "nsis": { + "oneClick": false, + "perMachine": false, + "allowToChangeInstallationDirectory": true, + "deleteAppDataOnUninstall": false + } +} diff --git a/package.json b/package.json index 951c6a6..9dff0b3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "license": "MIT", "scripts": { "dev": "node scripts/watch.mjs", - "build": "node scripts/build.mjs" + "build": "node scripts/build.mjs && electron-builder" }, "engines": { "node": ">=16.0.0" diff --git a/scripts/build.mjs b/scripts/build.mjs index 3f4613a..5e2e7b8 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -1,8 +1,6 @@ process.env.NODE_ENV = 'production' import { build as viteBuild } from 'vite' -import { build as electronBuild, Platform } from 'electron-builder' -import { config as builderConfig } from '../configs/electron-builder.config.mjs' import chalk from 'chalk' const TAG = chalk.bgBlue(' build.mjs ') @@ -22,16 +20,5 @@ async function buildElectron() { } } -async function packElectron() { - return electronBuild({ - config: builderConfig, - // if you want to build windows platform - // targets: Platform.WINDOWS.createTarget(), - }).then(result => { - console.log(TAG, 'files:', chalk.green(result)) - }) -} - // bootstrap await buildElectron() -await packElectron()