Skip to content

Commit 6590e5e

Browse files
committed
homelink & sv link
1 parent cd3b623 commit 6590e5e

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

apps/svelte.dev/src/lib/server/content.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ export interface Package {
209209

210210
typescript: boolean;
211211

212-
svCmd?: string;
213-
main_url?: string;
212+
svCmdAlias?: string;
213+
svCmdOptions?: string;
214214
}
215215

216216
/**

apps/svelte.dev/src/routes/packages/+page.server.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ const arrToPackages = (arr: string[]) => {
88
.map((name) => {
99
const pkg = registry.find((pkg) => pkg.name === name) ?? null;
1010
if (pkg) {
11-
pkg.main_url = pkg.homepage;
1211
const cmd = PACKAGES_META.SV_ADD_CMD[pkg.name];
1312
if (cmd) {
14-
pkg.svCmd = `npx sv add ${cmd.alias}${cmd.options ? `=${cmd.options}` : ''}`;
15-
pkg.main_url = `/docs/cli/${cmd.alias}`;
13+
pkg.svCmdAlias = cmd.alias;
14+
pkg.svCmdOptions = cmd.options;
1615
}
1716
}
1817

apps/svelte.dev/src/routes/packages/PackageCard.svelte

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
</h3>
2525
{/snippet}
2626

27-
{#if pkg.main_url}
27+
{#if pkg.homepage}
2828
<a
29-
href={pkg.main_url}
29+
href={pkg.homepage}
3030
target="_blank"
3131
rel="noreferrer"
3232
aria-label="View project homepage"
@@ -45,9 +45,16 @@
4545

4646
<p class="description">{pkg.description}</p>
4747

48-
{#if pkg.svCmd}
48+
{#if pkg.svCmdAlias}
4949
<span class="sv-cmd">
50-
{pkg.svCmd}
50+
npx sv add {pkg.svCmdAlias}{pkg.svCmdOptions ? `=${pkg.svCmdOptions}` : ''}
51+
<a
52+
href={`/docs/cli/${pkg.svCmdAlias}`}
53+
target="_blank"
54+
rel="noreferrer"
55+
aria-label="View Svelte CLI docs"
56+
data-icon="external-link"
57+
></a>
5158
</span>
5259
{/if}
5360
<p class="stats">
@@ -221,7 +228,10 @@
221228
}
222229
223230
.sv-cmd {
224-
display: inline-block;
231+
display: inline-flex;
232+
gap: 0.4rem;
233+
align-items: center;
234+
justify-content: space-between;
225235
font: var(--sk-font-ui-small);
226236
color: var(--sk-fg-3);
227237
background: var(--sk-bg-3);

0 commit comments

Comments
 (0)