更新依赖&版本号(2.12.3-beta.11)

This commit is contained in:
lyswhut
2026-08-21 19:32:17 +08:00
parent c68361719d
commit f4f9496fda
15 changed files with 273 additions and 521 deletions

View File

@@ -16,7 +16,6 @@ module.exports = {
'eslint-webpack-plugin', 'eslint-webpack-plugin',
'typescript', 'typescript',
'undici', 'undici',
'better-sqlite3',
'@types/better-sqlite3', '@types/better-sqlite3',
'changelog-parser', 'changelog-parser',
'webpack-dev-server', 'webpack-dev-server',
@@ -24,6 +23,8 @@ module.exports = {
'eslint-plugin-vue', 'eslint-plugin-vue',
'vue-eslint-parser', 'vue-eslint-parser',
// 'eslint-config-standard-with-typescript', // 'eslint-config-standard-with-typescript',
'webpack',
], ],
// target: 'newest', // target: 'newest',

View File

@@ -1,9 +1,12 @@
const { afterPack } = require('./deps')
const fs = require('fs').promises const fs = require('fs').promises
// https://github.com/electron-userland/electron-builder/issues/4630 // https://github.com/electron-userland/electron-builder/issues/4630
// https://github.com/electron-userland/electron-builder/issues/4630#issuecomment-782020139 // https://github.com/electron-userland/electron-builder/issues/4630#issuecomment-782020139
module.exports = async(context) => { module.exports = async(context) => {
await afterPack()
const { electronPlatformName, appOutDir } = context const { electronPlatformName, appOutDir } = context
if (electronPlatformName !== 'darwin') return if (electronPlatformName !== 'darwin') return
const { const {

View File

@@ -2,7 +2,8 @@ const fs = require('fs')
const fsPromises = require('fs').promises const fsPromises = require('fs').promises
const path = require('path') const path = require('path')
const { Arch } = require('electron-builder') const { Arch } = require('electron-builder')
const nodeAbi = require('node-abi') // const nodeAbi = require('node-abi')
const { beforePack } = require('./deps')
const better_sqlite3_fileNameMap = { const better_sqlite3_fileNameMap = {
[Arch.x64]: 'linux-x64', [Arch.x64]: 'linux-x64',
@@ -16,7 +17,7 @@ const replaceSqliteLib = async(electronNodeAbi, arch) => {
// https://github.com/lyswhut/lx-music-desktop/issues/1102 // https://github.com/lyswhut/lx-music-desktop/issues/1102
// https://github.com/lyswhut/lx-music-desktop/issues/1161 // https://github.com/lyswhut/lx-music-desktop/issues/1161
console.log('replace sqlite lib...') console.log('replace sqlite lib...')
const filePath = path.join(__dirname, `./lib/better_sqlite3_electron-v${electronNodeAbi}-${better_sqlite3_fileNameMap[arch]}.node`) const filePath = path.join(__dirname, `./lib/better_sqlite3_${better_sqlite3_fileNameMap[arch]}.node`)
console.log(filePath) console.log(filePath)
const targetPath = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node') const targetPath = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
await fsPromises.unlink(targetPath).catch(_ => _) await fsPromises.unlink(targetPath).catch(_ => _)
@@ -25,9 +26,10 @@ const replaceSqliteLib = async(electronNodeAbi, arch) => {
module.exports = async(context) => { module.exports = async(context) => {
await beforePack()
const { electronPlatformName, arch } = context const { electronPlatformName, arch } = context
const electronVersion = context.packager?.info?._framework?.version ?? require('../package.json').devDependencies.electron.replace(/^[^\d]*?(\d+)/, '$1') // const electronVersion = context.packager?.info?._framework?.version ?? require('../package.json').devDependencies.electron.replace(/^[^\d]*?(\d+)/, '$1')
const electronNodeAbi = nodeAbi.getAbi(electronVersion, 'electron') // const electronNodeAbi = nodeAbi.getAbi(electronVersion, 'electron')
if (electronPlatformName !== 'linux' || process.env.FORCE) return if (electronPlatformName !== 'linux' || process.env.FORCE) return
const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp') const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp')
const bindingBakFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp.bak') const bindingBakFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp.bak')
@@ -39,7 +41,7 @@ module.exports = async(context) => {
// console.log('rename binding file...') // console.log('rename binding file...')
await fsPromises.rename(bindingFilePath, bindingBakFilePath) await fsPromises.rename(bindingFilePath, bindingBakFilePath)
} }
await replaceSqliteLib(electronNodeAbi, arch) await replaceSqliteLib(arch)
break break
default: default:

View File

@@ -6,20 +6,28 @@ const path = require('node:path')
const rootPath = path.join(__dirname, '../') const rootPath = path.join(__dirname, '../')
const patchs = [ const patchs = [
// [
// path.join(rootPath, './node_modules/ws/package.json'),
// '\n "browser": "./browser.js",',
// '',
// ],
// [
// path.join(rootPath, './node_modules/music-metadata/package.json'),
// '"default": "./lib/core.js"',
// '"default": "./lib/index.js"',
// ],
// [
// path.join(rootPath, './node_modules/strtok3/package.json'),
// '"default": "./lib/core.js"',
// '"default": "./lib/index.js"',
// ],
[ [
path.join(rootPath, './node_modules/ws/package.json'), path.join(rootPath, './node_modules/better-sqlite3/package.json'),
'\n "browser": "./browser.js",', `{
'', "build-release": "node-gyp clean && node-gyp rebuild --release --force_build=1",`,
], `{
[ "install": "node -e \\"process.exit(require('fs').existsSync('build/Release/better_sqlite3.node') ? 0 : 1)\\" || node-gyp rebuild --release --force_build=1",
path.join(rootPath, './node_modules/music-metadata/package.json'), "build-release": "node-gyp clean && node-gyp rebuild --release --force_build=1",`,
'"default": "./lib/core.js"',
'"default": "./lib/index.js"',
],
[
path.join(rootPath, './node_modules/strtok3/package.json'),
'"default": "./lib/core.js"',
'"default": "./lib/index.js"',
], ],
] ]

55
build-config/deps.js Normal file
View File

@@ -0,0 +1,55 @@
const fs = require('fs')
const path = require('path')
const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp')
// const bindingBakFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp.bak')
exports.beforePack = async() => {
// if (!fs.existsSync(bindingFilePath)) return
// fs.renameSync(bindingFilePath, bindingBakFilePath)
try {
fs.writeFileSync(
bindingFilePath,
fs.readFileSync(bindingFilePath, 'utf-8').replace('\'force_build%\': 0,', '\'force_build%\': 1,'),
)
} catch (error) {
console.error(error)
}
}
exports.afterPack = async() => {
// if (fs.existsSync(bindingFilePath)) return
// fs.renameSync(bindingBakFilePath, bindingFilePath)
try {
fs.writeFileSync(
bindingFilePath,
fs.readFileSync(bindingFilePath, 'utf-8').replace('\'force_build%\': 1,', '\'force_build%\': 0,'),
)
} catch (error) {
console.error(error)
}
}
const replaceSqliteLib = async(arch) => {
// console.log(await fs.readdir(path.join(context.appOutDir, './resources/')))
// if (context.electronPlatformName != 'linux' || context.arch != Arch.arm64) return
// https://github.com/lyswhut/lx-music-desktop/issues/1102
// https://github.com/lyswhut/lx-music-desktop/issues/1161
console.log('replace sqlite lib...')
const filePath = path.join(__dirname, `./lib/better_sqlite3_${process.platform}-${arch}.node`)
console.log(filePath)
const targetPath = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
await fs.promises.unlink(targetPath).catch(_ => _)
await fs.promises.copyFile(filePath, targetPath)
}
exports.copyLib = async(arch = process.arch) => {
if (process.platform === 'linux') {
await replaceSqliteLib(arch)
return
}
const libPath = path.join(__dirname, `../node_modules/better-sqlite3/prebuilds/${process.platform}-${arch}.node`)
if (!fs.existsSync(libPath)) {
console.error(`Better-sqlite3 prebuild not found for ${process.platform}-${arch}`)
return
}
const targetPath = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
await fs.promises.cp(libPath, targetPath, { recursive: true, force: true })
}

View File

@@ -9,7 +9,7 @@ const getGzipFiles = async() => {
// for (const name of names) { // for (const name of names) {
// if (name.endsWith('.node')) await fs.promises.unlink(path.join(libDir, name)) // if (name.endsWith('.node')) await fs.promises.unlink(path.join(libDir, name))
// } // }
return names.filter(name => name.endsWith('.gz')) return names.filter((name) => name.endsWith('.gz'))
} }
const unzip = async(filePath) => { const unzip = async(filePath) => {
@@ -18,22 +18,20 @@ const unzip = async(filePath) => {
await fs.promises.mkdir(targetDir) await fs.promises.mkdir(targetDir)
await tar.x({ await tar.x({
file: filePath, file: filePath,
strip: 1, strip: 0,
C: targetDir, C: targetDir,
}) })
return targetDir return targetDir
} }
const files = [ const files = ['better_sqlite3']
'better_sqlite3',
]
const moveFile = async(filePath) => { const moveFile = async(filePath) => {
const name = 'electron-' + path.basename(filePath).split('-electron-')[1] const name = `${path.basename(filePath).split('_v')[0].replace('_', '-')}`
for (const fileName of files) { for (const fileName of files) {
if (fileName == 'better_sqlite3' && !name.includes('linux')) continue if (fileName == 'better_sqlite3' && !name.includes('linux')) continue
const targetPath = path.join(libDir, `${fileName}_${name}.node`) const targetPath = path.join(libDir, `${fileName}_${name}.node`)
if (fs.existsSync(targetPath)) await fs.promises.unlink(targetPath) if (fs.existsSync(targetPath)) await fs.promises.unlink(targetPath)
await fs.promises.rename(path.join(filePath, 'Release', fileName + '.node'), targetPath) await fs.promises.rename(path.join(filePath, `${fileName}.node`), targetPath)
} }
await fs.promises.rm(filePath, { recursive: true }) await fs.promises.rm(filePath, { recursive: true })
} }
@@ -49,4 +47,3 @@ const run = async() => {
} }
run() run()

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
const { copyLib } = require('./deps')
copyLib()

641
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "lx-music-desktop", "name": "lx-music-desktop",
"version": "2.12.3-beta.10", "version": "2.12.3-beta.11",
"description": "一个免费的音乐查找助手", "description": "一个免费的音乐查找助手",
"main": "./dist/main.js", "main": "./dist/main.js",
"scripts": { "scripts": {
@@ -63,7 +63,7 @@
"build:renderer-scripts": "cross-env NODE_ENV=production webpack --config build-config/renderer-scripts/webpack.config.prod.js --progress", "build:renderer-scripts": "cross-env NODE_ENV=production webpack --config build-config/renderer-scripts/webpack.config.prod.js --progress",
"lint": "eslint --ext .ts,.js,.vue -f node_modules/eslint-formatter-friendly src", "lint": "eslint --ext .ts,.js,.vue -f node_modules/eslint-formatter-friendly src",
"lint:fix": "eslint --ext .ts,.js,.vue -f node_modules/eslint-formatter-friendly --fix src", "lint:fix": "eslint --ext .ts,.js,.vue -f node_modules/eslint-formatter-friendly --fix src",
"postinstall": "electron-builder install-app-deps", "postinstall": "node build-config/postinstall.js",
"dp": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:2081 npm run pack", "dp": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:2081 npm run pack",
"up": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:2081 npm i" "up": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:2081 npm i"
}, },
@@ -113,21 +113,21 @@
"@types/node": "^20.19.43", "@types/node": "^20.19.43",
"@types/tunnel": "^0.0.7", "@types/tunnel": "^0.0.7",
"@types/ws": "8.5.4", "@types/ws": "8.5.4",
"@vue/language-plugin-pug": "^3.3.9", "@vue/language-plugin-pug": "^3.3.11",
"browserslist": "^4.28.7", "browserslist": "^4.28.8",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"changelog-parser": "3.0.1", "changelog-parser": "3.0.1",
"copy-webpack-plugin": "^14.0.0", "copy-webpack-plugin": "^14.0.0",
"core-js": "^3.49.0", "core-js": "^3.50.0",
"cross-env": "^10.1.0", "cross-env": "^10.1.0",
"css-loader": "^7.1.4", "css-loader": "^7.1.4",
"css-minimizer-webpack-plugin": "^8.0.0", "css-minimizer-webpack-plugin": "^8.0.0",
"del": "^6.1.1", "del": "^6.1.1",
"electron": "41.2.0", "electron": "42.9.3",
"electron-builder": "^26.15.3", "electron-builder": "^26.15.7",
"electron-debug": "^3.2.0", "electron-debug": "^3.2.0",
"electron-devtools-installer": "github:lyswhut/electron-devtools-installer#64596d615c1fc891eefd8aef1dfcb2c87aaadf03", "electron-devtools-installer": "github:lyswhut/electron-devtools-installer#64596d615c1fc891eefd8aef1dfcb2c87aaadf03",
"electron-to-chromium": "^1.5.400", "electron-to-chromium": "^1.5.412",
"electron-updater": "6.8.9", "electron-updater": "6.8.9",
"eslint": "^8.57.1", "eslint": "^8.57.1",
"eslint-config-standard": "^17.1.0", "eslint-config-standard": "^17.1.0",
@@ -138,11 +138,11 @@
"eslint-plugin-vue-pug": "^0.6.2", "eslint-plugin-vue-pug": "^0.6.2",
"eslint-webpack-plugin": "^4.2.0", "eslint-webpack-plugin": "^4.2.0",
"html-webpack-plugin": "^5.6.8", "html-webpack-plugin": "^5.6.8",
"less": "^4.8.1", "less": "^4.9.0",
"less-loader": "^13.0.0", "less-loader": "^13.0.0",
"mini-css-extract-plugin": "^2.10.2", "mini-css-extract-plugin": "^2.10.2",
"node-loader": "^2.1.0", "node-loader": "^2.1.0",
"postcss": "^8.5.25", "postcss": "^8.5.26",
"postcss-loader": "^8.2.1", "postcss-loader": "^8.2.1",
"postcss-pxtorem": "^6.1.0", "postcss-pxtorem": "^6.1.0",
"pug": "^3.0.4", "pug": "^3.0.4",
@@ -152,7 +152,7 @@
"svg-sprite-loader": "^6.0.11", "svg-sprite-loader": "^6.0.11",
"svg-transform-loader": "^2.0.13", "svg-transform-loader": "^2.0.13",
"svgo-loader": "^5.0.0", "svgo-loader": "^5.0.0",
"terser": "^5.49.1", "terser": "^5.50.0",
"terser-webpack-plugin": "^5.6.1", "terser-webpack-plugin": "^5.6.1",
"tree-kill": "^1.2.2", "tree-kill": "^1.2.2",
"ts-loader": "^9.6.2", "ts-loader": "^9.6.2",
@@ -161,13 +161,13 @@
"vue-loader": "^17.4.2", "vue-loader": "^17.4.2",
"webpack": "5.107.2", "webpack": "5.107.2",
"webpack-cli": "^7.2.2", "webpack-cli": "^7.2.2",
"webpack-dev-server": "5.2.5", "webpack-dev-server": "5.2.6",
"webpack-hot-middleware": "github:lyswhut/webpack-hot-middleware#329c4375134b89d39da23a56a94db651247c74a1", "webpack-hot-middleware": "github:lyswhut/webpack-hot-middleware#329c4375134b89d39da23a56a94db651247c74a1",
"webpack-merge": "^6.0.1" "webpack-merge": "^6.0.1"
}, },
"dependencies": { "dependencies": {
"@simonwep/pickr": "^1.10.1", "@simonwep/pickr": "^1.10.1",
"better-sqlite3": "^12.11.1", "better-sqlite3": "^13.0.3",
"bufferutil": "^4.1.0", "bufferutil": "^4.1.0",
"comlink": "~4.3.1", "comlink": "~4.3.1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
@@ -178,7 +178,7 @@
"jschardet": "^3.1.4", "jschardet": "^3.1.4",
"long": "^5.3.2", "long": "^5.3.2",
"message2call": "^0.1.3", "message2call": "^0.1.3",
"music-metadata": "^11.14.0", "music-metadata": "^11.15.0",
"needle": "github:lyswhut/needle#93299ac841b7e9a9f82ca7279b88aaaeda404060", "needle": "github:lyswhut/needle#93299ac841b7e9a9f82ca7279b88aaaeda404060",
"node-id3": "^0.2.9", "node-id3": "^0.2.9",
"sortablejs": "^1.15.7", "sortablejs": "^1.15.7",
@@ -187,7 +187,7 @@
"utf-8-validate": "^6.0.6", "utf-8-validate": "^6.0.6",
"vue": "~3.3.13", "vue": "~3.3.13",
"vue-router": "~4.5.1", "vue-router": "~4.5.1",
"ws": "^8.21.2" "ws": "^8.21.3"
}, },
"overrides": { "overrides": {
"got": "^11", "got": "^11",