-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplifying installation guide now that Deno supports installing from…
… 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
1 parent
14dceaa
commit d50976a
Showing
2 changed files
with
6 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
@@ -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 | ||
|
@@ -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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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`包。 | ||
|