@fern-api/fern-api-dev 5.23.3-1768-g87d295561fa → 5.23.3-1769-g72dc1333c41

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 +193 -25
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -100959,8 +100959,8 @@ var require_graceful_fs = __commonJS({
100959
100959
  }
100960
100960
  }
100961
100961
  var fs$writeFile = fs35.writeFile;
100962
- fs35.writeFile = writeFile102;
100963
- function writeFile102(path120, data2, options2, cb) {
100962
+ fs35.writeFile = writeFile103;
100963
+ function writeFile103(path120, data2, options2, cb) {
100964
100964
  if (typeof options2 === "function")
100965
100965
  cb = options2, options2 = null;
100966
100966
  return go$writeFile(path120, data2, options2, cb);
@@ -460369,13 +460369,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
460369
460369
  }
460370
460370
  }
460371
460371
  }
460372
- const { writeFile: writeFile102 } = await import("fs/promises");
460372
+ const { writeFile: writeFile103 } = await import("fs/promises");
460373
460373
  const yamlContent = index_vite_proxy_tmp_default.dump(parsed, {
460374
460374
  indent: 2,
460375
460375
  lineWidth: -1,
460376
460376
  noRefs: true
460377
460377
  });
460378
- await writeFile102(overrideFilePath, yamlContent, "utf-8");
460378
+ await writeFile103(overrideFilePath, yamlContent, "utf-8");
460379
460379
  context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
460380
460380
  return {
460381
460381
  removedCount: validationResult.invalidCount,
@@ -483704,8 +483704,8 @@ var require_graceful_fs2 = __commonJS({
483704
483704
  }
483705
483705
  }
483706
483706
  var fs$writeFile = fs35.writeFile;
483707
- fs35.writeFile = writeFile102;
483708
- function writeFile102(path120, data2, options2, cb) {
483707
+ fs35.writeFile = writeFile103;
483708
+ function writeFile103(path120, data2, options2, cb) {
483709
483709
  if (typeof options2 === "function")
483710
483710
  cb = options2, options2 = null;
483711
483711
  return go$writeFile(path120, data2, options2, cb);
@@ -626889,7 +626889,7 @@ var require_jsonfile = __commonJS({
626889
626889
  const str2 = stringify5(obj, options2);
626890
626890
  await universalify.fromCallback(fs34.writeFile)(file4, str2, options2);
626891
626891
  }
626892
- var writeFile102 = universalify.fromPromise(_writeFile);
626892
+ var writeFile103 = universalify.fromPromise(_writeFile);
626893
626893
  function writeFileSync9(file4, obj, options2 = {}) {
626894
626894
  const fs34 = options2.fs || _fs;
626895
626895
  const str2 = stringify5(obj, options2);
@@ -626898,7 +626898,7 @@ var require_jsonfile = __commonJS({
626898
626898
  module4.exports = {
626899
626899
  readFile: readFile121,
626900
626900
  readFileSync: readFileSync19,
626901
- writeFile: writeFile102,
626901
+ writeFile: writeFile103,
626902
626902
  writeFileSync: writeFileSync9
626903
626903
  };
626904
626904
  }
@@ -694418,7 +694418,7 @@ var AccessTokenPosthogManager = class {
694418
694418
  properties: {
694419
694419
  ...event,
694420
694420
  ...event.properties,
694421
- version: "5.23.3-1768-g87d295561fa",
694421
+ version: "5.23.3-1769-g72dc1333c41",
694422
694422
  usingAccessToken: true,
694423
694423
  ...getRunIdProperties()
694424
694424
  }
@@ -694484,7 +694484,7 @@ var UserPosthogManager = class {
694484
694484
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
694485
694485
  event: "CLI",
694486
694486
  properties: {
694487
- version: "5.23.3-1768-g87d295561fa",
694487
+ version: "5.23.3-1769-g72dc1333c41",
694488
694488
  ...event,
694489
694489
  ...event.properties,
694490
694490
  usingAccessToken: false,
@@ -875614,7 +875614,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
875614
875614
  var LOGS_FOLDER_NAME = "logs";
875615
875615
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
875616
875616
  function getCliSource() {
875617
- const version7 = "5.23.3-1768-g87d295561fa";
875617
+ const version7 = "5.23.3-1769-g72dc1333c41";
875618
875618
  return `cli@${version7}`;
875619
875619
  }
875620
875620
  var DebugLogger = class {
@@ -908324,7 +908324,7 @@ var LegacyDocsPublisher = class {
908324
908324
  previewId,
908325
908325
  disableTemplates: void 0,
908326
908326
  skipUpload,
908327
- cliVersion: "5.23.3-1768-g87d295561fa",
908327
+ cliVersion: "5.23.3-1769-g72dc1333c41",
908328
908328
  loginCommand: "fern auth login"
908329
908329
  });
908330
908330
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -975214,7 +975214,7 @@ function getAutomationContextFromEnv() {
975214
975214
  config_branch: process.env.FERN_CONFIG_BRANCH,
975215
975215
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
975216
975216
  trigger: process.env.GITHUB_EVENT_NAME,
975217
- cli_version: "5.23.3-1768-g87d295561fa"
975217
+ cli_version: "5.23.3-1769-g72dc1333c41"
975218
975218
  };
975219
975219
  }
975220
975220
  function isAutomationMode() {
@@ -976046,7 +976046,7 @@ var CliContext = class _CliContext {
976046
976046
  if (false) {
976047
976047
  this.logger.error("CLI_VERSION is not defined");
976048
976048
  }
976049
- return "5.23.3-1768-g87d295561fa";
976049
+ return "5.23.3-1769-g72dc1333c41";
976050
976050
  }
976051
976051
  getCliName() {
976052
976052
  if (false) {
@@ -977858,7 +977858,8 @@ async function packLocalOutputForGroup({
977858
977858
  context: context3,
977859
977859
  mode = "host",
977860
977860
  runner,
977861
- packOnly = false
977861
+ packOnly = false,
977862
+ version: version7
977862
977863
  }) {
977863
977864
  const failures = [];
977864
977865
  for (const generator of group.generators) {
@@ -977880,7 +977881,8 @@ async function packLocalOutputForGroup({
977880
977881
  outputPath,
977881
977882
  context: context3,
977882
977883
  mode,
977883
- runner: runner ?? "docker"
977884
+ runner: runner ?? "docker",
977885
+ version: version7
977884
977886
  });
977885
977887
  if (packOnly) {
977886
977888
  if (artifactProduced) {
@@ -977907,7 +977909,8 @@ async function packOutputForLanguage({
977907
977909
  outputPath,
977908
977910
  context: context3,
977909
977911
  mode,
977910
- runner
977912
+ runner,
977913
+ version: version7
977911
977914
  }) {
977912
977915
  const distDir = join8(outputPath, RelativeFilePath2.of(PACK_OUTPUT_DIRECTORY));
977913
977916
  const run = async (commands) => {
@@ -977916,26 +977919,103 @@ async function packOutputForLanguage({
977916
977919
  switch (language) {
977917
977920
  case "typescript": {
977918
977921
  await (0, import_promises168.mkdir)(distDir, { recursive: true });
977919
- const commands = [["npm", "install"]];
977922
+ await run([["npm", "install"]]);
977920
977923
  if (await hasNpmScript({ outputPath, script: "build" })) {
977921
- commands.push(["npm", "run", "build"]);
977924
+ await run([["npx", "--yes", "pnpm", "run", "build"]]);
977925
+ } else {
977926
+ const tsconfig = await findTsconfig(outputPath);
977927
+ if (tsconfig != null) {
977928
+ try {
977929
+ await run([["npx", "--yes", "--package", "typescript", "tsc", "--project", tsconfig]]);
977930
+ } catch (error50) {
977931
+ if (!await hasEmittedCompilerOutput({ outputPath, tsconfig })) {
977932
+ throw error50;
977933
+ }
977934
+ context3.logger.warn(
977935
+ `tsc reported errors while compiling ${tsconfig}; packing the emitted output anyway.`
977936
+ );
977937
+ }
977938
+ }
977939
+ }
977940
+ const npmignorePath = join8(outputPath, RelativeFilePath2.of(".npmignore"));
977941
+ const shouldWriteNpmignore = !await doesPathExist(npmignorePath) && !await hasPackageJsonFilesField(outputPath) && await doesPathExist(join8(outputPath, RelativeFilePath2.of(".gitignore")));
977942
+ if (shouldWriteNpmignore) {
977943
+ await (0, import_promises168.writeFile)(npmignorePath, `${PACK_OUTPUT_DIRECTORY}/
977944
+ `);
977945
+ }
977946
+ try {
977947
+ await run([["npm", "pack", "--pack-destination", PACK_OUTPUT_DIRECTORY]]);
977948
+ } finally {
977949
+ if (shouldWriteNpmignore) {
977950
+ await (0, import_promises168.rm)(npmignorePath, { force: true });
977951
+ }
977922
977952
  }
977923
- commands.push(["npm", "pack", "--pack-destination", PACK_OUTPUT_DIRECTORY]);
977924
- await run(commands);
977925
977953
  logArtifacts({ distDir, context: context3 });
977926
977954
  return true;
977927
977955
  }
977928
977956
  case "python": {
977929
977957
  await (0, import_promises168.mkdir)(distDir, { recursive: true });
977930
- await run([["python3", "-m", "pip", "wheel", ".", "--no-deps", "--wheel-dir", PACK_OUTPUT_DIRECTORY]]);
977958
+ const pipWheelCommand = [
977959
+ "python3",
977960
+ "-m",
977961
+ "pip",
977962
+ "wheel",
977963
+ ".",
977964
+ "--no-deps",
977965
+ "--wheel-dir",
977966
+ PACK_OUTPUT_DIRECTORY
977967
+ ];
977968
+ if (mode === "host") {
977969
+ try {
977970
+ await run([pipWheelCommand]);
977971
+ } catch {
977972
+ context3.logger.warn(
977973
+ "pip wheel failed on the host toolchain; retrying in an isolated build environment (python -m venv + python -m build)."
977974
+ );
977975
+ const venvDirectory = ".fern-pack-venv";
977976
+ const venvPython = process.platform === "win32" ? `${venvDirectory}/Scripts/python` : `${venvDirectory}/bin/python`;
977977
+ try {
977978
+ await run([
977979
+ ["python3", "-m", "venv", venvDirectory],
977980
+ [venvPython, "-m", "pip", "install", "--quiet", "build"],
977981
+ [venvPython, "-m", "build", "--wheel", "--outdir", PACK_OUTPUT_DIRECTORY]
977982
+ ]);
977983
+ } finally {
977984
+ await (0, import_promises168.rm)(join8(outputPath, RelativeFilePath2.of(venvDirectory)), {
977985
+ recursive: true,
977986
+ force: true
977987
+ });
977988
+ }
977989
+ }
977990
+ } else {
977991
+ await run([pipWheelCommand]);
977992
+ }
977931
977993
  logArtifacts({ distDir, context: context3 });
977932
977994
  return true;
977933
977995
  }
977934
977996
  case "java": {
977935
977997
  await (0, import_promises168.mkdir)(distDir, { recursive: true });
977936
- await run([["gradle", "jar", "-x", "test"]]);
977998
+ const initScriptName = ".fern-pack-pom-init.gradle";
977999
+ const initScriptPath = join8(outputPath, RelativeFilePath2.of(initScriptName));
978000
+ await (0, import_promises168.writeFile)(initScriptPath, getJavaPomInitScript({ fallbackVersion: version7 ?? "0.0.0" }));
978001
+ try {
978002
+ await run([
978003
+ [
978004
+ "gradle",
978005
+ "--init-script",
978006
+ initScriptName,
978007
+ "jar",
978008
+ `generatePomFileFor${JAVA_POM_PUBLICATION_NAME_CAPITALIZED}Publication`,
978009
+ "-x",
978010
+ "test"
978011
+ ]
978012
+ ]);
978013
+ } finally {
978014
+ await (0, import_promises168.rm)(initScriptPath, { force: true });
978015
+ }
977937
978016
  const libsDir = join8(outputPath, RelativeFilePath2.of("build/libs"));
977938
978017
  await copyMatchingFiles({ fromDir: libsDir, toDir: distDir, extension: ".jar" });
978018
+ await copyGeneratedPom({ outputPath, distDir, context: context3 });
977939
978019
  logArtifacts({ distDir, context: context3 });
977940
978020
  return true;
977941
978021
  }
@@ -978017,7 +978097,8 @@ async function runPackCommands({
978017
978097
  if (image3 == null) {
978018
978098
  throw new Error(`No Docker toolchain image is configured for ${language}.`);
978019
978099
  }
978020
- const containerArgs = ["run", "--rm", "-v", `${outputPath}:/workspace`, "-w", "/workspace", "-e", "HOME=/tmp"];
978100
+ const workdir = `/workspace/${(0, import_path110.basename)(outputPath)}`;
978101
+ const containerArgs = ["run", "--rm", "-v", `${outputPath}:${workdir}`, "-w", workdir, "-e", "HOME=/tmp"];
978021
978102
  if (process.getuid != null && process.getgid != null) {
978022
978103
  containerArgs.push("--user", `${process.getuid()}:${process.getgid()}`);
978023
978104
  }
@@ -978083,6 +978164,86 @@ async function removeDistDirIfEmpty(outputPath) {
978083
978164
  } catch {
978084
978165
  }
978085
978166
  }
978167
+ var JAVA_POM_PUBLICATION_NAME = "fernLocalPack";
978168
+ var JAVA_POM_PUBLICATION_NAME_CAPITALIZED = "FernLocalPack";
978169
+ function getJavaPomInitScript({ fallbackVersion }) {
978170
+ return `allprojects { project ->
978171
+ project.plugins.withId("java") {
978172
+ project.apply plugin: "maven-publish"
978173
+ project.afterEvaluate {
978174
+ if (project.group == null || project.group.toString().isEmpty()) {
978175
+ project.group = project.name
978176
+ }
978177
+ if (project.version == null || project.version.toString() == "unspecified") {
978178
+ project.version = "${fallbackVersion}"
978179
+ }
978180
+ if (project.publishing.publications.findByName("${JAVA_POM_PUBLICATION_NAME}") == null) {
978181
+ project.publishing.publications.create("${JAVA_POM_PUBLICATION_NAME}", MavenPublication) {
978182
+ from project.components.java
978183
+ }
978184
+ }
978185
+ }
978186
+ }
978187
+ }
978188
+ `;
978189
+ }
978190
+ async function copyGeneratedPom({
978191
+ outputPath,
978192
+ distDir,
978193
+ context: context3
978194
+ }) {
978195
+ const pomPath = join8(
978196
+ outputPath,
978197
+ RelativeFilePath2.of(`build/publications/${JAVA_POM_PUBLICATION_NAME}/pom-default.xml`)
978198
+ );
978199
+ if (!await doesPathExist(pomPath)) {
978200
+ context3.logger.warn(
978201
+ "No POM was generated for the Java package; the JAR is packaged without dependency metadata."
978202
+ );
978203
+ return;
978204
+ }
978205
+ const jarNames = (await (0, import_promises168.readdir)(distDir)).filter((file4) => file4.endsWith(".jar"));
978206
+ const jarName = jarNames.find((file4) => !file4.endsWith("-sources.jar") && !file4.endsWith("-javadoc.jar")) ?? jarNames[0];
978207
+ const pomName = jarName != null ? `${jarName.slice(0, -".jar".length)}.pom` : "pom.xml";
978208
+ await (0, import_promises168.copyFile)(pomPath, join8(distDir, RelativeFilePath2.of(pomName)));
978209
+ }
978210
+ async function hasEmittedCompilerOutput({
978211
+ outputPath,
978212
+ tsconfig
978213
+ }) {
978214
+ let outDir = "dist";
978215
+ try {
978216
+ const parsed = JSON.parse(await (0, import_promises168.readFile)(join8(outputPath, RelativeFilePath2.of(tsconfig)), "utf-8"));
978217
+ if (typeof parsed === "object" && parsed != null && "compilerOptions" in parsed) {
978218
+ const compilerOptions = parsed.compilerOptions;
978219
+ if (typeof compilerOptions === "object" && compilerOptions != null && "outDir" in compilerOptions && typeof compilerOptions.outDir === "string") {
978220
+ outDir = compilerOptions.outDir;
978221
+ }
978222
+ }
978223
+ } catch {
978224
+ }
978225
+ const outDirPath = join8(outputPath, RelativeFilePath2.of(outDir));
978226
+ if (!await doesPathExist(outDirPath)) {
978227
+ return false;
978228
+ }
978229
+ return (await (0, import_promises168.readdir)(outDirPath)).length > 0;
978230
+ }
978231
+ async function findTsconfig(outputPath) {
978232
+ for (const candidate of ["tsconfig.cjs.json", "tsconfig.json"]) {
978233
+ if (await doesPathExist(join8(outputPath, RelativeFilePath2.of(candidate)))) {
978234
+ return candidate;
978235
+ }
978236
+ }
978237
+ return void 0;
978238
+ }
978239
+ async function hasPackageJsonFilesField(outputPath) {
978240
+ const packageJsonPath = join8(outputPath, RelativeFilePath2.of("package.json"));
978241
+ if (!await doesPathExist(packageJsonPath)) {
978242
+ return false;
978243
+ }
978244
+ const parsed = JSON.parse(await (0, import_promises168.readFile)(packageJsonPath, "utf-8"));
978245
+ return typeof parsed === "object" && parsed != null && "files" in parsed;
978246
+ }
978086
978247
  async function hasNpmScript({
978087
978248
  outputPath,
978088
978249
  script
@@ -978376,7 +978537,14 @@ async function generateWorkspace({
978376
978537
  });
978377
978538
  }
978378
978539
  if (pack) {
978379
- await packLocalOutputForGroup({ group, context: groupContext, mode: packMode, runner, packOnly });
978540
+ await packLocalOutputForGroup({
978541
+ group,
978542
+ context: groupContext,
978543
+ mode: packMode,
978544
+ runner,
978545
+ packOnly,
978546
+ version: version7
978547
+ });
978380
978548
  }
978381
978549
  })
978382
978550
  )
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.23.3-1768-g87d295561fa",
2
+ "version": "5.23.3-1769-g72dc1333c41",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",