@@ -77,6 +77,7 @@ import { DateTime } from "~/components/primitives/DateTime";
7777import { TextLink } from "~/components/primitives/TextLink" ;
7878import { cn } from "~/utils/cn" ;
7979import { ProjectSettingsPresenter } from "~/services/projectSettingsPresenter.server" ;
80+ import { BuildSettings , BuildSettingsSchema } from "~/v3/buildSettings" ;
8081
8182export const meta : MetaFunction = ( ) => {
8283 return [
@@ -158,11 +159,13 @@ const UpdateGitSettingsFormSchema = z.object({
158159
159160const UpdateBuildSettingsFormSchema = z . object ( {
160161 action : z . literal ( "update-build-settings" ) ,
161- rootDirectory : z . string ( ) . trim ( ) . optional ( ) ,
162+ triggerConfigFilePath : z . string ( ) . trim ( ) . optional ( ) ,
163+ installDirectory : z . string ( ) . trim ( ) . optional ( ) ,
162164 installCommand : z . string ( ) . trim ( ) . optional ( ) ,
163- triggerConfigFile : z . string ( ) . trim ( ) . optional ( ) ,
164165} ) ;
165166
167+ type UpdateBuildSettingsFormSchema = z . infer < typeof UpdateBuildSettingsFormSchema > ;
168+
166169export function createSchema (
167170 constraints : {
168171 getSlugMatch ?: ( slug : string ) => { isMatch : boolean ; projectSlug : string } ;
@@ -386,12 +389,12 @@ export const action: ActionFunction = async ({ request, params }) => {
386389 } ) ;
387390 }
388391 case "update-build-settings" : {
389- const { rootDirectory , installCommand, triggerConfigFile } = submission . value ;
392+ const { installDirectory , installCommand, triggerConfigFilePath } = submission . value ;
390393
391394 const resultOrFail = await projectSettingsService . updateBuildSettings ( projectId , {
392- rootDirectory : rootDirectory || undefined ,
395+ installDirectory : installDirectory || undefined ,
393396 installCommand : installCommand || undefined ,
394- triggerConfigFile : triggerConfigFile || undefined ,
397+ triggerConfigFilePath : triggerConfigFilePath || undefined ,
395398 } ) ;
396399
397400 if ( resultOrFail . isErr ( ) ) {
@@ -1078,28 +1081,22 @@ function ConnectedGitHubRepoForm({
10781081 ) ;
10791082}
10801083
1081- type BuildSettings = {
1082- rootDirectory ?: string ;
1083- installCommand ?: string ;
1084- triggerConfigFile ?: string ;
1085- } ;
1086-
10871084function BuildSettingsForm ( { buildSettings } : { buildSettings : BuildSettings } ) {
10881085 const lastSubmission = useActionData ( ) as any ;
10891086 const navigation = useNavigation ( ) ;
10901087
10911088 const [ hasBuildSettingsChanges , setHasBuildSettingsChanges ] = useState ( false ) ;
10921089 const [ buildSettingsValues , setBuildSettingsValues ] = useState ( {
1093- rootDirectory : buildSettings ?. rootDirectory || "" ,
1090+ installDirectory : buildSettings ?. installDirectory || "" ,
10941091 installCommand : buildSettings ?. installCommand || "" ,
1095- triggerConfigFile : buildSettings ?. triggerConfigFile || "" ,
1092+ triggerConfigFilePath : buildSettings ?. triggerConfigFilePath || "" ,
10961093 } ) ;
10971094
10981095 useEffect ( ( ) => {
10991096 const hasChanges =
1100- buildSettingsValues . rootDirectory !== ( buildSettings ?. rootDirectory || "" ) ||
1097+ buildSettingsValues . installDirectory !== ( buildSettings ?. installDirectory || "" ) ||
11011098 buildSettingsValues . installCommand !== ( buildSettings ?. installCommand || "" ) ||
1102- buildSettingsValues . triggerConfigFile !== ( buildSettings ?. triggerConfigFile || "" ) ;
1099+ buildSettingsValues . triggerConfigFilePath !== ( buildSettings ?. triggerConfigFilePath || "" ) ;
11031100 setHasBuildSettingsChanges ( hasChanges ) ;
11041101 } , [ buildSettingsValues , buildSettings ] ) ;
11051102
@@ -1122,21 +1119,26 @@ function BuildSettingsForm({ buildSettings }: { buildSettings: BuildSettings })
11221119 < Form method = "post" { ...buildSettingsForm . props } >
11231120 < Fieldset >
11241121 < InputGroup fullWidth >
1125- < Label htmlFor = { fields . rootDirectory . id } > Root directory </ Label >
1122+ < Label htmlFor = { fields . triggerConfigFilePath . id } > Trigger config file </ Label >
11261123 < Input
1127- { ...conform . input ( fields . rootDirectory , { type : "text" } ) }
1128- defaultValue = { buildSettings ?. rootDirectory || "" }
1129- placeholder = "/ "
1124+ { ...conform . input ( fields . triggerConfigFilePath , { type : "text" } ) }
1125+ defaultValue = { buildSettings ?. triggerConfigFilePath || "" }
1126+ placeholder = "trigger.config.ts "
11301127 onChange = { ( e ) => {
11311128 setBuildSettingsValues ( ( prev ) => ( {
11321129 ...prev ,
1133- rootDirectory : e . target . value ,
1130+ triggerConfigFile : e . target . value ,
11341131 } ) ) ;
11351132 } }
11361133 />
1137- < Hint > The directory that contains your code.</ Hint >
1138- < FormError id = { fields . rootDirectory . errorId } > { fields . rootDirectory . error } </ FormError >
1134+ < Hint >
1135+ Path to your Trigger configuration file, relative to the root directory of your repo.
1136+ </ Hint >
1137+ < FormError id = { fields . triggerConfigFilePath . errorId } >
1138+ { fields . triggerConfigFilePath . error }
1139+ </ FormError >
11391140 </ InputGroup >
1141+
11401142 < InputGroup fullWidth >
11411143 < Label htmlFor = { fields . installCommand . id } > Install command</ Label >
11421144 < Input
@@ -1150,29 +1152,25 @@ function BuildSettingsForm({ buildSettings }: { buildSettings: BuildSettings })
11501152 } ) ) ;
11511153 } }
11521154 />
1153- < Hint >
1154- Command to install your project dependencies. This is auto-detected by default.
1155- </ Hint >
1155+ < Hint > Command to install your project dependencies. Auto-detected by default.</ Hint >
11561156 < FormError id = { fields . installCommand . errorId } > { fields . installCommand . error } </ FormError >
11571157 </ InputGroup >
11581158 < InputGroup fullWidth >
1159- < Label htmlFor = { fields . triggerConfigFile . id } > Trigger config file </ Label >
1159+ < Label htmlFor = { fields . installDirectory . id } > Install directory </ Label >
11601160 < Input
1161- { ...conform . input ( fields . triggerConfigFile , { type : "text" } ) }
1162- defaultValue = { buildSettings ?. triggerConfigFile || "" }
1163- placeholder = "trigger.config.ts "
1161+ { ...conform . input ( fields . installDirectory , { type : "text" } ) }
1162+ defaultValue = { buildSettings ?. installDirectory || "" }
1163+ placeholder = ""
11641164 onChange = { ( e ) => {
11651165 setBuildSettingsValues ( ( prev ) => ( {
11661166 ...prev ,
1167- triggerConfigFile : e . target . value ,
1167+ rootDirectory : e . target . value ,
11681168 } ) ) ;
11691169 } }
11701170 />
1171- < Hint >
1172- Path to your trigger configuration file, relative to the specified root directory.
1173- </ Hint >
1174- < FormError id = { fields . triggerConfigFile . errorId } >
1175- { fields . triggerConfigFile . error }
1171+ < Hint > The directory where the install command is run in. Auto-detected by default.</ Hint >
1172+ < FormError id = { fields . installDirectory . errorId } >
1173+ { fields . installDirectory . error }
11761174 </ FormError >
11771175 </ InputGroup >
11781176 < FormError > { buildSettingsForm . error } </ FormError >
0 commit comments