-
Notifications
You must be signed in to change notification settings - Fork 131
chore(site): fix generating examples #3453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 10-25-chore_website_changes_v3_on_v2
Are you sure you want to change the base?
chore(site): fix generating examples #3453
Conversation
|
Deployment failed with the following error: Learn More: https://vercel.com/docs/limits#rate-limits |
PR Review: Fix generating examplesSummaryThis PR refactors the example generation script to use local examples instead of cloning from a remote repository, and removes the unused README generation script. Overall this is a good improvement that simplifies the build process. ✅ Positive Changes1. Simplified Architecture
2. Improved Version ManagementThe new
3. Better Dependency HandlingThe refactored
4. Documentation Cleanup
|
0031d2e to
9ea29d6
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
PR Review: chore(site): fix generating examplesSummaryThis PR refactors the examples generation script to use local examples instead of cloning from a remote repository, removes the unused generateReadme.mjs script, and reorganizes the documentation structure by moving quickstart content to the main docs index. Code Quality & Best PracticesPositive Changes:
Code Style:
|
Potential Issues & Concerns1. Error Handling in getLatestVersion() (Line 29-36)Issue: Silent fallback to hardcoded version 0.9.1 has a version string mismatch The function returns '0.9.1' but the warning message and later usage (line 56) expect '^0.9.1' Recommendation:
2. Potential Race Condition with Temp DirectoriesIssue: Using a shared TEMP_EXAMPLE_DIR could cause issues if multiple instances run concurrently Recommendation: Use a unique temp directory per invocation (though this may be acceptable for a build script that typically runs sequentially) 3. Binary File Handling (Line 163-166)Issue: The comment says Skip binary files but the code actually throws an error Recommendation: Either skip binary files gracefully or update the comment to reflect the actual behavior 4. Documentation Navigation ChangeThe quickstart section was moved from /docs/quickstart to /docs/index.mdx. This is a breaking change for users with bookmarked links. Recommendation: Consider adding a redirect from /docs/quickstart to /docs to avoid 404s |
Performance & SecurityPerformance - Positive:
Performance - Potential Improvement:Running npm install for each example could be slow. Consider parallel processing or caching node_modules between runs Security Concerns:Command Injection Risk (Line 138): Using find via shell execution could be vulnerable if directory paths contain special characters Severity: Low (controlled environment) Test CoverageMissing: No tests were added or modified for this script Recommendation: Consider adding:
|
Summary & RecommendationsOverall Assessment: This is a good refactoring that simplifies the build process Priority Fixes:
Nice to Have:
Additional Observations:
Approval: Safe to merge after addressing the version string mismatch in priority fix #1 Review conducted following CLAUDE.md conventions |
9ea29d6 to
ba3e30a
Compare
457d118 to
72676eb
Compare
- Added new Quickstart tab next to Overview and Integrations in docs navigation - Created new quickstart page at /docs/quickstart/ - Removed quickstart section from Overview tab sidebar - Updated all 'Get Started' buttons on home page to point to /docs/quickstart/ - Updated Local Development quickstart arrow to point to /docs/quickstart/ - Added quickstart to mobile navigation dropdown
72676eb to
afd0d10
Compare
ba3e30a to
0911e7e
Compare
PR Review: Fix generating examplesOverviewThis PR refactors the example generation system by removing the git cloning mechanism and instead using local examples directly from the monorepo. It also removes the ✅ Positive Changes
🐛 Potential IssuesCritical: Command Injection RiskLocation: const allFiles = execSync('find . -type f -not -path "*/.git/*"', {
cwd: tempExampleDir,
encoding: 'utf-8'
}).trim().split('\n');Issue: Using shell commands for file operations is unnecessary and could be a security risk if Recommendation: Replace with native Node.js file system operations: import { readdirSync, statSync } from 'node:fs';
function getAllFilesRecursively(dir, fileList = []) {
const files = readdirSync(dir);
for (const file of files) {
const filePath = join(dir, file);
if (statSync(filePath).isDirectory()) {
if (file !== '.git') {
getAllFilesRecursively(filePath, fileList);
}
} else {
fileList.push(filePath);
}
}
return fileList;
}Error Handling: Silent FailuresLocation: function getLatestVersion(packageName) {
try {
const result = execSync(`npm view ${packageName} version`, { encoding: 'utf-8' });
return result.trim();
} catch (error) {
console.warn(`Warning: Could not fetch version for ${packageName}, using ^0.9.1`);
return '0.9.1';
}
}Issue: The fallback version Recommendation:
Duplicate Directory CheckLocation: Both Recommendation: Remove the check from 🔍 Code Quality Observations1. Hard-coded Tab IndentationLocation: return JSON.stringify(packageJson, null, '\t');While this follows the CLAUDE.md preference for hard tabs in Rust, it's applied to JavaScript JSON files here. Verify this is intentional for the generated package.json files. Most npm ecosystems use 2 spaces. 2. Error Message Improvement NeededLocation: The error message 3. Missing Cleanup on Early ExitLocation: if (exampleNames.length === 0) {
console.error('No examples found in the repository');
return;
}If this early return happens, the 🎯 Performance ConsiderationsGood:
Consider:
🔒 Security AssessmentLow Risk Overall, but note:
📋 Testing Recommendations
📊 Overall AssessmentQuality: Good ✅ This is a solid refactoring that simplifies the architecture and removes external dependencies. The main concerns are:
The documentation changes are sensible and improve UX. The removal of 🛠️ Suggested Action ItemsBefore Merge:
Optional Improvements:
Great work on this refactoring! 🚀 |
afd0d10 to
8010332
Compare

No description provided.