effect-build-nfpm
v0.8.0
Published
Effect-native nFPM system and MSIX package production.
Maintainers
Readme
effect-build-nfpm
Build Debian, RPM, Alpine, Arch Linux, and MSIX packages from artifacts with
nFPM, as Effect programs. Each package comes back as an
Artifact.File.
npm install --save-dev --save-exact [email protected] [email protected] @effect/[email protected] @effect/[email protected]nFPM 2.47 or newer must be installed.
Usage
import { Effect } from "effect";
import * as Nfpm from "effect-build-nfpm";
const deb = (executable: Artifact.Executable) =>
Nfpm.package({
format: "deb",
config: {
name: "hello",
version: "1.0.0",
arch: "amd64",
maintainer: "Release Team <[email protected]>",
description: "Hello CLI",
depends: ["ca-certificates"],
scripts: { postinstall: "packaging/postinstall.sh" },
},
contents: [{ artifact: executable, dst: "/usr/bin/hello" }],
outfile: "dist/hello_1.0.0_amd64.deb",
}).pipe(Effect.provide(Nfpm.layer()));package({ format, config, contents, outfile, cwd?, atomic?, onExists?, prefix? }) takes:
format:deb,rpm,apk,archlinux, ormsix.config: nFPM's native configuration as JSON, withname,version, andarchrequired.depends,platform, format-specific sections, lifecyclescripts,overrides, and environment expansion pass through, and nFPM validates them. Relative paths in the configuration resolve againstcwd. MSIX needs its nativeconfig.msixmetadata.contents:{ artifact, dst, mode? }for each regular artifact and its absolute destination. Verified bytes are copied privately before nFPM runs. Modes default to0755for executables and0644for files.
The operation owns contents and disable_globbing, which cannot appear in config or in
format overrides, and overrides cannot change arch or platform. Every executable's OS and
architecture must match the format and config.arch: MSIX requires Windows executables, and an
all or noarch package cannot contain an executable. ABI and minimum OS policy stay with the
project.
Versions
Nfpm.layer({ executable?, version? }) resolves nFPM once. Nfpm.supported is >=2.47.0 <3.0.0,
the versions accepting the JSON configuration, disable_globbing, and the MSIX packager used
here; Nfpm.tested is 2.47.0, exercised with every format. See
tools and providers.
Errors
Nfpm.PackageError is Tool.InputInvalid, Artifact.ArtifactError,
Tool.Failed, Tool.SpawnFailed, or Commit.CommitError. Nfpm.Format, Nfpm.Content,
Nfpm.Configuration, and Nfpm.PackageInput are exported as schemas.
