修补依赖以使vite恢复构建
parent
e719999d8a
commit
7c5969e580
|
@ -0,0 +1,38 @@
|
||||||
|
// 修补依赖源码以使vite构建的依赖恢复正常工作
|
||||||
|
|
||||||
|
const fs = require('node:fs')
|
||||||
|
const path = require('node:path')
|
||||||
|
|
||||||
|
const rootPath = path.join(__dirname, '../')
|
||||||
|
|
||||||
|
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"',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
|
||||||
|
;(async() => {
|
||||||
|
for (const [filePath, fromStr, toStr] of patchs) {
|
||||||
|
console.log(`Patching ${filePath.replace(rootPath, '')}`)
|
||||||
|
try {
|
||||||
|
const file = (await fs.promises.readFile(filePath)).toString()
|
||||||
|
await fs.promises.writeFile(filePath, file.replace(fromStr, toStr))
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Patch ${filePath.replace(rootPath, '')} failed: ${err.message}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('\nDependencies patch finished.\n')
|
||||||
|
})()
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "lx-music-desktop",
|
"name": "lx-music-desktop",
|
||||||
"version": "2.4.0-beta.4",
|
"version": "2.4.0-beta.5",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "lx-music-desktop",
|
"name": "lx-music-desktop",
|
||||||
"version": "2.4.0-beta.4",
|
"version": "2.4.0-beta.5",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
"utf-8-validate": "^6.0.3",
|
"utf-8-validate": "^6.0.3",
|
||||||
"vue": "~3.2.47",
|
"vue": "~3.2.47",
|
||||||
"vue-router": "^4.2.4",
|
"vue-router": "^4.2.4",
|
||||||
"ws": "github:lyswhut/ws#76966d23e9b610422d8395cdd3a6b1ca0e1f25c4"
|
"ws": "^8.13.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.22.9",
|
"@babel/core": "^7.22.9",
|
||||||
|
@ -6960,9 +6960,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/file-type": {
|
"node_modules/file-type": {
|
||||||
"version": "18.2.1",
|
"version": "18.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/file-type/-/file-type-18.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/file-type/-/file-type-18.5.0.tgz",
|
||||||
"integrity": "sha512-Yw5MtnMv7vgD2/6Bjmmuegc8bQEVA9GmAyaR18bMYWKqsWDG9wgYZ1j4I6gNMF5Y5JBDcUcjRQqNQx7Y8uotcg==",
|
"integrity": "sha512-yvpl5U868+V6PqXHMmsESpg6unQ5GfnPssl4dxdJudBrr9qy7Fddt7EVX1VLlddFfe8Gj9N7goCZH22FXuSQXQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"readable-web-to-node-stream": "^3.0.2",
|
"readable-web-to-node-stream": "^3.0.2",
|
||||||
"strtok3": "^7.0.0",
|
"strtok3": "^7.0.0",
|
||||||
|
@ -12791,9 +12791,8 @@
|
||||||
},
|
},
|
||||||
"node_modules/ws": {
|
"node_modules/ws": {
|
||||||
"version": "8.13.0",
|
"version": "8.13.0",
|
||||||
"resolved": "git+ssh://git@github.com/lyswhut/ws.git#76966d23e9b610422d8395cdd3a6b1ca0e1f25c4",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
|
||||||
"integrity": "sha512-cdckvFUwVOy8HY+OpaFNB6ydNNzNdWJV89fyUSn6WvzVvfo93tvU/IxLCpu8TVjMj9HJ+Wd3s6duGuH46u6slw==",
|
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
},
|
},
|
||||||
|
@ -17890,9 +17889,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"file-type": {
|
"file-type": {
|
||||||
"version": "18.2.1",
|
"version": "18.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/file-type/-/file-type-18.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/file-type/-/file-type-18.5.0.tgz",
|
||||||
"integrity": "sha512-Yw5MtnMv7vgD2/6Bjmmuegc8bQEVA9GmAyaR18bMYWKqsWDG9wgYZ1j4I6gNMF5Y5JBDcUcjRQqNQx7Y8uotcg==",
|
"integrity": "sha512-yvpl5U868+V6PqXHMmsESpg6unQ5GfnPssl4dxdJudBrr9qy7Fddt7EVX1VLlddFfe8Gj9N7goCZH22FXuSQXQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"readable-web-to-node-stream": "^3.0.2",
|
"readable-web-to-node-stream": "^3.0.2",
|
||||||
"strtok3": "^7.0.0",
|
"strtok3": "^7.0.0",
|
||||||
|
@ -22318,9 +22317,9 @@
|
||||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "git+ssh://git@github.com/lyswhut/ws.git#76966d23e9b610422d8395cdd3a6b1ca0e1f25c4",
|
"version": "8.13.0",
|
||||||
"integrity": "sha512-cdckvFUwVOy8HY+OpaFNB6ydNNzNdWJV89fyUSn6WvzVvfo93tvU/IxLCpu8TVjMj9HJ+Wd3s6duGuH46u6slw==",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
|
||||||
"from": "ws@github:lyswhut/ws#76966d23e9b610422d8395cdd3a6b1ca0e1f25c4",
|
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
"xml-name-validator": {
|
"xml-name-validator": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lx-music-desktop",
|
"name": "lx-music-desktop",
|
||||||
"version": "2.4.0-beta.4",
|
"version": "2.4.0-beta.5",
|
||||||
"description": "一个免费的音乐查找助手",
|
"description": "一个免费的音乐查找助手",
|
||||||
"main": "./dist/main/main.js",
|
"main": "./dist/main/main.js",
|
||||||
"productName": "lx-music-desktop",
|
"productName": "lx-music-desktop",
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
"build": "ts-node build-config/pack.js",
|
"build": "ts-node build-config/pack.js",
|
||||||
"lint": "eslint --ext .ts,.js,.vue src",
|
"lint": "eslint --ext .ts,.js,.vue src",
|
||||||
"lint:fix": "eslint --ext .ts,.js,.vue --fix src",
|
"lint:fix": "eslint --ext .ts,.js,.vue --fix src",
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "node ./build-config/dependencies-patch.js && electron-builder install-app-deps",
|
||||||
"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"
|
||||||
},
|
},
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
"utf-8-validate": "^6.0.3",
|
"utf-8-validate": "^6.0.3",
|
||||||
"vue": "~3.2.47",
|
"vue": "~3.2.47",
|
||||||
"vue-router": "^4.2.4",
|
"vue-router": "^4.2.4",
|
||||||
"ws": "github:lyswhut/ws#76966d23e9b610422d8395cdd3a6b1ca0e1f25c4"
|
"ws": "^8.13.0"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"got": "^11",
|
"got": "^11",
|
||||||
|
|
Loading…
Reference in New Issue