diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx index 1ba5f26407..bb75af34fe 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx @@ -156,23 +156,25 @@ const UpdateBuildSettingsFormSchema = z.object({ .refine((val) => !val || val.length <= 255, { message: "Config file path must not exceed 255 characters", }), - installDirectory: z + installCommand: z .string() .trim() .optional() - .transform((val) => (val ? val.replace(/^\/+/, "") : val)) - .refine((val) => !val || val.length <= 255, { - message: "Install directory must not exceed 255 characters", + .refine((val) => !val || !val.includes("\n"), { + message: "Install command must be a single line", + }) + .refine((val) => !val || val.length <= 500, { + message: "Install command must not exceed 500 characters", }), - installCommand: z + preBuildCommand: z .string() .trim() .optional() .refine((val) => !val || !val.includes("\n"), { - message: "Install command must be a single line", + message: "Pre-build command must be a single line", }) .refine((val) => !val || val.length <= 500, { - message: "Install command must not exceed 500 characters", + message: "Pre-build command must not exceed 500 characters", }), }); @@ -401,11 +403,11 @@ export const action: ActionFunction = async ({ request, params }) => { }); } case "update-build-settings": { - const { installDirectory, installCommand, triggerConfigFilePath } = submission.value; + const { installCommand, preBuildCommand, triggerConfigFilePath } = submission.value; const resultOrFail = await projectSettingsService.updateBuildSettings(projectId, { - installDirectory: installDirectory || undefined, installCommand: installCommand || undefined, + preBuildCommand: preBuildCommand || undefined, triggerConfigFilePath: triggerConfigFilePath || undefined, }); @@ -1100,14 +1102,14 @@ function BuildSettingsForm({ buildSettings }: { buildSettings: BuildSettings }) const [hasBuildSettingsChanges, setHasBuildSettingsChanges] = useState(false); const [buildSettingsValues, setBuildSettingsValues] = useState({ - installDirectory: buildSettings?.installDirectory || "", + preBuildCommand: buildSettings?.preBuildCommand || "", installCommand: buildSettings?.installCommand || "", triggerConfigFilePath: buildSettings?.triggerConfigFilePath || "", }); useEffect(() => { const hasChanges = - buildSettingsValues.installDirectory !== (buildSettings?.installDirectory || "") || + buildSettingsValues.preBuildCommand !== (buildSettings?.preBuildCommand || "") || buildSettingsValues.installCommand !== (buildSettings?.installCommand || "") || buildSettingsValues.triggerConfigFilePath !== (buildSettings?.triggerConfigFilePath || ""); setHasBuildSettingsChanges(hasChanges); @@ -1157,7 +1159,7 @@ function BuildSettingsForm({ buildSettings }: { buildSettings: BuildSettings }) { setBuildSettingsValues((prev) => ({ ...prev, @@ -1165,26 +1167,30 @@ function BuildSettingsForm({ buildSettings }: { buildSettings: BuildSettings }) })); }} /> - Command to install your project dependencies. Auto-detected by default. + + Command to install your project dependencies. This will be run from the root directory + of your repo. Auto-detected by default. + {fields.installCommand.error} - + { setBuildSettingsValues((prev) => ({ ...prev, - installDirectory: e.target.value, + preBuildCommand: e.target.value, })); }} /> - The directory where the install command is run in. Auto-detected by default. - - {fields.installDirectory.error} - + + Any command that needs to run before we build and deploy your project. This will be run + from the root directory of your repo. + + {fields.preBuildCommand.error} {buildSettingsForm.error} ;