-
Notifications
You must be signed in to change notification settings - Fork 332
feat(cli): rename --pack to --package and add --package-only #17307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| - summary: | | ||
| Rename the `--pack` and `--pack-mode` flags on `fern generate` to `--package` and | ||
| `--package-mode`, and add `--package-only`, which builds the distributable artifact into | ||
| `fern-dist/` and removes the generated SDK source, leaving only the package in the output | ||
| directory. | ||
| type: feat | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -875,17 +875,23 @@ function addGenerateCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) | |
| description: | ||
| "Generate test files even when generating to a local file system (tests are normally only generated for GitHub output modes)" | ||
| }) | ||
| .option("pack", { | ||
| .option("package", { | ||
| boolean: true, | ||
| default: false, | ||
| description: | ||
| "After generating to the local file system, build distributable package artifacts (npm tarball, wheel, JAR, NuGet package, gem, etc.) into a fern-dist/ folder inside the output directory." | ||
| }) | ||
| .option("pack-mode", { | ||
| .option("package-mode", { | ||
| choices: ["host", "docker"] as const, | ||
| default: "host" as const, | ||
| description: | ||
| "Where --pack runs the packaging toolchain: 'host' uses toolchains installed on this machine; 'docker' runs each toolchain inside an official Docker image (node, python, gradle, dotnet/sdk, ruby, composer, rust) with the output directory mounted, so no local toolchains are needed." | ||
| "Where --package runs the packaging toolchain: 'host' uses toolchains installed on this machine; 'docker' runs each toolchain inside an official Docker image (node, python, gradle, dotnet/sdk, ruby, composer, rust) with the output directory mounted, so no local toolchains are needed." | ||
| }) | ||
| .option("package-only", { | ||
| boolean: true, | ||
| default: false, | ||
| description: | ||
| "Like --package, but only the fern-dist/ artifact is kept in the output directory — the generated SDK source is removed after the package is built." | ||
| }), | ||
| async (argv) => { | ||
| if (argv.api != null && argv.api.length > 0 && argv.docs != null) { | ||
|
|
@@ -961,22 +967,25 @@ function addGenerateCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) | |
| { code: CliError.Code.ConfigError } | ||
| ); | ||
| } | ||
| if (argv.pack && argv.preview) { | ||
| return cliContext.failWithoutThrowing("The --pack flag cannot be used with --preview.", undefined, { | ||
| const shouldPackage = argv.package || argv.packageOnly; | ||
| if (shouldPackage && argv.preview) { | ||
| return cliContext.failWithoutThrowing("The --package flag cannot be used with --preview.", undefined, { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 suggestion When the user passed |
||
| code: CliError.Code.ConfigError | ||
| }); | ||
| } | ||
| if (argv.pack && argv.docs != null) { | ||
| if (shouldPackage && argv.docs != null) { | ||
| return cliContext.failWithoutThrowing( | ||
| "The --pack flag can only be used for API generation, not docs generation.", | ||
| "The --package flag can only be used for API generation, not docs generation.", | ||
| undefined, | ||
| { code: CliError.Code.ConfigError } | ||
| ); | ||
| } | ||
| if (argv.packMode !== "host" && !argv.pack) { | ||
| return cliContext.failWithoutThrowing("The --pack-mode flag can only be used with --pack.", undefined, { | ||
| code: CliError.Code.ConfigError | ||
| }); | ||
| if (argv.packageMode !== "host" && !shouldPackage) { | ||
| return cliContext.failWithoutThrowing( | ||
| "The --package-mode flag can only be used with --package.", | ||
| undefined, | ||
| { code: CliError.Code.ConfigError } | ||
| ); | ||
| } | ||
| if (argv.output != null && argv.docs != null) { | ||
| return cliContext.failWithoutThrowing( | ||
|
|
@@ -1018,8 +1027,9 @@ function addGenerateCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) | |
| requireEnvVars: argv["require-env-vars"], | ||
| skipIfNoDiff: argv["skip-if-no-diff"], | ||
| generateTests: argv["generate-tests"], | ||
| pack: argv.pack, | ||
| packMode: argv.packMode | ||
| pack: shouldPackage, | ||
| packMode: argv.packageMode, | ||
| packOnly: argv.packageOnly | ||
| }); | ||
| } | ||
| if (argv.docs != null) { | ||
|
|
@@ -1083,8 +1093,9 @@ function addGenerateCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) | |
| requireEnvVars: argv["require-env-vars"], | ||
| skipIfNoDiff: argv["skip-if-no-diff"], | ||
| generateTests: argv["generate-tests"], | ||
| pack: argv.pack, | ||
| packMode: argv.packMode | ||
| pack: shouldPackage, | ||
| packMode: argv.packageMode, | ||
| packOnly: argv.packageOnly | ||
| }); | ||
| } | ||
| ); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 warning
Removing
--pack/--pack-modewith no alias is a breaking CLI change;type: featwill bury it in a minor release note. Use the breaking type (break) so users who scripted against--packactually see it — or keep hidden aliases for one release.