Skip to content

Commit 3bb8a2d

Browse files
robinjhuangcomfyui-wikiclaude
authored
Rename api-nodes to Partner Nodes (#529)
* Rename api-nodes to Partner Nodes * Add redirects. * Add more redirects. * Fix zh-CN sync check to properly detect renamed files * Snippets don't need redirects. * Use path matching to redirect URLs. * Update redirect check to support wildcard path match * Enhance redirect check by implementing wildcard support in the Node.js script for deleted files, improving detection of missing redirects in docs.json. * Add built-in nodes redirect logic. * Fix broken links * Fix more broken links * Fix EOF heredoc issue in GitHub Actions workflows Replace heredoc syntax with node -e inline execution to avoid EOF marker indentation problems in YAML. The heredoc EOF marker was causing syntax errors because it couldn't be properly indented in YAML's run blocks. This change maintains the same wildcard redirect checking functionality while being more compatible with YAML's structure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: ComfyUI Wiki <contact@comfyui-wiki.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent bbac13e commit 3bb8a2d

File tree

162 files changed

+729
-593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+729
-593
lines changed

.github/workflows/redirect-check.yml

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
id: check-redirects
3131
run: |
3232
# Get list of deleted MDX files (potentially moved)
33-
DELETED_FILES=$(git log --name-only --diff-filter=D --pretty=format: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | grep "\.mdx$" | grep -v "^snippets/" | sort | uniq)
33+
DELETED_FILES=$(git log --name-only --diff-filter=D --pretty=format: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | grep "\.mdx$" | sort | uniq)
3434
3535
# Exit if no MDX files were deleted
3636
if [ -z "$DELETED_FILES" ]; then
@@ -56,39 +56,57 @@ jobs:
5656
5757
# Check docs.json content for redirects
5858
echo "Checking docs.json for redirects..."
59-
60-
# Get the current content of docs.json
61-
DOCS_JSON_CONTENT=$(cat docs.json)
62-
63-
# Check each deleted file
64-
MISSING_REDIRECTS=()
65-
for deleted_file in $DELETED_FILES; do
66-
# Remove .mdx extension
67-
SOURCE_PATH="${deleted_file%.mdx}"
68-
69-
# Check if a redirect exists for this path
70-
if echo "$DOCS_JSON_CONTENT" | grep -q "\"source\": \"/${SOURCE_PATH}\"" || echo "$DOCS_JSON_CONTENT" | grep -q "\"source\": \"${SOURCE_PATH}\""; then
71-
echo "✅ Found redirect for moved file: ${deleted_file}"
72-
else
73-
echo "❌ Missing redirect in docs.json for: ${deleted_file}"
74-
MISSING_REDIRECTS+=("${deleted_file}")
75-
fi
76-
done
77-
78-
# If any redirects are missing, fail the check
79-
if [ ${#MISSING_REDIRECTS[@]} -gt 0 ]; then
80-
echo "------------------------"
81-
echo "❌ The following files were moved but missing redirects in docs.json:"
82-
for missing in "${MISSING_REDIRECTS[@]}"; do
83-
echo "- $missing"
84-
done
85-
echo "------------------------"
86-
echo "Please add redirects in docs.json for moved files using the format:"
87-
echo '{"redirects":[{"source":"/path/to/old-file","destination":"/path/to/new-file"}]}'
88-
echo "------------------------"
89-
echo "For more information, see the documentation in README.md"
90-
exit 1
91-
else
92-
echo "------------------------"
93-
echo "✅ All moved files have corresponding redirects in docs.json."
94-
fi
59+
60+
# Use Node.js to check redirects with wildcard support
61+
node -e "
62+
const fs = require('fs');
63+
const docsJson = JSON.parse(fs.readFileSync('docs.json', 'utf8'));
64+
const deletedFiles = process.argv.slice(1);
65+
const redirects = docsJson.redirects || [];
66+
67+
function matchesPattern(filePath, pattern) {
68+
pattern = pattern.replace(/^\//, '');
69+
filePath = filePath.replace(/^\//, '');
70+
const regexPattern = pattern
71+
.replace(/\//g, '\\\\/')
72+
.replace(/:slug\*/g, '.*')
73+
.replace(/:slug/g, '[^/]+')
74+
.replace(/\*/g, '.*');
75+
const regex = new RegExp(\`^\${regexPattern}$\`);
76+
return regex.test(filePath);
77+
}
78+
79+
const missing = [];
80+
for (const file of deletedFiles) {
81+
const sourcePath = file.replace(/\.mdx$/, '');
82+
const hasRedirect = redirects.some(redirect => {
83+
const redirectSource = redirect.source.replace(/^\//, '');
84+
const filePathNormalized = sourcePath.replace(/^\//, '');
85+
return redirectSource === filePathNormalized || matchesPattern(filePathNormalized, redirectSource);
86+
});
87+
88+
if (hasRedirect) {
89+
console.log(\`✅ Found redirect for moved file: \${file}\`);
90+
} else {
91+
console.log(\`❌ Missing redirect in docs.json for: \${file}\`);
92+
missing.push(file);
93+
}
94+
}
95+
96+
if (missing.length > 0) {
97+
console.log('------------------------');
98+
console.log('❌ The following files were moved but missing redirects in docs.json:');
99+
missing.forEach(file => console.log(\`- \${file}\`));
100+
console.log('------------------------');
101+
console.log('Please add redirects in docs.json for moved files using the format:');
102+
console.log('{\"redirects\":[{\"source\":\"/path/to/old-file\",\"destination\":\"/path/to/new-file\"}]}');
103+
console.log('Or use wildcard patterns like:');
104+
console.log('{\"redirects\":[{\"source\":\"/old-path/:slug*\",\"destination\":\"/new-path/:slug*\"}]}');
105+
console.log('------------------------');
106+
console.log('For more information, see the documentation in README.md');
107+
process.exit(1);
108+
} else {
109+
console.log('------------------------');
110+
console.log('✅ All moved files have corresponding redirects in docs.json.');
111+
}
112+
" $DELETED_FILES

.github/workflows/zh-cn-sync-check.yml

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,54 @@ jobs:
6969
# Check docs.json content for redirects if it was changed
7070
if [ "$DOCS_JSON_CHANGED" = "true" ]; then
7171
echo "Checking docs.json for redirects..."
72-
73-
# Get the current content of docs.json
74-
DOCS_JSON_CONTENT=$(cat docs.json)
75-
76-
for deleted_file in $DELETED_FILES; do
77-
# Remove .mdx extension
78-
SOURCE_PATH="${deleted_file%.mdx}"
79-
80-
# Check if a redirect exists for this path
81-
if echo "$DOCS_JSON_CONTENT" | grep -q "\"source\": \"/${SOURCE_PATH}\"" || echo "$DOCS_JSON_CONTENT" | grep -q "\"source\": \"${SOURCE_PATH}\""; then
82-
echo "✅ Found redirect for moved file: ${deleted_file}"
83-
else
84-
echo "❌ Missing redirect in docs.json for: ${deleted_file}"
85-
MOVED_FILES="$MOVED_FILES ${deleted_file}"
86-
fi
87-
done
72+
73+
# Use Node.js to check redirects with wildcard support
74+
MISSING_REDIRECTS=$(node -e "
75+
const fs = require('fs');
76+
const docsJson = JSON.parse(fs.readFileSync('docs.json', 'utf8'));
77+
const deletedFiles = process.argv.slice(1);
78+
const redirects = docsJson.redirects || [];
79+
80+
function matchesPattern(filePath, pattern) {
81+
pattern = pattern.replace(/^\//, '');
82+
filePath = filePath.replace(/^\//, '');
83+
const regexPattern = pattern
84+
.replace(/\//g, '\\\\/')
85+
.replace(/:slug\*/g, '.*')
86+
.replace(/:slug/g, '[^/]+')
87+
.replace(/\*/g, '.*');
88+
const regex = new RegExp(\`^\${regexPattern}$\`);
89+
return regex.test(filePath);
90+
}
91+
92+
const missing = [];
93+
for (const file of deletedFiles) {
94+
const sourcePath = file.replace(/\.mdx$/, '');
95+
const hasRedirect = redirects.some(redirect => {
96+
const redirectSource = redirect.source.replace(/^\//, '');
97+
const filePathNormalized = sourcePath.replace(/^\//, '');
98+
return redirectSource === filePathNormalized || matchesPattern(filePathNormalized, redirectSource);
99+
});
100+
101+
if (hasRedirect) {
102+
console.log(\`✅ Found redirect for moved file: \${file}\`);
103+
} else {
104+
console.log(\`❌ Missing redirect in docs.json for: \${file}\`);
105+
missing.push(file);
106+
}
107+
}
108+
109+
if (missing.length > 0) {
110+
process.exit(1);
111+
}
112+
" $DELETED_FILES 2>&1 | tee /tmp/redirect_check.log || true)
113+
114+
# Check if there were missing redirects
115+
if echo "$MISSING_REDIRECTS" | grep -q "❌ Missing redirect"; then
116+
MOVED_FILES=$(echo "$MISSING_REDIRECTS" | grep "❌ Missing redirect" | sed 's/.*for: //')
117+
else
118+
MOVED_FILES=""
119+
fi
88120
else
89121
# If docs.json wasn't changed, all deleted files are suspect
90122
MOVED_FILES="$DELETED_FILES"
@@ -132,10 +164,13 @@ jobs:
132164
# For regular docs, the Chinese version should be in zh-CN/
133165
zh_file="zh-CN/${file}"
134166
fi
135-
136-
# Check if the corresponding zh-CN file was also added
137-
if git diff --name-only --diff-filter=A ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -q "^${zh_file}$"; then
138-
echo "✅ Found corresponding added file: ${zh_file}"
167+
168+
# Check if the corresponding zh-CN file was also added or renamed
169+
if git diff --name-only --diff-filter=AR ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -q "^${zh_file}$"; then
170+
echo "✅ Found corresponding added/renamed file: ${zh_file}"
171+
# Also check with rename detection to catch renamed files
172+
elif git diff --name-status --find-renames ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -E "^R[0-9]+\s+" | awk '{print $3}' | grep -q "^${zh_file}$"; then
173+
echo "✅ Found corresponding renamed file: ${zh_file}"
139174
else
140175
echo "❌ Missing equivalent for added file: ${zh_file}"
141176
MISSING_TRANSLATIONS="$MISSING_TRANSLATIONS ${zh_file}"

built-in-nodes/api-node/image/bfl/flux-1-1-pro-ultra-image.mdx renamed to built-in-nodes/partner-node/image/bfl/flux-1-1-pro-ultra-image.mdx

Lines changed: 1 addition & 1 deletion

built-in-nodes/api-node/image/luma/luma-reference.mdx renamed to built-in-nodes/partner-node/image/luma/luma-reference.mdx

Lines changed: 1 addition & 1 deletion

built-in-nodes/api-node/image/luma/luma-text-to-image.mdx renamed to built-in-nodes/partner-node/image/luma/luma-text-to-image.mdx

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)