mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-10 21:06:15 -08:00
refactor: update global name handling in build scripts
- Replaced `toPascalCase` with `getGlobalName` in build and dev scripts to standardize global variable naming for packages. - Added `toCamelCase` and `getGlobalName` utility functions in `utils.js` to handle naming conventions based on package type.
This commit is contained in:
1 parent
1e60637b74
commit
1dc8e9a4ff
85 files changed
+554
-825
No files matched your search
@@ -21,6 +21,21 @@ export function toPascalCase(name) {
|
||||
return name.replace(/(^|-)([a-z])/g, (_, _p, c) => c.toUpperCase())
|
||||
}
|
||||
|
||||
// Convert kebab-case to camelCase: artplayer-plugin-ads -> artplayerPluginAds
|
||||
export function toCamelCase(name) {
|
||||
return name.replace(/-([a-z])/g, (_, c) => c.toUpperCase())
|
||||
}
|
||||
|
||||
// Get the global variable name for a package
|
||||
// - artplayer, artplayer-tool-* -> PascalCase (class)
|
||||
// - artplayer-plugin-*, artplayer-proxy-* -> camelCase (function)
|
||||
export function getGlobalName(name) {
|
||||
if (name === 'artplayer' || name.startsWith('artplayer-tool-')) {
|
||||
return toPascalCase(name)
|
||||
}
|
||||
return toCamelCase(name)
|
||||
}
|
||||
|
||||
// Get Vite build config
|
||||
export function getViteBuildConfig(options) {
|
||||
const {
|
||||
|
||||
Reference in new issue
Block a user