mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
feat: update libUris in common.js with dynamically built plugin file paths
This commit is contained in:
1 parent
a3416fcb33
commit
4a980971f7
2 files changed
+74
-59
No files matched your search
@@ -33,6 +33,8 @@ console.log(`✨ Built ${artplayerTSoutput}`);
|
||||
|
||||
(async function () {
|
||||
const pluginsTS = glob.sync('packages/artplayer-*-*/types/*.d.ts')
|
||||
const pluginFiles = []
|
||||
|
||||
for (let index = 0; index < pluginsTS.length; index++) {
|
||||
const type = pluginsTS[index]
|
||||
const { name, file } = parsePluginInfo(type)
|
||||
@@ -40,5 +42,18 @@ console.log(`✨ Built ${artplayerTSoutput}`);
|
||||
const output = path.join('docs/assets/ts', file)
|
||||
fs.writeFileSync(output, code.trim())
|
||||
console.log(`✨ Built ${output}`)
|
||||
pluginFiles.push(file)
|
||||
}
|
||||
|
||||
pluginFiles.sort()
|
||||
const allFiles = [...pluginFiles, 'artplayer.d.ts']
|
||||
const commonJsPath = path.join('docs/assets/js/common.js')
|
||||
const commonJsContent = fs.readFileSync(commonJsPath, 'utf-8')
|
||||
const newLibUris = allFiles.map(file => `'./assets/ts/${file}'`).join(',\n ')
|
||||
const newContent = commonJsContent.replace(
|
||||
/let libUris = \[([\s\S]*?)\]/,
|
||||
`let libUris = [\n ${newLibUris},\n ]`,
|
||||
)
|
||||
fs.writeFileSync(commonJsPath, newContent)
|
||||
console.log(`✨ Updated libUris in ${commonJsPath}`)
|
||||
})()
|
||||
Reference in new issue
Block a user