Skip to content

Commit 9e17b05

Browse files
authored
Merge pull request #3157 from appwrite/fix/sites-hide-start-command
Keep the start command field, drop the adapter reads behind it
2 parents ee7514c + 6fa8402 commit 9e17b05

7 files changed

Lines changed: 55 additions & 39 deletions

File tree

bun.lock

Lines changed: 6 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"flatted": "^3.4.2",
5252
"ignore": "^6.0.2",
5353
"json5": "^2.2.3",
54-
"nanoid": "^5.1.16",
54+
"nanoid": "^3.3.18",
5555
"nanotar": "^0.3.0",
5656
"pretty-bytes": "^6.1.1",
5757
"remarkable": "^2.0.1",
@@ -113,6 +113,7 @@
113113
"picomatch": "^4.0.4",
114114
"cookie": "^0.7.0",
115115
"ws": "^8.21.0",
116-
"postcss": "^8.5.18"
116+
"postcss": "^8.5.18",
117+
"nanoid": "^3.3.18"
117118
}
118119
}

src/routes/(console)/project-[region]-[project]/sites/create-site/configuration.svelte

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
export let isLoading = false;
1818
export let installCommand = '';
1919
export let buildCommand = '';
20+
export let startCommand = '';
2021
export let outputDirectory = '';
2122
2223
let frameworkId = selectedFramework.key;
@@ -27,6 +28,7 @@
2728
installCommand = adapterData?.installCommand ?? '';
2829
buildCommand = adapterData?.buildCommand ?? '';
2930
outputDirectory = adapterData?.outputDirectory ?? '';
31+
startCommand = '';
3032
lastAdapterDefaultsKey = adapterDefaultsKey;
3133
}
3234
</script>
@@ -83,6 +85,15 @@
8385
Reset
8486
</Button>
8587
</Layout.Stack>
88+
{#if adapterData?.key === 'ssr'}
89+
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
90+
<InputText
91+
id="startCommand"
92+
label="Start command"
93+
bind:value={startCommand}
94+
placeholder="Enter start command" />
95+
</Layout.Stack>
96+
{/if}
8697
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
8798
<InputText
8899
id="outputDirectory"

src/routes/(console)/project-[region]-[project]/sites/create-site/deploy/+page.svelte

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
let domain = $state('');
4646
let rootDir = $state(data.repository?.rootDirectory || '');
4747
let buildCommand = $state('');
48+
let startCommand = $state('');
4849
let installCommand = $state('');
4950
let outputDirectory = $state('');
5051
let domainIsValid = $state(false);
@@ -80,6 +81,11 @@
8081
}))
8182
);
8283
84+
const primaryAdapter = $derived.by(
85+
() => data.frameworks.frameworks.find((f) => f.key === framework)?.adapters?.[0]
86+
);
87+
const shouldShowStartCommand = $derived(primaryAdapter?.key === Adapter.Ssr);
88+
8389
$effect(() => {
8490
if (framework && data.frameworks && !hasCustomCommands) {
8591
const fw = data.frameworks.frameworks.find((f) => f.key === framework);
@@ -103,10 +109,11 @@
103109
// Build configuration - use from URL params or defaults
104110
installCommand = page.url.searchParams.get('install') || '';
105111
buildCommand = page.url.searchParams.get('build') || '';
112+
startCommand = page.url.searchParams.get('start') || '';
106113
outputDirectory = page.url.searchParams.get('output') || '';
107114
108115
// Check if custom commands were provided via URL
109-
hasCustomCommands = !!(installCommand || buildCommand || outputDirectory);
116+
hasCustomCommands = !!(installCommand || buildCommand || startCommand || outputDirectory);
110117
111118
// If no custom commands, auto-fill from framework defaults
112119
if (!hasCustomCommands && data.frameworks) {
@@ -145,6 +152,7 @@
145152
buildRuntime: selectedFramework.buildRuntime,
146153
installCommand: installCommand || undefined,
147154
buildCommand: buildCommand || undefined,
155+
startCommand: shouldShowStartCommand ? startCommand || undefined : undefined,
148156
outputDirectory: outputDirectory || undefined,
149157
adapter: framework === Framework.Other ? Adapter.Static : undefined,
150158
providerSilentMode: false
@@ -253,7 +261,8 @@
253261
label="Framework"
254262
placeholder="Select framework"
255263
bind:value={framework}
256-
options={frameworkSelectOptions} />
264+
options={frameworkSelectOptions}
265+
on:change={() => (startCommand = '')} />
257266
</Layout.Stack>
258267
</Fieldset>
259268

@@ -273,6 +282,12 @@
273282
label="Build command"
274283
placeholder={buildCommand || 'npm run build'}
275284
bind:value={buildCommand} />
285+
{#if shouldShowStartCommand}
286+
<Input.Text
287+
label="Start command"
288+
placeholder={startCommand || 'npm run start'}
289+
bind:value={startCommand} />
290+
{/if}
276291
<Input.Text
277292
label="Output directory"
278293
placeholder={outputDirectory || 'dist'}

src/routes/(console)/project-[region]-[project]/sites/create-site/manual/+page.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
let adapter = framework?.adapters[0];
4444
let installCommand = adapter?.installCommand;
4545
let buildCommand = adapter?.buildCommand;
46+
let startCommand = '';
4647
let outputDirectory = adapter?.outputDirectory;
4748
let variables: Partial<Models.Variable>[] = [];
4849
let files: FileList;
@@ -77,6 +78,7 @@
7778
buildRuntime,
7879
installCommand: installCommand || undefined,
7980
buildCommand: buildCommand || undefined,
81+
startCommand: startCommand || undefined,
8082
outputDirectory: outputDirectory || undefined
8183
});
8284
@@ -251,6 +253,7 @@
251253
<Configuration
252254
bind:installCommand
253255
bind:buildCommand
256+
bind:startCommand
254257
bind:outputDirectory
255258
bind:selectedFramework={framework}
256259
bind:variables

src/routes/(console)/project-[region]-[project]/sites/create-site/repositories/repository-[repository]/+page.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
let rootDir = './';
4444
let installCommand = adapter?.installCommand;
4545
let buildCommand = adapter?.buildCommand;
46+
let startCommand = '';
4647
let outputDirectory = adapter?.outputDirectory;
4748
let variables: Partial<Models.Variable>[] = [];
4849
let silentMode = false;
@@ -121,6 +122,7 @@
121122
buildRuntime,
122123
installCommand: installCommand || undefined,
123124
buildCommand: buildCommand || undefined,
125+
startCommand: startCommand || undefined,
124126
outputDirectory: outputDirectory || undefined,
125127
installationId: data.installation.$id,
126128
providerRepositoryId: data.repository.id,
@@ -219,6 +221,7 @@
219221
<Configuration
220222
bind:installCommand
221223
bind:buildCommand
224+
bind:startCommand
222225
bind:outputDirectory
223226
bind:selectedFramework={framework}
224227
bind:variables

src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@
77
import { addNotification } from '$lib/stores/notifications';
88
import { sdk } from '$lib/stores/sdk';
99
import { Adapter, BuildRuntime, Framework, type Models } from '@appwrite.io/console';
10-
import {
11-
Accordion,
12-
Card,
13-
Fieldset,
14-
Icon,
15-
InlineCode,
16-
Layout,
17-
Tooltip
18-
} from '@appwrite.io/pink-svelte';
10+
import { Card, Fieldset, Icon, InlineCode, Layout, Tooltip } from '@appwrite.io/pink-svelte';
1911
import { iconPath } from '$lib/stores/app';
2012
import { Link } from '$lib/elements';
2113
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
@@ -89,10 +81,10 @@
8981
selectedFramework.adapters[0];
9082
installCommand = data.installCommand;
9183
buildCommand = data.buildCommand;
84+
startCommand = '';
9285
outputDirectory = data.outputDirectory;
9386
adapter = data.key as Adapter;
9487
fallback = data.fallbackFile;
95-
startCommand = '';
9688
} else if (hasFrameworkSelectionChanged) {
9789
const data =
9890
selectedFramework.adapters.find((a) => a.key === adapter) ??
@@ -105,13 +97,13 @@
10597
buildCommand = isOriginalAdapter
10698
? (site?.buildCommand ?? frameworkAdapterData.buildCommand)
10799
: data.buildCommand;
100+
startCommand = isOriginalAdapter ? (site?.startCommand ?? '') : '';
108101
outputDirectory = isOriginalAdapter
109102
? (site?.outputDirectory ?? frameworkAdapterData.outputDirectory)
110103
: data.outputDirectory;
111104
fallback = isOriginalAdapter
112105
? (site?.fallbackFile ?? data.fallbackFile)
113106
: data.fallbackFile;
114-
startCommand = isOriginalAdapter ? (site?.startCommand ?? '') : '';
115107
}
116108
117109
lastFrameworkAdapterKey = `${selectedFramework.key}:${adapter ?? ''}`;
@@ -335,6 +327,15 @@
335327
Reset
336328
</Button>
337329
</Layout.Stack>
330+
{#if adapter === Adapter.Ssr}
331+
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
332+
<InputText
333+
id="startCommand"
334+
label="Start command"
335+
bind:value={startCommand}
336+
placeholder="Enter start command" />
337+
</Layout.Stack>
338+
{/if}
338339
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
339340
<InputText
340341
id="outputDirectory"
@@ -366,19 +367,6 @@
366367
</Tooltip>
367368
</InputText>
368369
{/if}
369-
{#if adapter === Adapter.Ssr}
370-
<Accordion title="Advanced">
371-
<Layout.Stack gap="l">
372-
Command used to start your SSR server after a successful deploy.
373-
Leave it empty to use the framework default.
374-
<InputText
375-
id="startCommand"
376-
label="Start command"
377-
bind:value={startCommand}
378-
placeholder="Enter start command" />
379-
</Layout.Stack>
380-
</Accordion>
381-
{/if}
382370
</Layout.Stack>
383371
</Fieldset>
384372
</Layout.Stack>

0 commit comments

Comments
 (0)