@hyperfrontend/workspace/executors/publish

publish

Publishes a library's build output to the npm registry, and skips a version the registry already has, so the same task can run again after a partial release.

{
  "publish": {
    "executor": "@hyperfrontend/workspace:publish",
    "dependsOn": ["build"]
  }
}
OptionWhat it does
--dryRunShows what would be published and uploads nothing
--registryThe registry; defaults to the one npm is configured with
--tagThe dist-tag; defaults to latest
--accessThe access of a scoped package; defaults to public
--otpA one-time password for two-factor publishing
--provenanceAttaches the provenance statement npm signs with the CI identity token

The token comes from NPM_TOKEN in the environment.

npx hf run my-utils:publish --dryRun

API Reference§

ƒ Functions

§function

publishExecutor(options: PublishExecutorOptions, context: ExecutorContext): Promise<ExecutorResult>

Publish executor for the libraries of a workspace.
Publishes a library's build output, wherever its build target writes it, to the npm registry with support for:
  • Dry-run mode to preview what would be published
  • Custom registry URL
  • NPM dist-tags
  • Scope access control
  • 2FA OTP support
Parameters
NameTypeDescription
§options
PublishExecutorOptionsOptions for the publish executor
§context
ExecutorContextThe workspace, the project and the target the task runs on
Returns
Promise<ExecutorResult>
Success status
Example

A `publish` target run after the build

{
  "targets": {
    "publish": {
      "executor": "@hyperfrontend/workspace:publish",
      "dependsOn": ["build"],
      "options": { "access": "public", "tag": "latest", "provenance": true }
    }
  }
}
```
`npx hf run lib-core:publish --dryRun` previews the npm command; a version the registry already has is skipped with success.

◈ Interfaces

§interface

PublishExecutorOptions

Options for the publish executor.
Properties
§dryRun?:booleanRun in dry-run mode without actually publishing
§registry?:stringCustom npm registry URL
§tag?:stringNPM dist-tag to publish with
§access?:"public" | "restricted"Publish access level for scoped packages
§otp?:stringOne-time password for npm 2FA
§provenance?:booleanAttach a provenance statement signed with the CI identity token