diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx index fca845fbb..ab0a75651 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,64 @@ hideOnThisPage: true `--no-replay` works only for local generation (`--local`). + ### 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. + + ```bash + # 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`) | + + + 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. `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 + ``` + + `--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 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 + # 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 609423a85..fd6afddfb 100644 --- a/fern/products/sdks/deep-dives/self-hosted.mdx +++ b/fern/products/sdks/deep-dives/self-hosted.mdx @@ -146,6 +146,10 @@ 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/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/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.