@@ -160,23 +160,25 @@ const UpdateBuildSettingsFormSchema = z.object({
160160 . refine ( ( val ) => ! val || val . length <= 255 , {
161161 message : "Config file path must not exceed 255 characters" ,
162162 } ) ,
163- installDirectory : z
163+ installCommand : z
164164 . string ( )
165165 . trim ( )
166166 . optional ( )
167- . transform ( ( val ) => ( val ? val . replace ( / ^ \/ + / , "" ) : val ) )
168- . refine ( ( val ) => ! val || val . length <= 255 , {
169- message : "Install directory must not exceed 255 characters" ,
167+ . refine ( ( val ) => ! val || ! val . includes ( "\n" ) , {
168+ message : "Install command must be a single line" ,
169+ } )
170+ . refine ( ( val ) => ! val || val . length <= 500 , {
171+ message : "Install command must not exceed 500 characters" ,
170172 } ) ,
171- installCommand : z
173+ preBuildCommand : z
172174 . string ( )
173175 . trim ( )
174176 . optional ( )
175177 . refine ( ( val ) => ! val || ! val . includes ( "\n" ) , {
176- message : "Install command must be a single line" ,
178+ message : "Pre-build command must be a single line" ,
177179 } )
178180 . refine ( ( val ) => ! val || val . length <= 500 , {
179- message : "Install command must not exceed 500 characters" ,
181+ message : "Pre-build command must not exceed 500 characters" ,
180182 } ) ,
181183} ) ;
182184
@@ -405,11 +407,11 @@ export const action: ActionFunction = async ({ request, params }) => {
405407 } ) ;
406408 }
407409 case "update-build-settings" : {
408- const { installDirectory , installCommand , triggerConfigFilePath } = submission . value ;
410+ const { installCommand , preBuildCommand , triggerConfigFilePath } = submission . value ;
409411
410412 const resultOrFail = await projectSettingsService . updateBuildSettings ( projectId , {
411- installDirectory : installDirectory || undefined ,
412413 installCommand : installCommand || undefined ,
414+ preBuildCommand : preBuildCommand || undefined ,
413415 triggerConfigFilePath : triggerConfigFilePath || undefined ,
414416 } ) ;
415417
@@ -1130,14 +1132,14 @@ function BuildSettingsForm({ buildSettings }: { buildSettings: BuildSettings })
11301132
11311133 const [ hasBuildSettingsChanges , setHasBuildSettingsChanges ] = useState ( false ) ;
11321134 const [ buildSettingsValues , setBuildSettingsValues ] = useState ( {
1133- installDirectory : buildSettings ?. installDirectory || "" ,
1135+ preBuildCommand : buildSettings ?. preBuildCommand || "" ,
11341136 installCommand : buildSettings ?. installCommand || "" ,
11351137 triggerConfigFilePath : buildSettings ?. triggerConfigFilePath || "" ,
11361138 } ) ;
11371139
11381140 useEffect ( ( ) => {
11391141 const hasChanges =
1140- buildSettingsValues . installDirectory !== ( buildSettings ?. installDirectory || "" ) ||
1142+ buildSettingsValues . preBuildCommand !== ( buildSettings ?. preBuildCommand || "" ) ||
11411143 buildSettingsValues . installCommand !== ( buildSettings ?. installCommand || "" ) ||
11421144 buildSettingsValues . triggerConfigFilePath !== ( buildSettings ?. triggerConfigFilePath || "" ) ;
11431145 setHasBuildSettingsChanges ( hasChanges ) ;
@@ -1187,34 +1189,38 @@ function BuildSettingsForm({ buildSettings }: { buildSettings: BuildSettings })
11871189 < Input
11881190 { ...conform . input ( fields . installCommand , { type : "text" } ) }
11891191 defaultValue = { buildSettings ?. installCommand || "" }
1190- placeholder = "e.g., `npm install`, or `bun install`"
1192+ placeholder = "e.g., `npm install`, `pnpm install`, or `bun install`"
11911193 onChange = { ( e ) => {
11921194 setBuildSettingsValues ( ( prev ) => ( {
11931195 ...prev ,
11941196 installCommand : e . target . value ,
11951197 } ) ) ;
11961198 } }
11971199 />
1198- < Hint > Command to install your project dependencies. Auto-detected by default.</ Hint >
1200+ < Hint >
1201+ Command to install your project dependencies. This will be run from the root directory
1202+ of your repo. Auto-detected by default.
1203+ </ Hint >
11991204 < FormError id = { fields . installCommand . errorId } > { fields . installCommand . error } </ FormError >
12001205 </ InputGroup >
12011206 < InputGroup fullWidth >
1202- < Label htmlFor = { fields . installDirectory . id } > Install directory </ Label >
1207+ < Label htmlFor = { fields . preBuildCommand . id } > Pre-build command </ Label >
12031208 < Input
1204- { ...conform . input ( fields . installDirectory , { type : "text" } ) }
1205- defaultValue = { buildSettings ?. installDirectory || "" }
1206- placeholder = ""
1209+ { ...conform . input ( fields . preBuildCommand , { type : "text" } ) }
1210+ defaultValue = { buildSettings ?. preBuildCommand || "" }
1211+ placeholder = "e.g., `npm run prisma:generate` "
12071212 onChange = { ( e ) => {
12081213 setBuildSettingsValues ( ( prev ) => ( {
12091214 ...prev ,
1210- installDirectory : e . target . value ,
1215+ preBuildCommand : e . target . value ,
12111216 } ) ) ;
12121217 } }
12131218 />
1214- < Hint > The directory where the install command is run in. Auto-detected by default.</ Hint >
1215- < FormError id = { fields . installDirectory . errorId } >
1216- { fields . installDirectory . error }
1217- </ FormError >
1219+ < Hint >
1220+ Any command that needs to run before we build and deploy your project. This will be run
1221+ from the root directory of your repo.
1222+ </ Hint >
1223+ < FormError id = { fields . preBuildCommand . errorId } > { fields . preBuildCommand . error } </ FormError >
12181224 </ InputGroup >
12191225 < FormError > { buildSettingsForm . error } </ FormError >
12201226 < FormButtons
0 commit comments