Skip to content

Commit

Permalink
Add deno setup info (trpc#6283)
Browse files Browse the repository at this point in the history
* update install snippet to inlcude deno install command

* add deno variant of example app installation

* chore: apply lint and formatting fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
philhawksworth and autofix-ci[bot] authored Dec 16, 2024
1 parent c7934c0 commit 8a31dd6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ pnpm create next-app --example https://github.com/trpc/trpc --example-path examp

# bun
bunx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter trpc-prisma-starter

# deno
deno init --npm next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter trpc-prisma-starter
```

**👉 See full documentation on [tRPC.io](https://trpc.io/docs). 👈**
Expand Down
21 changes: 21 additions & 0 deletions www/docs/main/example-apps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ pnpx create-next-app --example https://github.com/trpc/trpc --example-path examp

```sh
bunx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter trpc-prisma-starter
```

</TabItem>
<TabItem value="deno" label="deno">

```sh
deno init --npm next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter trpc-prisma-starter
```

</TabItem>
Expand Down Expand Up @@ -100,6 +107,13 @@ pnpx create-next-app --example https://github.com/trpc/trpc --example-path examp

```sh
bunx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-websockets-starter trpc-prisma-websockets-starter
```

</TabItem>
<TabItem value="deno" label="deno">

```sh
deno init --npm create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-websockets-starter trpc-prisma-websockets-starter
```

</TabItem>
Expand Down Expand Up @@ -139,6 +153,13 @@ pnpx create-next-app --example https://github.com/trpc/trpc --example-path examp

```sh
bunx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-todomvc trpc-todo
```

</TabItem>
<TabItem value="deno" label="deno">

```sh
deno init --npm next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-todomvc trpc-todo
```

</TabItem>
Expand Down
4 changes: 4 additions & 0 deletions www/src/components/InstallSnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import React from 'react';

export function InstallSnippet(props: { pkgs: string[] | string }) {
const pkgs = Array.isArray(props.pkgs) ? props.pkgs.join(' ') : props.pkgs;
const pkgsDeno = Array.isArray(props.pkgs)
? `npm:${props.pkgs.join(' npm:')}`
: `npm:${props.pkgs.split(' ').join(' npm:')}`;

const snippets: Record<string, string> = {
npm: `npm install ${pkgs}`,
yarn: `yarn add ${pkgs}`,
pnpm: `pnpm add ${pkgs}`,
bun: `bun add ${pkgs}`,
deno: `deno add ${pkgsDeno}`,
};
return (
<Tabs>
Expand Down

0 comments on commit 8a31dd6

Please sign in to comment.