-
Notifications
You must be signed in to change notification settings - Fork 251
fix(sites): stop reading the framework start command #3156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,12 +7,20 @@ | |
| import { addNotification } from '$lib/stores/notifications'; | ||
| import { sdk } from '$lib/stores/sdk'; | ||
| import { Adapter, BuildRuntime, Framework, type Models } from '@appwrite.io/console'; | ||
| import { Card, Fieldset, Icon, InlineCode, Layout, Tooltip } from '@appwrite.io/pink-svelte'; | ||
| import { | ||
| Accordion, | ||
| Card, | ||
| Fieldset, | ||
| Icon, | ||
| InlineCode, | ||
| Layout, | ||
| Tooltip | ||
| } from '@appwrite.io/pink-svelte'; | ||
| import { iconPath } from '$lib/stores/app'; | ||
| import { Link } from '$lib/elements'; | ||
| import { IconInfo } from '@appwrite.io/pink-icons-svelte'; | ||
| import { adapterDataList } from './store'; | ||
| import { getFrameworkIcon, type FrameworkAdapterWithStartCommand } from '$lib/stores/sites'; | ||
| import { getFrameworkIcon } from '$lib/stores/sites'; | ||
| import { page } from '$app/state'; | ||
|
|
||
| let { | ||
|
|
@@ -50,9 +58,8 @@ | |
| (fallback ?? '') === (site?.fallbackFile ?? '') && | ||
| (adapter ?? '') === (site?.adapter ?? '') | ||
| ); | ||
| let frameworkAdapterData: FrameworkAdapterWithStartCommand = $derived( | ||
| (selectedFramework.adapters.find((a) => a.key === adapter) ?? | ||
| selectedFramework.adapters[0]) as FrameworkAdapterWithStartCommand | ||
| let frameworkAdapterData = $derived( | ||
| selectedFramework.adapters.find((a) => a.key === adapter) ?? selectedFramework.adapters[0] | ||
| ); | ||
|
|
||
| $effect(() => { | ||
|
|
@@ -77,17 +84,19 @@ | |
| } | ||
|
|
||
| //Update values | ||
| const data = (selectedFramework.adapters.find((a) => a.key === adapter) ?? | ||
| selectedFramework.adapters[0]) as FrameworkAdapterWithStartCommand; | ||
| const data = | ||
| selectedFramework.adapters.find((a) => a.key === adapter) ?? | ||
| selectedFramework.adapters[0]; | ||
| installCommand = data.installCommand; | ||
| buildCommand = data.buildCommand; | ||
| startCommand = data.startCommand; | ||
| outputDirectory = data.outputDirectory; | ||
| adapter = data.key as Adapter; | ||
| fallback = data.fallbackFile; | ||
| startCommand = ''; | ||
| } else if (hasFrameworkSelectionChanged) { | ||
| const data = (selectedFramework.adapters.find((a) => a.key === adapter) ?? | ||
| selectedFramework.adapters[0]) as FrameworkAdapterWithStartCommand; | ||
| const data = | ||
| selectedFramework.adapters.find((a) => a.key === adapter) ?? | ||
| selectedFramework.adapters[0]; | ||
| const isOriginalAdapter = adapter === site.adapter; | ||
|
|
||
| installCommand = isOriginalAdapter | ||
|
|
@@ -96,15 +105,13 @@ | |
| buildCommand = isOriginalAdapter | ||
| ? (site?.buildCommand ?? frameworkAdapterData.buildCommand) | ||
| : data.buildCommand; | ||
| startCommand = isOriginalAdapter | ||
| ? (site?.startCommand ?? frameworkAdapterData.startCommand) | ||
| : data.startCommand; | ||
| outputDirectory = isOriginalAdapter | ||
| ? (site?.outputDirectory ?? frameworkAdapterData.outputDirectory) | ||
| : data.outputDirectory; | ||
| fallback = isOriginalAdapter | ||
| ? (site?.fallbackFile ?? data.fallbackFile) | ||
| : data.fallbackFile; | ||
| startCommand = isOriginalAdapter ? (site?.startCommand ?? '') : ''; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an SSR site is changed to another framework and its adapter is then changed away from and back to SSR, this branch restores Knowledge Base Used: Functions and Sites Prompt To Fix With AIThis is a comment left during a code review.
Path: src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte
Line: 114
Comment:
**Old start command gets restored**
When an SSR site is changed to another framework and its adapter is then changed away from and back to SSR, this branch restores `site.startCommand` solely because the adapter key matches the original adapter. The subsequent update submits the old framework's command for the newly selected framework, causing deployments to use an incompatible entrypoint.
**Knowledge Base Used:** [Functions and Sites](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/console/-/docs/project-functions-sites.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly. |
||
| } | ||
|
|
||
| lastFrameworkAdapterKey = `${selectedFramework.key}:${adapter ?? ''}`; | ||
|
|
@@ -162,7 +169,7 @@ | |
| timeout: site.timeout || undefined, | ||
| installCommand: installCommand || undefined, | ||
| buildCommand: buildCommand || undefined, | ||
| startCommand: startCommand || undefined, | ||
| startCommand: adptr?.key === 'ssr' ? startCommand || undefined : undefined, | ||
| outputDirectory: outputDirectory || undefined, | ||
| buildRuntime: (site?.buildRuntime as BuildRuntime) || undefined, | ||
| adapter: (adptr?.key as Adapter) || undefined, | ||
|
|
@@ -193,17 +200,13 @@ | |
| } | ||
| } | ||
|
|
||
| function reset(type: 'installCommand' | 'buildCommand' | 'startCommand' | 'outputDirectory') { | ||
| const data = selectedFramework.adapters.find( | ||
| (a) => a.key === adapter | ||
| ) as FrameworkAdapterWithStartCommand; | ||
| function reset(type: 'installCommand' | 'buildCommand' | 'outputDirectory') { | ||
| const data = selectedFramework.adapters.find((a) => a.key === adapter); | ||
|
|
||
| if (type === 'installCommand') { | ||
| installCommand = data.installCommand; | ||
| } else if (type === 'buildCommand') { | ||
| buildCommand = data.buildCommand; | ||
| } else if (type === 'startCommand') { | ||
| startCommand = data.startCommand; | ||
| } else if (type === 'outputDirectory') { | ||
| outputDirectory = data.outputDirectory; | ||
| } | ||
|
|
@@ -332,24 +335,6 @@ | |
| Reset | ||
| </Button> | ||
| </Layout.Stack> | ||
| {#if adapter === Adapter.Ssr} | ||
| <Layout.Stack gap="s" direction="row" alignItems="flex-end"> | ||
| <InputText | ||
| id="startCommand" | ||
| label="Start command" | ||
| bind:value={startCommand} | ||
| placeholder={frameworkAdapterData?.startCommand || | ||
| 'Enter start command'} /> | ||
| <Button | ||
| secondary | ||
| size="s" | ||
| disabled={(startCommand ?? '') === | ||
| (frameworkAdapterData?.startCommand ?? '')} | ||
| on:click={() => reset('startCommand')}> | ||
| Reset | ||
| </Button> | ||
| </Layout.Stack> | ||
| {/if} | ||
| <Layout.Stack gap="s" direction="row" alignItems="flex-end"> | ||
| <InputText | ||
| id="outputDirectory" | ||
|
|
@@ -381,6 +366,19 @@ | |
| </Tooltip> | ||
| </InputText> | ||
| {/if} | ||
| {#if adapter === Adapter.Ssr} | ||
| <Accordion title="Advanced"> | ||
| <Layout.Stack gap="l"> | ||
| Command used to start your SSR server after a successful deploy. | ||
| Leave it empty to use the framework default. | ||
| <InputText | ||
| id="startCommand" | ||
| label="Start command" | ||
| bind:value={startCommand} | ||
| placeholder="Enter start command" /> | ||
| </Layout.Stack> | ||
| </Accordion> | ||
| {/if} | ||
| </Layout.Stack> | ||
| </Fieldset> | ||
| </Layout.Stack> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.