Skip to content

Commit

Permalink
Simplifying installation guide now that Deno supports installing from…
Browse files Browse the repository at this point in the history
… npm (#3859)

* Simplify install guide 

Since Deno now supports installing directly from npm, we can streamline the install guide

* Update deno install info in translation
  • Loading branch information
philhawksworth authored Dec 10, 2024
1 parent 14dceaa commit d50976a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 30 deletions.
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
- [Utilities for Zod](#utilities-for-zod)
- [Installation](#installation)
- [Requirements](#requirements)
- [From `npm` (Node/Bun)](#from-npm-nodebun)
- [From `deno.land/x` (Deno)](#from-denolandx-deno)
- [From `npm`](#from-npm)
- [Basic usage](#basic-usage)
- [Primitives](#primitives)
- [Coercion for primitives](#coercion-for-primitives)
Expand Down Expand Up @@ -594,10 +593,11 @@ There are a growing number of tools that are built atop or support Zod natively!
}
```

### From `npm` (Node/Bun)
### From `npm`

```sh
npm install zod # npm
deno add npm:zod # deno
yarn add zod # yarn
bun add zod # bun
pnpm add zod # pnpm
Expand All @@ -607,24 +607,12 @@ Zod also publishes a canary version on every commit. To install the canary:

```sh
npm install zod@canary # npm
deno add npm:zod@canary # deno
yarn add zod@canary # yarn
bun add zod@canary # bun
pnpm add zod@canary # pnpm
```

### From `deno.land/x` (Deno)

Unlike Node, Deno relies on direct URL imports instead of a package manager like NPM. Zod is available on [deno.land/x](https://deno.land/x). The latest version can be imported like so:

```ts
import { z } from "https://deno.land/x/zod/mod.ts";
```

You can also specify a particular version:

```ts
import { z } from "https://deno.land/x/[email protected]/mod.ts";
```

> The rest of this README assumes you are using npm and importing directly from the `"zod"` package.
Expand Down
16 changes: 2 additions & 14 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,28 +316,16 @@ _要在这里看到你的名字 + Twitter + 網站 , 请在[Freelancer](https://
}
```

### `npm`(Node/Bun)安装
### `npm` 安装

```sh
npm install zod
deno add npm:zod # deno
yarn add zod # yarn
bun add zod # bun
pnpm add zod # pnpm
```

### `deno.land/x` (Deno)安装

和 Node 不同,Deno 依靠一个直接的 URL 导入而非像 npm 这样的包管理器。可以这样导入最新版本的 Zod:

```ts
import { z } from "https://deno.land/x/zod/mod.ts";
```

你也可以指定一个具体的版本:

```ts
import { z } from "https://deno.land/x/[email protected]/mod.ts";
```

> README 的剩余部分假定你是直接通过 npm 安装的`zod`包。
Expand Down

0 comments on commit d50976a

Please sign in to comment.