Skip to main content
On this page

deno publish

deno publish 会将您的包发布到 JSR 注册表。

包要求 Jump to heading

您的包必须在其 deno.jsonjsr.json 文件中包含 nameversionexports 字段。

  • name 字段必须是唯一的,并遵循 @<scope_name>/<package_name> 约定。
  • version 字段必须是有效的 semver 版本。
  • exports 字段必须指向包的主要入口点。exports 字段可以指定为一个字符串,或者作为一个对象,将入口点名称映射到您包中的路径。

示例:

deno.json
{
  "name": "@scope_name/package_name",
  "version": "1.0.0",
  "exports": "./main.ts"
}

在您发布包之前,您必须通过访问 JSR - 发布一个包 在注册表中创建它。

示例 Jump to heading

发布您当前的工作区

>_
deno publish

使用特定令牌发布您当前的工作区,跳过交互式身份验证

>_
deno publish --token c00921b1-0d4f-4d18-b8c8-ac98227f9275

发布并检查远程模块中的错误

>_
deno publish --check=all

执行干运行以模拟发布。

>_
deno publish --dry-run

使用特定配置文件中的设置发布

>_
deno publish --config custom-config.json
Command line usage:
deno publish [OPTIONS]

Publish the current working directory's package or workspace to JSR

Publishing options Jump to heading

--allow-dirty
Jump to heading

Allow publishing if the repository has uncommitted changed.

--allow-slow-types
Jump to heading

Allow publishing with slow types.

Prepare the package for publishing performing all checks and validations without uploading.

--no-provenance
Jump to heading

Disable provenance attestation. Enabled by default on Github actions, publicly links the package to where it was built and published from.

--set-version<VERSION>
Jump to heading

Set version for a package to be published. This flag can be used while publishing individual packages and cannot be used in a workspace.

--token<token>
Jump to heading

The API token to use when publishing. If unset, interactive authentication is be used.

Options Jump to heading

Configure different aspects of deno including TypeScript, linting, and code formatting. Typically the configuration file will be called deno.json or deno.jsonc and automatically detected; in that case this flag is not necessary.

--no-config
Jump to heading

Disable automatic loading of the configuration file.

Type checking options Jump to heading

--check<CHECK_TYPE>optional
Jump to heading

Set type-checking behavior. This subcommand type-checks local modules by default, so adding --check is redundant If the value of "all" is supplied, remote modules will be included. Alternatively, the 'deno check' subcommand can be used.

--no-check<NO_CHECK_TYPE>optional
Jump to heading

Skip type-checking. If the value of "remote" is supplied, diagnostic errors from remote modules will be ignored.

Last updated on

你找到了你需要的东西吗?

编辑此页面
隐私政策