On this page
deno publish
deno publish 会将您的包发布到 JSR 注册表。
包要求 Jump to heading
您的包必须在其 deno.json 或 jsr.json 文件中包含 name、version 和 exports 字段。
name字段必须是唯一的,并遵循@<scope_name>/<package_name>约定。version字段必须是有效的 semver 版本。若要在发布流程中自动递增版本,请参阅deno bump-version。exports字段必须指向包的主入口点。exports字段可以指定为单个字符串,或指定为一个将入口点名称映射到您包中路径的对象。
示例:
{
"name": "@scope_name/package_name",
"version": "1.0.0",
"exports": "./main.ts"
}
在您发布包之前,必须先通过访问 JSR - 发布一个包 在注册表中创建它。
排除工作区成员 Jump to heading
在 workspace 中运行时,deno publish 会尝试发布所有具有 name 和 exports 的成员,并在其中任何一个缺少 version 时报告错误。若要排除某个成员,例如仅用于承载共享 tasks 的内部辅助包,请在该成员的 deno.json 中设置 "publish": false:
{
"name": "@scope/internal-helpers",
"publish": false
}
该成员仍然属于工作区,但会被 deno publish 跳过。请参阅从发布中排除工作区成员
了解完整讨论。
示例 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
deno publish [OPTIONS]Publish the current working directory's package or workspace to JSR
Publishing options Jump to heading
--allow-dirtyAllow publishing if the repository has uncommitted changed.
--allow-slow-typesAllow publishing with slow types.
--dry-runPrepare the package for publishing performing all checks and validations without uploading.
--no-provenanceDisable provenance attestation. Enabled by default on Github actions, publicly links the package to where it was built and published from.
--set-version<VERSION>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>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-configDisable automatic loading of the configuration file.
Type checking options Jump to heading
--check<CHECK_TYPE>optionalSet 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>optionalSkip type-checking. If the value of "remote" is supplied, diagnostic errors from remote modules will be ignored.