diff --git a/src/hooks/auto-update-checker/checker/plugin-entry.ts b/src/hooks/auto-update-checker/checker/plugin-entry.ts index 61c7a65bc..f204d61f1 100644 --- a/src/hooks/auto-update-checker/checker/plugin-entry.ts +++ b/src/hooks/auto-update-checker/checker/plugin-entry.ts @@ -11,7 +11,7 @@ export interface PluginEntryInfo { configPath: string } -const EXACT_SEMVER_REGEX = /^\d+\.\d+\.\d+(-[\w.]+)?$/ +const EXACT_SEMVER_REGEX = /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/ export function findPluginEntry(directory: string): PluginEntryInfo | null { for (const configPath of getConfigPaths(directory)) { diff --git a/src/hooks/auto-update-checker/checker/sync-package-json.ts b/src/hooks/auto-update-checker/checker/sync-package-json.ts index 841e307fc..443cbc97e 100644 --- a/src/hooks/auto-update-checker/checker/sync-package-json.ts +++ b/src/hooks/auto-update-checker/checker/sync-package-json.ts @@ -15,7 +15,7 @@ export interface SyncResult { message?: string } -const EXACT_SEMVER_REGEX = /^\d+\.\d+\.\d+(-[\w.]+)?$/ +const EXACT_SEMVER_REGEX = /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/ function safeUnlink(filePath: string): void { try { @@ -71,7 +71,7 @@ export function syncCachePackageJsonToIntent(pluginInfo: PluginEntryInfo): SyncR } const intentIsTag = !EXACT_SEMVER_REGEX.test(intentVersion.trim()) - const currentIsSemver = EXACT_SEMVER_REGEX.test(currentVersion.trim()) + const currentIsSemver = EXACT_SEMVER_REGEX.test(String(currentVersion).trim()) if (intentIsTag && currentIsSemver) { log(