mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-27 03:00:25 +08:00
🔨 Refactor: plugin name -> fullName to support scope packages
This commit is contained in:
@@ -15,3 +15,18 @@ export const handleUrlEncode = (url: string): string => {
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
/**
|
||||
* streamline the full plugin name to a simple one
|
||||
* for example:
|
||||
* 1. picgo-plugin-xxx -> xxx
|
||||
* 2. @xxx/picgo-plugin-yyy -> yyy
|
||||
* @param name pluginFullName
|
||||
*/
|
||||
export const handleStreamlinePluginName = (name: string) => {
|
||||
if (/^@[^/]+\/picgo-plugin-/.test(name)) {
|
||||
return name.replace(/^@[^/]+\/picgo-plugin-/, '')
|
||||
} else {
|
||||
return name.replace(/picgo-plugin-/, '')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user