docs: add support for ignoring hooks (#12599)

This commit is contained in:
Shahed Nasser
2025-05-23 18:48:08 +03:00
committed by GitHub
parent 117fc25aea
commit 8303aed701
2 changed files with 33 additions and 70 deletions
@@ -303,6 +303,24 @@ class WorkflowsPlugin {
if (stepType === "hook" && "symbol" in initializer.arguments[1]) { if (stepType === "hook" && "symbol" in initializer.arguments[1]) {
// get the hook's name from the first argument // get the hook's name from the first argument
stepId = this.helper.normalizeName(initializer.arguments[0].getText()) stepId = this.helper.normalizeName(initializer.arguments[0].getText())
const shouldIgnore = ts
.getJSDocCommentsAndTags(initializer.parent)
.some((comment) => {
if (!("tags" in comment)) {
return false
}
return comment.tags?.some(
(tag) => tag.tagName.getText() === "ignore"
)
})
if (stepId === "beforePaymentAuthorization") {
console.log(
shouldIgnore,
ts.getJSDocCommentsAndTags(initializer.parent)
)
}
if (!shouldIgnore) {
const hookArgumetSymbol = this.getHookArgumentSymbol({ const hookArgumetSymbol = this.getHookArgumentSymbol({
argument: initializer.arguments[1], argument: initializer.arguments[1],
constructorFn, constructorFn,
@@ -318,6 +336,7 @@ class WorkflowsPlugin {
workflowReflection: workflowReflection.parent, workflowReflection: workflowReflection.parent,
}) })
} }
}
} else { } else {
const initializerReflection = findReflectionInNamespaces( const initializerReflection = findReflectionInNamespaces(
context.project, context.project,