Allow git describe formatted versions of node packs in workflows (#3518)

This commit is contained in:
Christian Byrne
2025-04-20 09:42:01 +08:00
committed by GitHub
parent 8afe99f48c
commit 6be381b15d
3 changed files with 35 additions and 6 deletions

View File

@@ -36,6 +36,13 @@ export const useWorkflowPacks = (options: UseNodePacksOptions = {}) => {
return undefined
}
/**
* Clean the version string to be used in the registry search.
* Removes the leading 'v' and trims whitespace and line terminators.
*/
const cleanVersionString = (version: string) =>
version.replace(/^v/, '').trim()
/**
* Infer the pack for a node by searching the registry for packs that have nodes
* with the same name.
@@ -70,7 +77,9 @@ export const useWorkflowPacks = (options: UseNodePacksOptions = {}) => {
if (packId === CORE_NODES_PACK_NAME) return undefined
const version =
typeof node.properties.ver === 'string' ? node.properties.ver : undefined
typeof node.properties.ver === 'string'
? cleanVersionString(node.properties.ver)
: undefined
return {
id: packId,