mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-05-23 22:37:41 +08:00
24 lines
647 B
JavaScript
24 lines
647 B
JavaScript
// 修补依赖源码以使构建的依赖恢复正常工作
|
|
|
|
const fs = require('node:fs')
|
|
const path = require('node:path')
|
|
|
|
const rootPath = path.join(__dirname, './')
|
|
|
|
const patchs = [
|
|
]
|
|
|
|
;(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')
|
|
})()
|
|
|