@fern-api/fern-api-dev 5.39.0 → 5.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +120 -32
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -669350,7 +669350,7 @@ var AccessTokenPosthogManager = class {
|
|
|
669350
669350
|
properties: {
|
|
669351
669351
|
...event,
|
|
669352
669352
|
...event.properties,
|
|
669353
|
-
version: "5.
|
|
669353
|
+
version: "5.40.0",
|
|
669354
669354
|
usingAccessToken: true,
|
|
669355
669355
|
...getRunIdProperties()
|
|
669356
669356
|
}
|
|
@@ -669414,7 +669414,7 @@ var UserPosthogManager = class {
|
|
|
669414
669414
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
669415
669415
|
event: "CLI",
|
|
669416
669416
|
properties: {
|
|
669417
|
-
version: "5.
|
|
669417
|
+
version: "5.40.0",
|
|
669418
669418
|
...event,
|
|
669419
669419
|
...event.properties,
|
|
669420
669420
|
usingAccessToken: false,
|
|
@@ -860327,7 +860327,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
860327
860327
|
var LOGS_FOLDER_NAME = "logs";
|
|
860328
860328
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
860329
860329
|
function getCliSource() {
|
|
860330
|
-
const version7 = "5.
|
|
860330
|
+
const version7 = "5.40.0";
|
|
860331
860331
|
return `cli@${version7}`;
|
|
860332
860332
|
}
|
|
860333
860333
|
var DebugLogger = class {
|
|
@@ -880967,7 +880967,7 @@ var LegacyDocsPublisher = class {
|
|
|
880967
880967
|
previewId,
|
|
880968
880968
|
disableTemplates: void 0,
|
|
880969
880969
|
skipUpload,
|
|
880970
|
-
cliVersion: "5.
|
|
880970
|
+
cliVersion: "5.40.0",
|
|
880971
880971
|
loginCommand: "fern auth login"
|
|
880972
880972
|
});
|
|
880973
880973
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -955887,7 +955887,7 @@ function getAutomationContextFromEnv() {
|
|
|
955887
955887
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
955888
955888
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
955889
955889
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
955890
|
-
cli_version: "5.
|
|
955890
|
+
cli_version: "5.40.0"
|
|
955891
955891
|
};
|
|
955892
955892
|
}
|
|
955893
955893
|
function isAutomationMode() {
|
|
@@ -956713,7 +956713,7 @@ var CliContext = class _CliContext {
|
|
|
956713
956713
|
if (false) {
|
|
956714
956714
|
this.logger.error("CLI_VERSION is not defined");
|
|
956715
956715
|
}
|
|
956716
|
-
return "5.
|
|
956716
|
+
return "5.40.0";
|
|
956717
956717
|
}
|
|
956718
956718
|
getCliName() {
|
|
956719
956719
|
if (false) {
|
|
@@ -965437,6 +965437,99 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
965437
965437
|
});
|
|
965438
965438
|
}
|
|
965439
965439
|
|
|
965440
|
+
// src/commands/docs-theme/deleteDocsTheme.ts
|
|
965441
|
+
var import_node_readline6 = require("readline");
|
|
965442
|
+
init_lib6();
|
|
965443
|
+
|
|
965444
|
+
// src/commands/docs-theme/themeOrigin.ts
|
|
965445
|
+
var FDR_ORIGIN = process.env.OVERRIDE_FDR_ORIGIN ?? "https://registry.buildwithfern.com";
|
|
965446
|
+
function describeFetchError(error50) {
|
|
965447
|
+
if (!(error50 instanceof Error)) {
|
|
965448
|
+
return String(error50);
|
|
965449
|
+
}
|
|
965450
|
+
const cause = error50.cause;
|
|
965451
|
+
if (cause instanceof Error) {
|
|
965452
|
+
return cause.message;
|
|
965453
|
+
}
|
|
965454
|
+
return error50.message;
|
|
965455
|
+
}
|
|
965456
|
+
function parseErrorDetail(body) {
|
|
965457
|
+
try {
|
|
965458
|
+
const parsed = JSON.parse(body);
|
|
965459
|
+
const message = parsed.message ?? parsed.error?.message;
|
|
965460
|
+
if (typeof message === "string") {
|
|
965461
|
+
return message;
|
|
965462
|
+
}
|
|
965463
|
+
} catch {
|
|
965464
|
+
}
|
|
965465
|
+
return void 0;
|
|
965466
|
+
}
|
|
965467
|
+
|
|
965468
|
+
// src/commands/docs-theme/deleteDocsTheme.ts
|
|
965469
|
+
async function confirmDeletion(themeName) {
|
|
965470
|
+
const rl5 = (0, import_node_readline6.createInterface)({ input: process.stdin, output: process.stderr });
|
|
965471
|
+
return new Promise((resolve15) => {
|
|
965472
|
+
rl5.question(`Are you sure you want to delete the theme "${themeName}"? (y/N) `, (answer) => {
|
|
965473
|
+
rl5.close();
|
|
965474
|
+
resolve15(answer.trim().toLowerCase() === "y");
|
|
965475
|
+
});
|
|
965476
|
+
});
|
|
965477
|
+
}
|
|
965478
|
+
async function deleteDocsTheme({
|
|
965479
|
+
cliContext,
|
|
965480
|
+
name: name2,
|
|
965481
|
+
force
|
|
965482
|
+
}) {
|
|
965483
|
+
const token = await cliContext.runTask(async (context3) => {
|
|
965484
|
+
return askToLogin(context3);
|
|
965485
|
+
});
|
|
965486
|
+
if (token == null) {
|
|
965487
|
+
cliContext.failAndThrow("Failed to authenticate. Please run 'fern login' first.", void 0, {
|
|
965488
|
+
code: CliError.Code.AuthError
|
|
965489
|
+
});
|
|
965490
|
+
return;
|
|
965491
|
+
}
|
|
965492
|
+
const project = await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
965493
|
+
commandLineApiWorkspace: void 0,
|
|
965494
|
+
defaultToAllApiWorkspaces: true
|
|
965495
|
+
});
|
|
965496
|
+
const orgId = project.config.organization;
|
|
965497
|
+
if (!force) {
|
|
965498
|
+
const confirmed = await confirmDeletion(name2);
|
|
965499
|
+
if (!confirmed) {
|
|
965500
|
+
cliContext.logger.info("Deletion cancelled.");
|
|
965501
|
+
return;
|
|
965502
|
+
}
|
|
965503
|
+
}
|
|
965504
|
+
await cliContext.runTask(async (context3) => {
|
|
965505
|
+
const deleteUrl = `${FDR_ORIGIN}/v2/registry/themes/${orgId}/${encodeURIComponent(name2)}`;
|
|
965506
|
+
context3.logger.debug(`Deleting theme at ${deleteUrl}`);
|
|
965507
|
+
let res;
|
|
965508
|
+
try {
|
|
965509
|
+
res = await fetch(deleteUrl, {
|
|
965510
|
+
method: "DELETE",
|
|
965511
|
+
headers: { Authorization: `Bearer ${token.value}` }
|
|
965512
|
+
});
|
|
965513
|
+
} catch (err) {
|
|
965514
|
+
context3.failAndThrow(
|
|
965515
|
+
`Failed to delete theme "${name2}" \u2014 could not reach ${FDR_ORIGIN}: ${describeFetchError(err)}`,
|
|
965516
|
+
void 0,
|
|
965517
|
+
{ code: CliError.Code.NetworkError }
|
|
965518
|
+
);
|
|
965519
|
+
return;
|
|
965520
|
+
}
|
|
965521
|
+
if (!res.ok) {
|
|
965522
|
+
const body = await res.text();
|
|
965523
|
+
const detail = parseErrorDetail(body) ?? body;
|
|
965524
|
+
context3.failAndThrow(`Failed to delete theme "${name2}": HTTP ${res.status} \u2014 ${detail}`, void 0, {
|
|
965525
|
+
code: CliError.Code.NetworkError
|
|
965526
|
+
});
|
|
965527
|
+
return;
|
|
965528
|
+
}
|
|
965529
|
+
context3.logger.info(`Theme "${name2}" deleted for org "${orgId}"`);
|
|
965530
|
+
});
|
|
965531
|
+
}
|
|
965532
|
+
|
|
965440
965533
|
// src/commands/docs-theme/exportDocsTheme.ts
|
|
965441
965534
|
init_lib6();
|
|
965442
965535
|
|
|
@@ -965525,32 +965618,6 @@ async function exportDocsTheme({
|
|
|
965525
965618
|
|
|
965526
965619
|
// src/commands/docs-theme/listDocsThemes.ts
|
|
965527
965620
|
init_lib6();
|
|
965528
|
-
|
|
965529
|
-
// src/commands/docs-theme/themeOrigin.ts
|
|
965530
|
-
var FDR_ORIGIN = process.env.OVERRIDE_FDR_ORIGIN ?? "https://registry.buildwithfern.com";
|
|
965531
|
-
function describeFetchError(error50) {
|
|
965532
|
-
if (!(error50 instanceof Error)) {
|
|
965533
|
-
return String(error50);
|
|
965534
|
-
}
|
|
965535
|
-
const cause = error50.cause;
|
|
965536
|
-
if (cause instanceof Error) {
|
|
965537
|
-
return cause.message;
|
|
965538
|
-
}
|
|
965539
|
-
return error50.message;
|
|
965540
|
-
}
|
|
965541
|
-
function parseErrorDetail(body) {
|
|
965542
|
-
try {
|
|
965543
|
-
const parsed = JSON.parse(body);
|
|
965544
|
-
const message = parsed.message ?? parsed.error?.message;
|
|
965545
|
-
if (typeof message === "string") {
|
|
965546
|
-
return message;
|
|
965547
|
-
}
|
|
965548
|
-
} catch {
|
|
965549
|
-
}
|
|
965550
|
-
return void 0;
|
|
965551
|
-
}
|
|
965552
|
-
|
|
965553
|
-
// src/commands/docs-theme/listDocsThemes.ts
|
|
965554
965621
|
async function listDocsThemes({
|
|
965555
965622
|
cliContext,
|
|
965556
965623
|
org,
|
|
@@ -973035,12 +973102,33 @@ function addDocsCommand2(cli, cliContext) {
|
|
|
973035
973102
|
}
|
|
973036
973103
|
function addDocsThemeCommand(cli, cliContext) {
|
|
973037
973104
|
cli.command("theme", "Manage org-level themes for your documentation", (yargs) => {
|
|
973105
|
+
addDocsThemeDeleteCommand(yargs, cliContext);
|
|
973038
973106
|
addDocsThemeExportCommand(yargs, cliContext);
|
|
973039
973107
|
addDocsThemeListCommand(yargs, cliContext);
|
|
973040
973108
|
addDocsThemeUploadCommand(yargs, cliContext);
|
|
973041
973109
|
return yargs;
|
|
973042
973110
|
});
|
|
973043
973111
|
}
|
|
973112
|
+
function addDocsThemeDeleteCommand(cli, cliContext) {
|
|
973113
|
+
cli.command(
|
|
973114
|
+
"delete",
|
|
973115
|
+
false,
|
|
973116
|
+
(yargs) => yargs.option("name", {
|
|
973117
|
+
alias: "n",
|
|
973118
|
+
type: "string",
|
|
973119
|
+
description: "Name of the theme to delete",
|
|
973120
|
+
demandOption: true
|
|
973121
|
+
}).option("force", {
|
|
973122
|
+
alias: "f",
|
|
973123
|
+
type: "boolean",
|
|
973124
|
+
description: "Skip the confirmation prompt"
|
|
973125
|
+
}).example("$0 docs theme delete --name dark", "Delete the theme named 'dark'").example("$0 docs theme delete --name dark --force", "Delete without confirmation"),
|
|
973126
|
+
async (argv) => {
|
|
973127
|
+
cliContext.instrumentPostHogEvent({ command: "fern docs theme delete" });
|
|
973128
|
+
await deleteDocsTheme({ cliContext, name: argv.name, force: argv.force });
|
|
973129
|
+
}
|
|
973130
|
+
);
|
|
973131
|
+
}
|
|
973044
973132
|
function addDocsThemeExportCommand(cli, cliContext) {
|
|
973045
973133
|
cli.command(
|
|
973046
973134
|
"export",
|
package/package.json
CHANGED