From 0fd1f1fe4e22ff6701ad051824e1245ab2affc7d Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 11 Dec 2024 20:55:58 +0800 Subject: fix: build js declarations (#141) --- Argcfile.sh | 3 +++ scripts/build-declarations.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Argcfile.sh b/Argcfile.sh index 7c1e859..9863c29 100644 --- a/Argcfile.sh +++ b/Argcfile.sh @@ -162,6 +162,9 @@ build-declarations@tool() { json_data="$(generate-declarations@tool "$name" | jq -r '.[0]')" || { build_failed_tools+=("$name") } + if [[ "$json_data" == "null" ]]; then + _die "error: failed to build declartions for tool $name" + fi json_list+=("$json_data") done if [[ -n "$not_found_tools" ]]; then diff --git a/scripts/build-declarations.js b/scripts/build-declarations.js index 88a6b97..5453a18 100755 --- a/scripts/build-declarations.js +++ b/scripts/build-declarations.js @@ -53,7 +53,7 @@ function extractFunctions(contents, isTool) { continue; } if (isTool) { - if (new RegExp(`function ${TOOL_ENTRY_FUNC}`).test(line)) { + if (new RegExp(`^export (async )?function ${TOOL_ENTRY_FUNC}|^exports\.${TOOL_ENTRY_FUNC}`).test(line)) { output.push({ funcName: TOOL_ENTRY_FUNC, jsdoc, -- cgit v1.2.3