mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 20:16:36 +08:00
electron-builder use npm command
This commit is contained in:
parent
7b32a5ff4c
commit
321ff2ddd7
@ -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 }
|
35
electron-builder.json
Normal file
35
electron-builder.json
Normal file
@ -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
|
||||
}
|
||||
}
|
@ -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"
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user