Fix project deploy settings shape

This commit is contained in:
Alex Gleason committed 2025-10-18 21:04:14 -05:00
1 parent 1ab86f2009
commit 9aa2bf7da4
2 files changed
+63 -28

No files matched your search

+26 -6
View File
@@ -1,17 +1,32 @@
import { useState, useEffect, useCallback } from 'react';
import { useFS } from './useFS';
export interface ProjectDeploySettings {
providerId?: string;
netlify?: {
export interface ShakespeareProjectConfig {
type: 'shakespeare';
data: {
subdomain?: string;
};
}
export interface NetlifyProjectConfig {
type: 'netlify';
data: {
siteId?: string;
};
vercel?: {
}
export interface VercelProjectConfig {
type: 'vercel';
data: {
teamId?: string;
projectId?: string;
};
}
export type ProjectProviderConfig = ShakespeareProjectConfig | NetlifyProjectConfig | VercelProjectConfig;
export type ProjectDeploySettings = Record<string, ProjectProviderConfig>;
/**
* Hook to manage project-specific deployment settings
* Stores settings in .git/shakespeare/deploy.json
@@ -59,15 +74,20 @@ export function useProjectDeploySettings(projectId: string) {
}
};
const updateSettings = async (updates: Partial<ProjectDeploySettings>) => {
const newSettings = { ...settings, ...updates };
const updateSettings = async (providerId: string, config: ProjectProviderConfig) => {
const newSettings = { ...settings, [providerId]: config };
await saveSettings(newSettings);
};
const getProviderConfig = (providerId: string): ProjectProviderConfig | undefined => {
return settings[providerId];
};
return {
settings,
isLoading,
updateSettings,
saveSettings,
getProviderConfig,
};
}