@fern-api/fern-api-dev 4.63.0-5-g694a8cd1d34 → 4.63.0-7-g24fbe5d8426

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.
Files changed (2) hide show
  1. package/cli.cjs +56 -22
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -359558,12 +359558,12 @@ var require_cjs6 = __commonJS({
359558
359558
  target.push(buffer);
359559
359559
  };
359560
359560
  }
359561
- var import_child_process11;
359561
+ var import_child_process12;
359562
359562
  var GitExecutorChain2;
359563
359563
  var init_git_executor_chain2 = __esm3({
359564
359564
  "src/lib/runners/git-executor-chain.ts"() {
359565
359565
  "use strict";
359566
- import_child_process11 = require("child_process");
359566
+ import_child_process12 = require("child_process");
359567
359567
  init_git_error2();
359568
359568
  init_task2();
359569
359569
  init_utils9();
@@ -359713,7 +359713,7 @@ var require_cjs6 = __commonJS({
359713
359713
  rejection = reason || rejection;
359714
359714
  }
359715
359715
  });
359716
- const spawned = (0, import_child_process11.spawn)(command3, args, spawnOptions);
359716
+ const spawned = (0, import_child_process12.spawn)(command3, args, spawnOptions);
359717
359717
  spawned.stdout.on(
359718
359718
  "data",
359719
359719
  onDataReceived2(stdOut, "stdOut", logger4, outputLogger.step("stdOut"))
@@ -603120,7 +603120,7 @@ var AccessTokenPosthogManager = class {
603120
603120
  properties: {
603121
603121
  ...event,
603122
603122
  ...event.properties,
603123
- version: "4.63.0-5-g694a8cd1d34",
603123
+ version: "4.63.0-7-g24fbe5d8426",
603124
603124
  usingAccessToken: true
603125
603125
  }
603126
603126
  });
@@ -603171,7 +603171,7 @@ var UserPosthogManager = class {
603171
603171
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
603172
603172
  event: "CLI",
603173
603173
  properties: {
603174
- version: "4.63.0-5-g694a8cd1d34",
603174
+ version: "4.63.0-7-g24fbe5d8426",
603175
603175
  ...event,
603176
603176
  ...event.properties,
603177
603177
  usingAccessToken: false,
@@ -838081,6 +838081,7 @@ async function getPorts(options2) {
838081
838081
  init_lib4();
838082
838082
  init_js();
838083
838083
  init_lib6();
838084
+ var import_child_process6 = require("child_process");
838084
838085
  var import_cors = __toESM(require_lib14(), 1);
838085
838086
  var import_express2 = __toESM(require_express3(), 1);
838086
838087
  var import_fs25 = __toESM(require("fs"), 1);
@@ -839763,7 +839764,7 @@ var import_path54 = __toESM(require("path"), 1);
839763
839764
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
839764
839765
  var LOGS_FOLDER_NAME = "logs";
839765
839766
  function getCliSource() {
839766
- const version7 = "4.63.0-5-g694a8cd1d34";
839767
+ const version7 = "4.63.0-7-g24fbe5d8426";
839767
839768
  return `cli@${version7}`;
839768
839769
  }
839769
839770
  var DebugLogger = class {
@@ -840953,6 +840954,33 @@ function cleanFernDocsCacheSync(bundleRoot, context3) {
840953
840954
  context3.logger.debug(`Failed to clean Fern Docs cache: ${err}`);
840954
840955
  }
840955
840956
  }
840957
+ function killProcessesOnPort(targetPort, context3) {
840958
+ context3.logger.debug(`Killing any leftover processes on port ${targetPort}`);
840959
+ const isWindows = process.platform === "win32";
840960
+ const command3 = isWindows ? `netstat -ano | findstr :${targetPort} | findstr LISTENING` : `lsof -ti tcp:${targetPort}`;
840961
+ try {
840962
+ const output2 = (0, import_child_process6.execSync)(command3, { encoding: "utf-8", timeout: 5e3 });
840963
+ let pids;
840964
+ if (isWindows) {
840965
+ pids = output2.trim().split("\n").map((line) => line.trim().split(/\s+/).pop() ?? "").filter((pid) => pid.length > 0 && pid !== String(process.pid));
840966
+ pids = [...new Set(pids)];
840967
+ } else {
840968
+ pids = output2.trim().split("\n").map((pid) => pid.trim()).filter((pid) => pid.length > 0 && pid !== String(process.pid));
840969
+ }
840970
+ for (const pid of pids) {
840971
+ try {
840972
+ context3.logger.debug(`Killing leftover process ${pid} on port ${targetPort}`);
840973
+ if (isWindows) {
840974
+ (0, import_child_process6.execSync)(`taskkill /F /PID ${pid}`, { timeout: 5e3 });
840975
+ } else {
840976
+ process.kill(Number(pid), "SIGKILL");
840977
+ }
840978
+ } catch {
840979
+ }
840980
+ }
840981
+ } catch {
840982
+ }
840983
+ }
840956
840984
  async function runAppPreviewServer({ initialProject, reloadProject, validateProject, context: context3, port, bundlePath, backendPort, forceDownload }) {
840957
840985
  if (forceDownload) {
840958
840986
  const appPreviewFolder = getPathToPreviewFolder({ app: true });
@@ -841234,6 +841262,7 @@ ${err.stack}`);
841234
841262
  NODE_OPTIONS: "--max-old-space-size=8096 --enable-source-maps"
841235
841263
  };
841236
841264
  let serverProcess = null;
841265
+ let actualPort = port;
841237
841266
  const startNextJsServer = () => {
841238
841267
  return new Promise((resolve13) => {
841239
841268
  serverProcess = runExeca(context3.logger, "node", [serverPath], {
@@ -841243,6 +841272,10 @@ ${err.stack}`);
841243
841272
  const checkReady = (data2) => {
841244
841273
  const output2 = data2.toString();
841245
841274
  context3.logger.debug(`[Next.js] ${output2}`);
841275
+ const portMatch = output2.match(/localhost:(\d+)/);
841276
+ if (portMatch != null) {
841277
+ actualPort = Number(portMatch[1]);
841278
+ }
841246
841279
  if (output2.includes("Ready in") || output2.includes("\u2713 Ready")) {
841247
841280
  resolve13();
841248
841281
  }
@@ -841343,6 +841376,7 @@ ${err.stack}`);
841343
841376
  context3.logger.error(`Failed to kill server process: ${err}`);
841344
841377
  }
841345
841378
  }
841379
+ killProcessesOnPort(actualPort, context3);
841346
841380
  cleanFernDocsCacheSync(bundleRoot, context3);
841347
841381
  context3.logger.debug("Cleaning up WebSocket connections...");
841348
841382
  for (const [ws8, metadata] of connections) {
@@ -850878,7 +850912,7 @@ var LegacyDocsPublisher = class {
850878
850912
  previewId,
850879
850913
  disableTemplates: void 0,
850880
850914
  skipUpload,
850881
- cliVersion: "4.63.0-5-g694a8cd1d34"
850915
+ cliVersion: "4.63.0-7-g24fbe5d8426"
850882
850916
  });
850883
850917
  if (taskContext.getResult() === TaskResult.Failure) {
850884
850918
  return { success: false };
@@ -851956,7 +851990,7 @@ components:
851956
851990
  // ../cli-v2/lib/init/Wizard.js
851957
851991
  init_lib4();
851958
851992
  init_lib6();
851959
- var import_child_process6 = require("child_process");
851993
+ var import_child_process7 = require("child_process");
851960
851994
  var import_path58 = __toESM(require("path"), 1);
851961
851995
 
851962
851996
  // ../cli-v2/lib/ui/withSpinner.js
@@ -852598,7 +852632,7 @@ var Wizard = class {
852598
852632
  */
852599
852633
  openMacOsFinderDialog() {
852600
852634
  try {
852601
- const result = (0, import_child_process6.execSync)(`osascript -e 'POSIX path of (choose file with prompt "Select your API spec:" of type {"json", "yml", "yaml"})'`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
852635
+ const result = (0, import_child_process7.execSync)(`osascript -e 'POSIX path of (choose file with prompt "Select your API spec:" of type {"json", "yml", "yaml"})'`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
852602
852636
  return result.trim();
852603
852637
  } catch {
852604
852638
  return void 0;
@@ -852764,7 +852798,7 @@ function addCreateCommand(cli) {
852764
852798
  }
852765
852799
 
852766
852800
  // ../cli-v2/lib/commands/org/list/command.js
852767
- var import_child_process7 = require("child_process");
852801
+ var import_child_process8 = require("child_process");
852768
852802
  var ListCommand = class {
852769
852803
  async handle(context3) {
852770
852804
  const token = await context3.getTokenOrPrompt();
@@ -852875,7 +852909,7 @@ var ListCommand = class {
852875
852909
  getPager() {
852876
852910
  const defaultPager = process.platform === "win32" ? "more" : "less";
852877
852911
  const pagerCmd = process.env.PAGER ?? defaultPager;
852878
- return (0, import_child_process7.spawn)(pagerCmd, {
852912
+ return (0, import_child_process8.spawn)(pagerCmd, {
852879
852913
  stdio: ["pipe", "inherit", "inherit"],
852880
852914
  env: {
852881
852915
  ...process.env,
@@ -889294,10 +889328,10 @@ function generateDefaultCrateName(organization, apiName) {
889294
889328
  }
889295
889329
 
889296
889330
  // ../../../generators/rust/base/lib/formatter/RustFormatter.js
889297
- var import_child_process8 = require("child_process");
889331
+ var import_child_process9 = require("child_process");
889298
889332
  function formatRustSnippet(code5, logger4) {
889299
889333
  try {
889300
- const result = (0, import_child_process8.spawnSync)("rustfmt", ["--edition=2021"], {
889334
+ const result = (0, import_child_process9.spawnSync)("rustfmt", ["--edition=2021"], {
889301
889335
  input: code5,
889302
889336
  encoding: "utf8",
889303
889337
  timeout: 5e3
@@ -889316,7 +889350,7 @@ function formatRustSnippet(code5, logger4) {
889316
889350
  }
889317
889351
  async function formatRustSnippetAsync(code5, logger4) {
889318
889352
  return new Promise((resolve13) => {
889319
- const rustfmt = (0, import_child_process8.spawn)("rustfmt", ["--edition=2021"], {
889353
+ const rustfmt = (0, import_child_process9.spawn)("rustfmt", ["--edition=2021"], {
889320
889354
  stdio: "pipe"
889321
889355
  });
889322
889356
  rustfmt.stdin.write(code5);
@@ -902802,11 +902836,11 @@ generators:
902802
902836
  await fs18.mkdir(absolutePathToLocalOutput, { recursive: true });
902803
902837
  interactiveTaskContext.logger.debug(`Self-hosted GitHub mode: cloning ${selfhostedGithubConfig.uri} to ${absolutePathToLocalOutput}`);
902804
902838
  try {
902805
- const { execSync: execSync5 } = await import("child_process");
902806
- const gitPath = execSync5("which git 2>/dev/null || echo 'not found'", {
902839
+ const { execSync: execSync6 } = await import("child_process");
902840
+ const gitPath = execSync6("which git 2>/dev/null || echo 'not found'", {
902807
902841
  encoding: "utf-8"
902808
902842
  }).trim();
902809
- const gitVersion = execSync5("git --version 2>/dev/null || echo 'unknown'", {
902843
+ const gitVersion = execSync6("git --version 2>/dev/null || echo 'unknown'", {
902810
902844
  encoding: "utf-8"
902811
902845
  }).trim();
902812
902846
  interactiveTaskContext.logger.debug(`Git environment: path=${gitPath}, version=${gitVersion}, PATH=${process.env.PATH ?? "unset"}`);
@@ -924224,7 +924258,7 @@ var CliContext = class {
924224
924258
  if (false) {
924225
924259
  this.logger.error("CLI_VERSION is not defined");
924226
924260
  }
924227
- return "4.63.0-5-g694a8cd1d34";
924261
+ return "4.63.0-7-g24fbe5d8426";
924228
924262
  }
924229
924263
  getCliName() {
924230
924264
  if (false) {
@@ -935761,9 +935795,9 @@ function getAIEnhancerConfig2() {
935761
935795
  // src/commands/sdk-diff/sdkDiffCommand.ts
935762
935796
  init_lib4();
935763
935797
  init_lib6();
935764
- var import_child_process9 = require("child_process");
935798
+ var import_child_process10 = require("child_process");
935765
935799
  var import_util70 = require("util");
935766
- var execAsync = (0, import_util70.promisify)(import_child_process9.exec);
935800
+ var execAsync = (0, import_util70.promisify)(import_child_process10.exec);
935767
935801
  async function getClientRegistry(context3, project) {
935768
935802
  const workspace = project.apiWorkspaces[0];
935769
935803
  if (workspace == null) {
@@ -935943,10 +935977,10 @@ function computePreviewVersion({ previewId }) {
935943
935977
  }
935944
935978
 
935945
935979
  // src/commands/sdk-preview/getPreviewId.ts
935946
- var import_child_process10 = require("child_process");
935980
+ var import_child_process11 = require("child_process");
935947
935981
  var import_crypto12 = require("crypto");
935948
935982
  var import_util71 = require("util");
935949
- var execAsync2 = (0, import_util71.promisify)(import_child_process10.exec);
935983
+ var execAsync2 = (0, import_util71.promisify)(import_child_process11.exec);
935950
935984
  var MAX_PREVIEW_ID_LENGTH = 40;
935951
935985
  async function getPreviewId() {
935952
935986
  try {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.63.0-5-g694a8cd1d34",
2
+ "version": "4.63.0-7-g24fbe5d8426",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",