From 1012253460a2ea9ffd572ba155cee15f5f9ed4a6 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2026 17:07:36 +0000 Subject: [PATCH 1/6] docs: document fern generate --package, --package-mode, and --package-only Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../cli-api-reference/pages/commands.mdx | 31 ++++++++++++++++++- fern/products/sdks/deep-dives/self-hosted.mdx | 2 ++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx index fca845fbb..2ef311fb6 100644 --- a/fern/products/cli-api-reference/pages/commands.mdx +++ b/fern/products/cli-api-reference/pages/commands.mdx @@ -181,7 +181,7 @@ hideOnThisPage: true ```bash - fern generate [--group ] [--api ] [--version ] [--preview] [--fernignore ] [--local] [--force] [--no-replay] + fern generate [--group ] [--api ] [--version ] [--preview] [--fernignore ] [--local] [--force] [--no-replay] [--package] [--package-mode ] [--package-only] ``` @@ -294,6 +294,35 @@ hideOnThisPage: true `--no-replay` works only for local generation (`--local`). + ### package + + Use `--package` to build a distributable artifact for each generator that outputs to the local file system. The artifact is written to a `fern-dist/` folder inside the output directory, so an SDK can be shared internally without publishing to a registry. Artifacts are language-specific: an npm tarball, a Python wheel and sdist, a JAR, a NuGet package, a gem, a Composer zip, a crate, or, for Go, a `-source.zip` containing the module source to reference with a `replace` directive in `go.mod`. + + ```bash + fern generate --group node-sdk-local --version 0.0.1 --package + ``` + + ### package-mode + + Use `--package-mode ` to choose where packaging runs. The default, `local`, uses the language toolchains installed on your machine. `docker` runs each toolchain inside the generator's official Docker image, so no toolchain is required on the host. + + ```bash + fern generate --group node-sdk-local --version 0.0.1 --package --package-mode docker + ``` + + ### package-only + + Use `--package-only` to keep only the artifact: after packaging, everything in the output directory except `fern-dist/` is deleted, so the generated SDK source isn't left behind. `--package-only` implies `--package`. Deletion happens per generator, so a generator whose packaging failed keeps its source for debugging. + + ```bash + fern generate --group node-sdk-local --version 0.0.1 --package-only --package-mode docker + # SDKs/twilio-core-ts-sdk/ contains only fern-dist/twilio-core-0.0.1.tgz + ``` + + + The earlier `--pack` and `--pack-mode` flags were renamed to `--package` and `--package-mode` and no longer exist. Update any scripts that use them. + + diff --git a/fern/products/sdks/deep-dives/self-hosted.mdx b/fern/products/sdks/deep-dives/self-hosted.mdx index 609423a85..83460cbf0 100644 --- a/fern/products/sdks/deep-dives/self-hosted.mdx +++ b/fern/products/sdks/deep-dives/self-hosted.mdx @@ -146,6 +146,8 @@ fern generate --group python-sdk --local To pull generator images from a private registry your organization controls instead of Docker Hub, see [Private registry setup](#private-registry-setup). +To share a locally generated SDK internally without publishing it to a registry, add [`--package`](/learn/cli-api/cli-reference/commands#package), which builds a distributable artifact into a `fern-dist/` folder inside the output directory. + From 44b9c9f56ba204a8fad2ff715de3e1db18128f3f Mon Sep 17 00:00:00 2001 From: "devin.logan" Date: Mon, 3 Aug 2026 12:06:48 +0000 Subject: [PATCH 2/6] docs: fold --pack content into --package flags and fix package-mode values Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../cli-api-reference/pages/commands.mdx | 45 +++++++++++++++---- fern/products/sdks/deep-dives/self-hosted.mdx | 2 +- .../reference/generators-yml-reference.mdx | 2 + 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx index 2ef311fb6..b343d3ca6 100644 --- a/fern/products/cli-api-reference/pages/commands.mdx +++ b/fern/products/cli-api-reference/pages/commands.mdx @@ -181,7 +181,7 @@ hideOnThisPage: true ```bash - fern generate [--group ] [--api ] [--version ] [--preview] [--fernignore ] [--local] [--force] [--no-replay] [--package] [--package-mode ] [--package-only] + fern generate [--group ] [--api ] [--version ] [--preview] [--fernignore ] [--local] [--force] [--no-replay] [--package] [--package-mode ] [--package-only] ``` @@ -296,27 +296,56 @@ hideOnThisPage: true ### package - Use `--package` to build a distributable artifact for each generator that outputs to the local file system. The artifact is written to a `fern-dist/` folder inside the output directory, so an SDK can be shared internally without publishing to a registry. Artifacts are language-specific: an npm tarball, a Python wheel and sdist, a JAR, a NuGet package, a gem, a Composer zip, a crate, or, for Go, a `-source.zip` containing the module source to reference with a `replace` directive in `go.mod`. + Use `--package` to build a distributable package artifact for every generator in the run whose [output location](/learn/sdks/reference/generators-yml#output) is `local-file-system`. Artifacts are written to a `fern-dist/` folder inside that generator's output directory, so a generated SDK can be handed to internal consumers without publishing it to a public registry. `--package` works with both cloud and local (`--local`) generation, and implies full project output so the artifact includes the project metadata files (`pyproject.toml`, `README.md`, and similar) it needs to build. ```bash - fern generate --group node-sdk-local --version 0.0.1 --package + # Package every local-file-system output + fern generate --package + + # Package one group generated locally + fern generate --group plantstore-python-sdk --local --package ``` + | Language | Artifact | + |----------|----------| + | TypeScript | npm tarball (`.tgz`) | + | Python | wheel (`.whl`) | + | Java | JAR | + | C# | NuGet package (`.nupkg`) | + | Ruby | gem (`.gem`) | + | PHP | Composer archive (`.zip`) | + | Rust | crate (`.crate`) | + | Go | module source zip (`-source.zip`) | + + Go modules have no binary package format, so the Go artifact is a zip of the generated module source, excluding `fern-dist/` and `.git/`. Fern builds it in-process: it produces the same artifact in either package mode and requires no Go toolchain. Consumers unzip it and point their `go.mod` at the unzipped directory: + + ```go title="go.mod" + require github.com/plantstore/plantstore-go v0.0.0 + + replace github.com/plantstore/plantstore-go => ../plantstore-go + ``` + + Swift SDKs are distributed as Swift Package Manager source packages, so packaging logs a warning instead of producing an artifact: share the output directory or reference it as a local package dependency. If packaging fails for one or more generators, the CLI reports them together as `Packaging failed for: ` and removes any empty `fern-dist/` directory it created. + + `--package` can't be combined with `--preview` or with docs generation (`--docs`). + ### package-mode - Use `--package-mode ` to choose where packaging runs. The default, `local`, uses the language toolchains installed on your machine. `docker` runs each toolchain inside the generator's official Docker image, so no toolchain is required on the host. + Use `--package-mode ` to choose where `--package` runs the packaging toolchains. `host` (the default) uses the toolchains installed on the machine (`npm`, `pip`, `gradle`, `dotnet`, `gem`, `composer`, `cargo`). `docker` runs each toolchain inside its official image (`node`, `python`, `gradle`, `dotnet/sdk`, `ruby`, `composer`, `rust`) with the output directory mounted, so no language toolchains are required locally. Docker mode uses `docker` as the container runtime unless you pass `--runner podman`. ```bash - fern generate --group node-sdk-local --version 0.0.1 --package --package-mode docker + fern generate --group plantstore-python-sdk --package --package-mode docker ``` + `--package-mode` requires `--package` or `--package-only`. + ### package-only - Use `--package-only` to keep only the artifact: after packaging, everything in the output directory except `fern-dist/` is deleted, so the generated SDK source isn't left behind. `--package-only` implies `--package`. Deletion happens per generator, so a generator whose packaging failed keeps its source for debugging. + Use `--package-only` to keep only the artifact: after packaging, everything in the output directory except `fern-dist/` is deleted, so the generated SDK source isn't left behind. `--package-only` implies `--package`. Deletion happens per generator, so a generator whose packaging failed keeps its source for debugging, as does a generator that produces no artifact at all (Swift). `.git`, `.fernignore`, and any top-level path a `.fernignore` entry covers are always preserved. ```bash - fern generate --group node-sdk-local --version 0.0.1 --package-only --package-mode docker - # SDKs/twilio-core-ts-sdk/ contains only fern-dist/twilio-core-0.0.1.tgz + fern generate --group plantstore-node-sdk --version 0.0.1 --package-only --package-mode docker + # SDKs/plantstore-node-sdk/ contains only fern-dist/plantstore-0.0.1.tgz ``` diff --git a/fern/products/sdks/deep-dives/self-hosted.mdx b/fern/products/sdks/deep-dives/self-hosted.mdx index 83460cbf0..7551793da 100644 --- a/fern/products/sdks/deep-dives/self-hosted.mdx +++ b/fern/products/sdks/deep-dives/self-hosted.mdx @@ -146,7 +146,7 @@ fern generate --group python-sdk --local To pull generator images from a private registry your organization controls instead of Docker Hub, see [Private registry setup](#private-registry-setup). -To share a locally generated SDK internally without publishing it to a registry, add [`--package`](/learn/cli-api/cli-reference/commands#package), which builds a distributable artifact into a `fern-dist/` folder inside the output directory. +To share a locally generated SDK internally without publishing it to a registry, add [`--package`](/learn/cli-api-reference/cli-reference/commands#package), which builds a distributable artifact into a `fern-dist/` folder inside the output directory. diff --git a/fern/products/sdks/reference/generators-yml-reference.mdx b/fern/products/sdks/reference/generators-yml-reference.mdx index 1fa9ebdb2..59d6e96e5 100644 --- a/fern/products/sdks/reference/generators-yml-reference.mdx +++ b/fern/products/sdks/reference/generators-yml-reference.mdx @@ -939,6 +939,8 @@ Set to "local-file-system" for local output Local directory path where generated files will be saved + +To turn a local output into an installable artifact (npm tarball, wheel, JAR, and so on) without publishing it to a registry, run [`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). From 1b1390a1e80bca99c4f52f5915285b2673955937 Mon Sep 17 00:00:00 2001 From: "devin.logan" Date: Wed, 12 Aug 2026 17:16:48 +0000 Subject: [PATCH 3/6] docs: trim Go/Swift packaging detail and make --package pointers callouts Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- fern/products/cli-api-reference/pages/commands.mdx | 12 ++---------- fern/products/sdks/deep-dives/self-hosted.mdx | 2 ++ .../sdks/reference/generators-yml-reference.mdx | 6 ++++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx index b343d3ca6..057525883 100644 --- a/fern/products/cli-api-reference/pages/commands.mdx +++ b/fern/products/cli-api-reference/pages/commands.mdx @@ -317,15 +317,7 @@ hideOnThisPage: true | Rust | crate (`.crate`) | | Go | module source zip (`-source.zip`) | - Go modules have no binary package format, so the Go artifact is a zip of the generated module source, excluding `fern-dist/` and `.git/`. Fern builds it in-process: it produces the same artifact in either package mode and requires no Go toolchain. Consumers unzip it and point their `go.mod` at the unzipped directory: - - ```go title="go.mod" - require github.com/plantstore/plantstore-go v0.0.0 - - replace github.com/plantstore/plantstore-go => ../plantstore-go - ``` - - Swift SDKs are distributed as Swift Package Manager source packages, so packaging logs a warning instead of producing an artifact: share the output directory or reference it as a local package dependency. If packaging fails for one or more generators, the CLI reports them together as `Packaging failed for: ` and removes any empty `fern-dist/` directory it created. + Go has no binary package format, so its artifact is a source zip that consumers unzip and reference from their own `go.mod` with a `replace` directive. Swift SDKs are distributed as Swift Package Manager source packages, so packaging logs a warning instead of producing an artifact. `--package` can't be combined with `--preview` or with docs generation (`--docs`). @@ -341,7 +333,7 @@ hideOnThisPage: true ### package-only - Use `--package-only` to keep only the artifact: after packaging, everything in the output directory except `fern-dist/` is deleted, so the generated SDK source isn't left behind. `--package-only` implies `--package`. Deletion happens per generator, so a generator whose packaging failed keeps its source for debugging, as does a generator that produces no artifact at all (Swift). `.git`, `.fernignore`, and any top-level path a `.fernignore` entry covers are always preserved. + Use `--package-only` to keep only the artifact: after packaging, everything in the output directory except `fern-dist/` is deleted, so the generated SDK source isn't left behind. `--package-only` implies `--package`. Deletion happens per generator, so a generator that produced no artifact keeps its source. `.git`, `.fernignore`, and any top-level path a `.fernignore` entry covers are always preserved. ```bash fern generate --group plantstore-node-sdk --version 0.0.1 --package-only --package-mode docker diff --git a/fern/products/sdks/deep-dives/self-hosted.mdx b/fern/products/sdks/deep-dives/self-hosted.mdx index 7551793da..fd6afddfb 100644 --- a/fern/products/sdks/deep-dives/self-hosted.mdx +++ b/fern/products/sdks/deep-dives/self-hosted.mdx @@ -146,7 +146,9 @@ fern generate --group python-sdk --local To pull generator images from a private registry your organization controls instead of Docker Hub, see [Private registry setup](#private-registry-setup). + To share a locally generated SDK internally without publishing it to a registry, add [`--package`](/learn/cli-api-reference/cli-reference/commands#package), which builds a distributable artifact into a `fern-dist/` folder inside the output directory. + diff --git a/fern/products/sdks/reference/generators-yml-reference.mdx b/fern/products/sdks/reference/generators-yml-reference.mdx index 59d6e96e5..c50c60917 100644 --- a/fern/products/sdks/reference/generators-yml-reference.mdx +++ b/fern/products/sdks/reference/generators-yml-reference.mdx @@ -932,6 +932,10 @@ output: path: "./generated-sdks/typescript" ``` + +To turn a local output into an installable artifact (npm tarball, wheel, JAR, and so on) without publishing it to a registry, run [`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). + + Set to "local-file-system" for local output @@ -939,8 +943,6 @@ Set to "local-file-system" for local output Local directory path where generated files will be saved - -To turn a local output into an installable artifact (npm tarball, wheel, JAR, and so on) without publishing it to a registry, run [`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). From dd9f456278bf62024182c7636fa74edf4f49621d Mon Sep 17 00:00:00 2001 From: "devin.logan" Date: Wed, 12 Aug 2026 20:03:21 +0000 Subject: [PATCH 4/6] docs: point publishing pages at fern generate --package for internal distribution Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- fern/products/sdks/generators/csharp/publishing-to-nuget.mdx | 5 ++++- .../sdks/generators/go/publishing-to-go-package-manager.mdx | 5 ++++- .../sdks/generators/java/publishing-to-maven-central.mdx | 5 ++++- .../products/sdks/generators/php/publishing-to-packagist.mdx | 5 ++++- fern/products/sdks/generators/python/publishing-to-pypi.mdx | 5 ++++- .../products/sdks/generators/ruby/publishing-to-rubygems.mdx | 5 ++++- .../sdks/generators/rust/publishing-to-crates-io.mdx | 5 ++++- .../generators/swift/publishing-to-swift-package-manager.mdx | 2 +- .../sdks/generators/typescript/publishing-to-npm.mdx | 5 ++++- 9 files changed, 33 insertions(+), 9 deletions(-) diff --git a/fern/products/sdks/generators/csharp/publishing-to-nuget.mdx b/fern/products/sdks/generators/csharp/publishing-to-nuget.mdx index d760935bb..298edffec 100644 --- a/fern/products/sdks/generators/csharp/publishing-to-nuget.mdx +++ b/fern/products/sdks/generators/csharp/publishing-to-nuget.mdx @@ -6,7 +6,10 @@ description: Learn how to publish your Fern-generated C#/.NET SDK to NuGet using Publish your public-facing Fern C#/.NET SDK to the [NuGet registry](https://www.nuget.org/). After following the steps on this page, -you'll have a versioned package published on NuGet. +you'll have a versioned package published on NuGet. To distribute the SDK +internally instead, generate to the local file system (optionally +[self-hosted](/learn/sdks/deep-dives/self-hosted)) and build a `.nupkg` with +[`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). If you're using API key authentication, consider switching to OIDC (trusted publishing). See [Migrating from API key to OIDC publishing](#migrating-from-api-key-to-oidc-publishing) for the steps. diff --git a/fern/products/sdks/generators/go/publishing-to-go-package-manager.mdx b/fern/products/sdks/generators/go/publishing-to-go-package-manager.mdx index 790a1932a..ab3393dd0 100644 --- a/fern/products/sdks/generators/go/publishing-to-go-package-manager.mdx +++ b/fern/products/sdks/generators/go/publishing-to-go-package-manager.mdx @@ -5,7 +5,10 @@ description: Learn how to publish your Fern-generated Go SDK to pkg.go.dev. Conf Publish your public-facing Fern Go SDK to -[pkg.go.dev](https://pkg.go.dev/). +[pkg.go.dev](https://pkg.go.dev/). To distribute the SDK internally instead, +generate to the local file system (optionally +[self-hosted](/learn/sdks/deep-dives/self-hosted)) and build a module source zip +with [`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). This page assumes that you have: diff --git a/fern/products/sdks/generators/java/publishing-to-maven-central.mdx b/fern/products/sdks/generators/java/publishing-to-maven-central.mdx index c7df0ff56..abfc33cd5 100644 --- a/fern/products/sdks/generators/java/publishing-to-maven-central.mdx +++ b/fern/products/sdks/generators/java/publishing-to-maven-central.mdx @@ -6,7 +6,10 @@ description: Learn how to publish your Fern-generated Java SDK to Maven Central. Publish your public-facing Fern Java SDK to the [Maven Central registry](https://central.sonatype.com/). After following the steps on this -page, you'll have a versioned package published on Maven Central. +page, you'll have a versioned package published on Maven Central. To distribute +the SDK internally instead, generate to the local file system (optionally +[self-hosted](/learn/sdks/deep-dives/self-hosted)) and build a JAR with +[`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). This page assumes that you have: diff --git a/fern/products/sdks/generators/php/publishing-to-packagist.mdx b/fern/products/sdks/generators/php/publishing-to-packagist.mdx index 1103e5868..c50230f89 100644 --- a/fern/products/sdks/generators/php/publishing-to-packagist.mdx +++ b/fern/products/sdks/generators/php/publishing-to-packagist.mdx @@ -6,7 +6,10 @@ description: How to publish the Fern PHP SDK to Packagist. Publish your public-facing Fern PHP SDK to the [Packagist registry](https://packagist.org/). After following the steps on this page, -you'll have a versioned package published on Packagist. +you'll have a versioned package published on Packagist. To distribute the SDK +internally instead, generate to the local file system (optionally +[self-hosted](/learn/sdks/deep-dives/self-hosted)) and build a Composer archive +with [`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). This page assumes that you have: diff --git a/fern/products/sdks/generators/python/publishing-to-pypi.mdx b/fern/products/sdks/generators/python/publishing-to-pypi.mdx index 9c08507c6..22ad0fdfb 100644 --- a/fern/products/sdks/generators/python/publishing-to-pypi.mdx +++ b/fern/products/sdks/generators/python/publishing-to-pypi.mdx @@ -6,7 +6,10 @@ description: Learn how to publish your Fern Python SDK to PyPI using OIDC or tok Publish your public-facing Fern Python SDK to the [PyPI registry](https://pypi.org/). After following the steps on this page, -you'll have a versioned package published on PyPI. +you'll have a versioned package published on PyPI. To distribute the SDK +internally instead, generate to the local file system (optionally +[self-hosted](/learn/sdks/deep-dives/self-hosted)) and build a wheel with +[`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). If you're using token-based authentication, consider switching to OIDC (trusted publishing). See [Migrating from token-based to OIDC publishing](#migrating-from-token-based-to-oidc-publishing) for the steps. diff --git a/fern/products/sdks/generators/ruby/publishing-to-rubygems.mdx b/fern/products/sdks/generators/ruby/publishing-to-rubygems.mdx index a6117b8cd..6b5025b05 100644 --- a/fern/products/sdks/generators/ruby/publishing-to-rubygems.mdx +++ b/fern/products/sdks/generators/ruby/publishing-to-rubygems.mdx @@ -6,7 +6,10 @@ description: Publish Ruby SDKs to RubyGems with Fern. Complete setup guide for p Publish your public-facing Fern Ruby SDK to the [RubyGems registry](https://rubygems.org/). After following the steps on this page, -you'll have a versioned package published on RubyGems. +you'll have a versioned package published on RubyGems. To distribute the SDK +internally instead, generate to the local file system (optionally +[self-hosted](/learn/sdks/deep-dives/self-hosted)) and build a gem with +[`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). This page assumes that you have: diff --git a/fern/products/sdks/generators/rust/publishing-to-crates-io.mdx b/fern/products/sdks/generators/rust/publishing-to-crates-io.mdx index 84f942893..a7cc20523 100644 --- a/fern/products/sdks/generators/rust/publishing-to-crates-io.mdx +++ b/fern/products/sdks/generators/rust/publishing-to-crates-io.mdx @@ -6,7 +6,10 @@ description: How to publish the Fern Rust SDK to crates.io. Publish your public-facing Fern Rust SDK to the [crates.io registry](https://crates.io/). After following the steps on this page, -you'll have a versioned crate published on crates.io. +you'll have a versioned crate published on crates.io. To distribute the SDK +internally instead, generate to the local file system (optionally +[self-hosted](/learn/sdks/deep-dives/self-hosted)) and build a `.crate` file with +[`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). This page assumes that you have: diff --git a/fern/products/sdks/generators/swift/publishing-to-swift-package-manager.mdx b/fern/products/sdks/generators/swift/publishing-to-swift-package-manager.mdx index 83582242e..7e9636a9e 100644 --- a/fern/products/sdks/generators/swift/publishing-to-swift-package-manager.mdx +++ b/fern/products/sdks/generators/swift/publishing-to-swift-package-manager.mdx @@ -4,7 +4,7 @@ description: How to publish the Fern Swift SDK as a Swift package --- -Publish your public-facing Fern Swift SDK as a Swift package distributed via Git. After following the steps on this page, you'll have a versioned package that developers can install using Swift Package Manager. +Publish your public-facing Fern Swift SDK as a Swift package distributed via Git. After following the steps on this page, you'll have a versioned package that developers can install using Swift Package Manager. To distribute the SDK internally instead, generate to the local file system (optionally [self-hosted](/learn/sdks/deep-dives/self-hosted)) and reference the output directory as a local package dependency: Swift has no binary package format, so [`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package) produces no artifact for Swift. This page assumes that you have: diff --git a/fern/products/sdks/generators/typescript/publishing-to-npm.mdx b/fern/products/sdks/generators/typescript/publishing-to-npm.mdx index 520a624eb..d8cc5cacd 100644 --- a/fern/products/sdks/generators/typescript/publishing-to-npm.mdx +++ b/fern/products/sdks/generators/typescript/publishing-to-npm.mdx @@ -6,7 +6,10 @@ description: Learn how to publish your Fern TypeScript SDK to npm using OIDC or Publish your public-facing Fern TypeScript SDK to the [npmjs registry](https://www.npmjs.com/). After following the steps on this page, -you'll have a versioned package published on npm. +you'll have a versioned package published on npm. To distribute the SDK +internally instead, generate to the local file system (optionally +[self-hosted](/learn/sdks/deep-dives/self-hosted)) and build a tarball with +[`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). If you're using token-based authentication, npm has deprecated long-lived classic tokens. See [Migrating from token-based to OpenID Connect (OIDC) publishing](#migrating-from-token-based-to-oidc-publishing) to upgrade to the more secure OIDC authentication. From c0c792f23fab4845420f27d32651919350830cb2 Mon Sep 17 00:00:00 2001 From: "devin.logan" Date: Wed, 12 Aug 2026 20:07:17 +0000 Subject: [PATCH 5/6] docs: reword --package project output and drop rename warning Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- fern/products/cli-api-reference/pages/commands.mdx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx index 057525883..86f8adc0c 100644 --- a/fern/products/cli-api-reference/pages/commands.mdx +++ b/fern/products/cli-api-reference/pages/commands.mdx @@ -296,7 +296,7 @@ hideOnThisPage: true ### package - Use `--package` to build a distributable package artifact for every generator in the run whose [output location](/learn/sdks/reference/generators-yml#output) is `local-file-system`. Artifacts are written to a `fern-dist/` folder inside that generator's output directory, so a generated SDK can be handed to internal consumers without publishing it to a public registry. `--package` works with both cloud and local (`--local`) generation, and implies full project output so the artifact includes the project metadata files (`pyproject.toml`, `README.md`, and similar) it needs to build. + Use `--package` to build a distributable package artifact for every generator in the run whose [output location](/learn/sdks/reference/generators-yml#output) is `local-file-system`. Artifacts are written to a `fern-dist/` folder inside that generator's output directory, so a generated SDK can be handed to internal consumers without publishing it to a public registry. `--package` works with both cloud and local (`--local`) generation, and the output includes the manifest and build files (`pyproject.toml`, `README.md`, and similar) the packaging toolchain needs, which a plain `local-file-system` output omits. ```bash # Package every local-file-system output @@ -319,8 +319,6 @@ hideOnThisPage: true Go has no binary package format, so its artifact is a source zip that consumers unzip and reference from their own `go.mod` with a `replace` directive. Swift SDKs are distributed as Swift Package Manager source packages, so packaging logs a warning instead of producing an artifact. - `--package` can't be combined with `--preview` or with docs generation (`--docs`). - ### package-mode Use `--package-mode ` to choose where `--package` runs the packaging toolchains. `host` (the default) uses the toolchains installed on the machine (`npm`, `pip`, `gradle`, `dotnet`, `gem`, `composer`, `cargo`). `docker` runs each toolchain inside its official image (`node`, `python`, `gradle`, `dotnet/sdk`, `ruby`, `composer`, `rust`) with the output directory mounted, so no language toolchains are required locally. Docker mode uses `docker` as the container runtime unless you pass `--runner podman`. @@ -340,10 +338,6 @@ hideOnThisPage: true # SDKs/plantstore-node-sdk/ contains only fern-dist/plantstore-0.0.1.tgz ``` - - The earlier `--pack` and `--pack-mode` flags were renamed to `--package` and `--package-mode` and no longer exist. Update any scripts that use them. - - From b2eac3c5ce536bd6d915edfe097eb7ac9795604e Mon Sep 17 00:00:00 2001 From: Devin Logan Date: Wed, 12 Aug 2026 16:24:32 -0400 Subject: [PATCH 6/6] clarify --- .../cli-api-reference/pages/commands.mdx | 22 +++++++++++++++---- .../publishing-to-swift-package-manager.mdx | 2 +- .../reference/generators-yml-reference.mdx | 4 ---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx index 86f8adc0c..ab0a75651 100644 --- a/fern/products/cli-api-reference/pages/commands.mdx +++ b/fern/products/cli-api-reference/pages/commands.mdx @@ -296,7 +296,7 @@ hideOnThisPage: true ### package - Use `--package` to build a distributable package artifact for every generator in the run whose [output location](/learn/sdks/reference/generators-yml#output) is `local-file-system`. Artifacts are written to a `fern-dist/` folder inside that generator's output directory, so a generated SDK can be handed to internal consumers without publishing it to a public registry. `--package` works with both cloud and local (`--local`) generation, and the output includes the manifest and build files (`pyproject.toml`, `README.md`, and similar) the packaging toolchain needs, which a plain `local-file-system` output omits. + Use `--package` to build a distributable package artifact for every generator in the run whose [output location](/learn/sdks/reference/generators-yml#output) is `local-file-system`. Artifacts are written to a `fern-dist/` folder inside that generator's output directory, so a generated SDK can be handed to internal consumers without publishing it to a public registry. `--package` works with both cloud and local (`--local`) generation. ```bash # Package every local-file-system output @@ -317,11 +317,23 @@ hideOnThisPage: true | Rust | crate (`.crate`) | | Go | module source zip (`-source.zip`) | - Go has no binary package format, so its artifact is a source zip that consumers unzip and reference from their own `go.mod` with a `replace` directive. Swift SDKs are distributed as Swift Package Manager source packages, so packaging logs a warning instead of producing an artifact. + + Not available for Swift. + ### package-mode - Use `--package-mode ` to choose where `--package` runs the packaging toolchains. `host` (the default) uses the toolchains installed on the machine (`npm`, `pip`, `gradle`, `dotnet`, `gem`, `composer`, `cargo`). `docker` runs each toolchain inside its official image (`node`, `python`, `gradle`, `dotnet/sdk`, `ruby`, `composer`, `rust`) with the output directory mounted, so no language toolchains are required locally. Docker mode uses `docker` as the container runtime unless you pass `--runner podman`. + Use `--package-mode ` to choose where `--package` runs the packaging toolchains. `host` (the default) uses the toolchains installed on the machine. `docker` runs each toolchain inside its official image with the output directory mounted, so no language toolchains are required locally, and uses `docker` as the container runtime unless you pass `--runner podman`. + + | Language | Host toolchain | Docker image | + |----------|----------------|--------------| + | TypeScript | `npm` | `node` | + | Python | `pip` | `python` | + | Java | `gradle` | `gradle` | + | C# | `dotnet` | `dotnet/sdk` | + | Ruby | `gem` | `ruby` | + | PHP | `composer` | `composer` | + | Rust | `cargo` | `rust` | ```bash fern generate --group plantstore-python-sdk --package --package-mode docker @@ -331,7 +343,9 @@ hideOnThisPage: true ### package-only - Use `--package-only` to keep only the artifact: after packaging, everything in the output directory except `fern-dist/` is deleted, so the generated SDK source isn't left behind. `--package-only` implies `--package`. Deletion happens per generator, so a generator that produced no artifact keeps its source. `.git`, `.fernignore`, and any top-level path a `.fernignore` entry covers are always preserved. + Use `--package-only` to keep only the artifact: after packaging, everything in the output directory except `fern-dist/` is deleted, so the generated SDK source isn't left behind. `--package-only` implies `--package`. + + Deletion happens per generator, so a generator that produced no artifact keeps its source. `.git`, `.fernignore`, and any top-level path a `.fernignore` entry covers are always preserved. ```bash fern generate --group plantstore-node-sdk --version 0.0.1 --package-only --package-mode docker diff --git a/fern/products/sdks/generators/swift/publishing-to-swift-package-manager.mdx b/fern/products/sdks/generators/swift/publishing-to-swift-package-manager.mdx index 7e9636a9e..83582242e 100644 --- a/fern/products/sdks/generators/swift/publishing-to-swift-package-manager.mdx +++ b/fern/products/sdks/generators/swift/publishing-to-swift-package-manager.mdx @@ -4,7 +4,7 @@ description: How to publish the Fern Swift SDK as a Swift package --- -Publish your public-facing Fern Swift SDK as a Swift package distributed via Git. After following the steps on this page, you'll have a versioned package that developers can install using Swift Package Manager. To distribute the SDK internally instead, generate to the local file system (optionally [self-hosted](/learn/sdks/deep-dives/self-hosted)) and reference the output directory as a local package dependency: Swift has no binary package format, so [`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package) produces no artifact for Swift. +Publish your public-facing Fern Swift SDK as a Swift package distributed via Git. After following the steps on this page, you'll have a versioned package that developers can install using Swift Package Manager. This page assumes that you have: diff --git a/fern/products/sdks/reference/generators-yml-reference.mdx b/fern/products/sdks/reference/generators-yml-reference.mdx index c50c60917..1fa9ebdb2 100644 --- a/fern/products/sdks/reference/generators-yml-reference.mdx +++ b/fern/products/sdks/reference/generators-yml-reference.mdx @@ -932,10 +932,6 @@ output: path: "./generated-sdks/typescript" ``` - -To turn a local output into an installable artifact (npm tarball, wheel, JAR, and so on) without publishing it to a registry, run [`fern generate --package`](/learn/cli-api-reference/cli-reference/commands#package). - - Set to "local-file-system" for local output