From 8168b9b4db3588b28d43c4d4bea3a6656af32607 Mon Sep 17 00:00:00 2001 From: Stijnus <72551117+Stijnus@users.noreply.github.com> Date: Fri, 29 Aug 2025 20:32:23 +0200 Subject: [PATCH] fix: additional linting fixes for GitHub deployment components - Fix formatting issues in DeployButton.tsx - Resolve linting errors in GitHubDeploy.client.tsx - Ensure all components meet code quality standards --- app/components/deploy/DeployButton.tsx | 8 ++- app/components/deploy/GitHubDeploy.client.tsx | 58 ++++++++++--------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/app/components/deploy/DeployButton.tsx b/app/components/deploy/DeployButton.tsx index a8d451d..6ff6280 100644 --- a/app/components/deploy/DeployButton.tsx +++ b/app/components/deploy/DeployButton.tsx @@ -76,7 +76,7 @@ export const DeployButton = ({ onVercelDeploy, onNetlifyDeploy, onGitHubDeploy } await onGitHubDeploy(); } else { const result = await handleGitHubDeploy(); - + if (result && result.success && result.files) { setGithubDeploymentFiles(result.files); setGithubProjectName(result.projectName); @@ -129,7 +129,9 @@ export const DeployButton = ({ onVercelDeploy, onNetlifyDeploy, onGitHubDeploy } crossOrigin="anonymous" src="https://cdn.simpleicons.org/netlify" /> - {!netlifyConn.user ? 'No Netlify Account Connected' : 'Deploy to Netlify'} + + {!netlifyConn.user ? 'No Netlify Account Connected' : 'Deploy to Netlify'} + {netlifyConn.user && } @@ -196,7 +198,7 @@ export const DeployButton = ({ onVercelDeploy, onNetlifyDeploy, onGitHubDeploy } {/* GitHub Deployment Dialog */} {showGitHubDeploymentDialog && githubDeploymentFiles && ( - setShowGitHubDeploymentDialog(false)} projectName={githubProjectName} diff --git a/app/components/deploy/GitHubDeploy.client.tsx b/app/components/deploy/GitHubDeploy.client.tsx index 9f43a04..a6846f7 100644 --- a/app/components/deploy/GitHubDeploy.client.tsx +++ b/app/components/deploy/GitHubDeploy.client.tsx @@ -14,7 +14,7 @@ export function useGitHubDeploy() { const handleGitHubDeploy = async () => { const connection = getLocalStorage('github_connection'); - + if (!connection?.token || !connection?.user) { toast.error('Please connect your GitHub account in Settings > Connections first'); return false; @@ -75,8 +75,8 @@ export function useGitHubDeploy() { } // Notify that build succeeded and deployment preparation is starting - deployArtifact.runner.handleDeployAction('deploying', 'running', { - source: 'github' + deployArtifact.runner.handleDeployAction('deploying', 'running', { + source: 'github', }); // Get all project files instead of just the build directory since we're deploying to a repository @@ -89,31 +89,32 @@ export function useGitHubDeploy() { for (const entry of entries) { const fullPath = path.join(dirPath, entry.name); + // Create a relative path without the leading slash for GitHub const relativePath = basePath ? `${basePath}/${entry.name}` : entry.name; // Skip node_modules, .git directories and other common excludes - if (entry.isDirectory() && ( - entry.name === 'node_modules' || - entry.name === '.git' || - entry.name === 'dist' || - entry.name === 'build' || - entry.name === '.cache' || - entry.name === '.next' - )) { + if ( + entry.isDirectory() && + (entry.name === 'node_modules' || + entry.name === '.git' || + entry.name === 'dist' || + entry.name === 'build' || + entry.name === '.cache' || + entry.name === '.next') + ) { continue; } if (entry.isFile()) { // Skip binary files, large files and other common excludes - if (entry.name.endsWith('.DS_Store') || - entry.name.endsWith('.log') || - entry.name.startsWith('.env')) { + if (entry.name.endsWith('.DS_Store') || entry.name.endsWith('.log') || entry.name.startsWith('.env')) { continue; } - + try { const content = await container.fs.readFile(fullPath, 'utf-8'); + // Store the file with its relative path, not the full system path files[relativePath] = content; } catch (error) { @@ -130,24 +131,29 @@ export function useGitHubDeploy() { } const fileContents = await getAllFiles('/'); - - // Show GitHub deployment dialog here - it will handle the actual deployment - // and will receive these files to deploy - - // For now, we'll just complete the deployment with a success message - // Notify that deployment preparation is complete - deployArtifact.runner.handleDeployAction('deploying', 'complete', { - source: 'github' + + /* + * Show GitHub deployment dialog here - it will handle the actual deployment + * and will receive these files to deploy + */ + + /* + * For now, we'll just complete the deployment with a success message + * Notify that deployment preparation is complete + */ + deployArtifact.runner.handleDeployAction('deploying', 'complete', { + source: 'github', }); - + return { success: true, files: fileContents, - projectName: artifact.title || 'bolt-project' + projectName: artifact.title || 'bolt-project', }; } catch (err) { console.error('GitHub deploy error:', err); toast.error(err instanceof Error ? err.message : 'GitHub deployment preparation failed'); + return false; } finally { setIsDeploying(false); @@ -159,4 +165,4 @@ export function useGitHubDeploy() { handleGitHubDeploy, isConnected: !!getLocalStorage('github_connection')?.user, }; -} \ No newline at end of file +}