Tools
fb publish
Publishes a package to a registry.
fb publish [options] [package folder]fb publish builds a library’s archives into build/package/ and its docs, checks them as the
registry does, and uploads them. The registry checks that the package:
- is a library, since an executable can’t be a dependency;
- has a name the registry takes, a description, and a
licensethat’s an SPDX expression; - has a license file and a readme, a UTF-8 file under 1 MB;
- depends only on versioned packages, not on a
path; - has a version that hasn’t been published before.
It needs a token: fb login’s, or FB_REGISTRY_TOKEN’s. In a GitHub
Actions workflow that the package trusts, it needs neither: fb gets a short-lived token from GitHub,
as Publishing from GitHub Actions shows.
Trusted publishing publishes new versions of a package that’s on the registry, so fb refuses a
new package’s first version that way before it uploads anything; that one comes from fb login
or FB_REGISTRY_TOKEN.
Packaged gives each archive’s files and size, in decimal units: bytes, then KB and MB of 1,000
and 1,000,000 bytes, as 454 B or 1.2 KB. Uploading gives the same size again as it sends the
archive to a registry on the network. --offline works only with --dry-run: without it, fb
refuses, since publishing sends the package to the registry.
Options
| Option | |
|---|---|
--registry <name> | A registry that project.toml’s [registries] names, or an index’s URL or folder. Without it, futureblitz.dev’s, or the mirror [registries] names for futureblitz, if there is one. |
--dry-run | Builds and checks the archives, and lists their files, without uploading them |
--offline | With --dry-run, uses only what’s in the cache |
--color <when> | Colors the output: auto, always, or never |
Examples
A library, with its license and readme beside its code:
[project]
name = "stopwatch"
version = "0.1.0"
type = "library"
license = "MIT"
description = "Times what a program does."//! Times what a program does.
Import std.core
/// How many whole seconds `milliseconds` is.
Public Function Seconds(milliseconds: Long): Long => milliseconds / 1000Copyright (c) the stopwatch authors. Anyone may use, copy, and change this software.# stopwatch
Times what a program does.--dry-run checks it and lists what would be uploaded, and then it’s published:
fb publish --dry-run
fb publish Packaging stopwatch v0.1.0 (C:/Users/ada/stopwatch)
Packaged stopwatch-0.1.0.fbpkg: 4 files, 454 B
stopwatch-0.1.0.fbpkg LICENSE
stopwatch-0.1.0.fbpkg README.md
stopwatch-0.1.0.fbpkg project.toml
stopwatch-0.1.0.fbpkg stopwatch.fb
Finished the dry run of stopwatch v0.1.0; nothing was published to https://index.futureblitz.dev/
Packaging stopwatch v0.1.0 (C:/Users/ada/stopwatch)
Packaged stopwatch-0.1.0.fbpkg: 4 files, 454 B
Publishing stopwatch v0.1.0 to https://index.futureblitz.dev/
Published stopwatch v0.1.0Writing a package goes from fb new to a published
version.
Report an issue with this page or with FutureBlitz on GitHub.