mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-03 14:20:50 +08:00
✨ feat(build): 完善打包
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,6 +3,8 @@ node_modules
|
|||||||
dist
|
dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
|
dist_electron
|
||||||
|
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
|
package-lock.json
|
||||||
dist.zip
|
dist.zip
|
||||||
@@ -8,19 +8,21 @@ function createWindow() {
|
|||||||
frame: false,
|
frame: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
preload: path.join(__dirname, '/utils/preload.js'),
|
preload: path.join(__dirname, '/electron/preload.js'),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
win.setMinimumSize(1280, 900);
|
win.setMinimumSize(1280, 900);
|
||||||
win.loadURL('http://localhost:4678/')
|
|
||||||
win.webContents.openDevTools({ mode: 'detach' })
|
if (process.env.NODE_ENV === 'dev') {
|
||||||
|
win.loadURL('http://localhost:4678/')
|
||||||
|
win.webContents.openDevTools({ mode: 'detach' })
|
||||||
|
} else {
|
||||||
|
win.loadURL(`file://${__dirname}/dist/index.html`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
app.whenReady().then(createWindow)
|
app.whenReady().then(createWindow)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ipcMain.on('minimize-window', (event) => {
|
ipcMain.on('minimize-window', (event) => {
|
||||||
const win = BrowserWindow.fromWebContents(event.sender)
|
const win = BrowserWindow.fromWebContents(event.sender)
|
||||||
win.minimize()
|
win.minimize()
|
||||||
18
electron.config.json
Normal file
18
electron.config.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"appId": "com.alger.music",
|
||||||
|
"productName": "AlgerMusic",
|
||||||
|
"directories": {
|
||||||
|
"output": "dist_electron"
|
||||||
|
},
|
||||||
|
"files": ["dist/**/*", "package.json", "app.js", "electron/**/*"],
|
||||||
|
"win": {
|
||||||
|
"icon": "public/icon.png",
|
||||||
|
"target": "nsis",
|
||||||
|
"extraFiles": [
|
||||||
|
{
|
||||||
|
"from": "installer/installer.nsh",
|
||||||
|
"to": "$INSTDIR"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "alger-music",
|
"name": "alger-music",
|
||||||
"version": "0.0.0",
|
"version": "1.0.0",
|
||||||
"main": "./app/main.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"es": "vite && electron .",
|
"es": "vite && electron .",
|
||||||
"eb": "vite build && electron-builder",
|
"eb": "vite build && electron-builder",
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"e:b": "electron-builder"
|
"e:b": "electron-builder --config ./electron.config.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/postcss7-compat": "^2.2.4",
|
"@tailwindcss/postcss7-compat": "^2.2.4",
|
||||||
|
|||||||
BIN
public/icon.ico
BIN
public/icon.ico
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB |
BIN
public/icon.png
Normal file
BIN
public/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 149 KiB |
@@ -2,30 +2,11 @@ import { defineConfig } from 'vite'
|
|||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import VueDevTools from 'vite-plugin-vue-devtools'
|
import VueDevTools from 'vite-plugin-vue-devtools'
|
||||||
// const { vitePluginElectronBuilder } = require('vite-plugin-electron-builder')
|
|
||||||
import vitePluginElectronBuilder from 'vite-plugin-electron-builder'
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [vue(), VueDevTools()],
|
||||||
vue(),
|
base: './',
|
||||||
VueDevTools(),
|
|
||||||
vitePluginElectronBuilder({
|
|
||||||
mainProcessFile: 'app/main.js',
|
|
||||||
preloadDir: 'app/utils',
|
|
||||||
builderOptions: {
|
|
||||||
appId: 'com.alger.music',
|
|
||||||
directories: {
|
|
||||||
output: 'dist_electron',
|
|
||||||
},
|
|
||||||
files: ['dist/**/*', 'node_modules/**/*', 'package.json'],
|
|
||||||
win: {
|
|
||||||
icon: 'public/icon.ico',
|
|
||||||
target: 'nsis',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.resolve(__dirname, 'src'),
|
'@': path.resolve(__dirname, 'src'),
|
||||||
|
|||||||
Reference in New Issue
Block a user