@fern-api/fern-api-dev 4.87.0-9-g230a150ab75 → 4.88.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.
Files changed (2) hide show
  1. package/cli.cjs +124 -88
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -615211,7 +615211,7 @@ var AccessTokenPosthogManager = class {
615211
615211
  properties: {
615212
615212
  ...event,
615213
615213
  ...event.properties,
615214
- version: "4.87.0-9-g230a150ab75",
615214
+ version: "4.88.0",
615215
615215
  usingAccessToken: true
615216
615216
  }
615217
615217
  });
@@ -615265,7 +615265,7 @@ var UserPosthogManager = class {
615265
615265
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
615266
615266
  event: "CLI",
615267
615267
  properties: {
615268
- version: "4.87.0-9-g230a150ab75",
615268
+ version: "4.88.0",
615269
615269
  ...event,
615270
615270
  ...event.properties,
615271
615271
  usingAccessToken: false,
@@ -832787,7 +832787,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
832787
832787
  var LOGS_FOLDER_NAME = "logs";
832788
832788
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
832789
832789
  function getCliSource() {
832790
- const version7 = "4.87.0-9-g230a150ab75";
832790
+ const version7 = "4.88.0";
832791
832791
  return `cli@${version7}`;
832792
832792
  }
832793
832793
  var DebugLogger = class {
@@ -844535,7 +844535,7 @@ var LegacyDocsPublisher = class {
844535
844535
  previewId,
844536
844536
  disableTemplates: void 0,
844537
844537
  skipUpload,
844538
- cliVersion: "4.87.0-9-g230a150ab75"
844538
+ cliVersion: "4.88.0"
844539
844539
  });
844540
844540
  if (taskContext.getResult() === TaskResult.Failure) {
844541
844541
  return { success: false };
@@ -919923,7 +919923,7 @@ var CliContext = class _CliContext {
919923
919923
  if (false) {
919924
919924
  this.logger.error("CLI_VERSION is not defined");
919925
919925
  }
919926
- return "4.87.0-9-g230a150ab75";
919926
+ return "4.88.0";
919927
919927
  }
919928
919928
  getCliName() {
919929
919929
  if (false) {
@@ -921643,6 +921643,23 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
921643
921643
  };
921644
921644
  }
921645
921645
 
921646
+ // src/commands/generate/expandGroupFilter.ts
921647
+ function expandGroupFilter(groupNames, generatorsConfiguration) {
921648
+ if (groupNames == null || groupNames.length === 0) {
921649
+ return null;
921650
+ }
921651
+ const expanded = [];
921652
+ for (const name2 of groupNames) {
921653
+ const aliasGroups = generatorsConfiguration?.groupAliases[name2];
921654
+ for (const resolved of aliasGroups ?? [name2]) {
921655
+ if (!expanded.includes(resolved)) {
921656
+ expanded.push(resolved);
921657
+ }
921658
+ }
921659
+ }
921660
+ return expanded;
921661
+ }
921662
+
921646
921663
  // src/commands/generate/generateAPIWorkspace.ts
921647
921664
  init_lib6();
921648
921665
 
@@ -921703,6 +921720,91 @@ function resolveGroupNamesForGeneration({
921703
921720
  };
921704
921721
  }
921705
921722
 
921723
+ // src/commands/generate/resolveGroupsOrFail.ts
921724
+ function resolveGroupsOrFail({
921725
+ groupNames,
921726
+ generatorsConfiguration,
921727
+ isAutomation,
921728
+ context: context3
921729
+ }) {
921730
+ if (groupNames == null || groupNames.length === 0) {
921731
+ return resolveSingleGroupOrFail({
921732
+ groupName: void 0,
921733
+ generatorsConfiguration,
921734
+ isAutomation,
921735
+ context: context3
921736
+ });
921737
+ }
921738
+ const resolved = [];
921739
+ for (const groupName of groupNames) {
921740
+ for (const name2 of resolveSingleGroupOrFail({
921741
+ groupName,
921742
+ generatorsConfiguration,
921743
+ isAutomation,
921744
+ context: context3
921745
+ })) {
921746
+ if (!resolved.includes(name2)) {
921747
+ resolved.push(name2);
921748
+ }
921749
+ }
921750
+ }
921751
+ return resolved;
921752
+ }
921753
+ function resolveSingleGroupOrFail({
921754
+ groupName,
921755
+ generatorsConfiguration,
921756
+ isAutomation,
921757
+ context: context3
921758
+ }) {
921759
+ const resolution = resolveGroupNamesForGeneration({ groupName, generatorsConfiguration, isAutomation });
921760
+ if (resolution.type === "fan-out") {
921761
+ return resolution.groupNames;
921762
+ }
921763
+ if (resolution.type === "missing-group") {
921764
+ const longestGroupName = Math.max(...resolution.availableGroupNames.map((name2) => name2.length));
921765
+ const currentArgs = process.argv.slice(2).join(" ");
921766
+ const suggestions = resolution.availableGroupNames.map((name2) => {
921767
+ const suggestedCommand = `fern ${currentArgs} --${GROUP_CLI_OPTION} ${name2}`;
921768
+ return ` \u203A ${source_default.bold(name2.padEnd(longestGroupName))} ${source_default.dim(suggestedCommand)}`;
921769
+ }).join("\n");
921770
+ context3.failAndThrow(
921771
+ `No group specified. Use the --${GROUP_CLI_OPTION} option, or set "${DEFAULT_GROUP_GENERATORS_CONFIG_KEY}" in ${GENERATORS_CONFIGURATION_FILENAME}:
921772
+ ${suggestions}`,
921773
+ void 0,
921774
+ { code: CliError.Code.NetworkError }
921775
+ );
921776
+ return [];
921777
+ }
921778
+ if (resolution.fromDefaultGroup) {
921779
+ context3.logger.info(
921780
+ source_default.dim(`Using default group '${resolution.groupName}' from ${GENERATORS_CONFIGURATION_FILENAME}`)
921781
+ );
921782
+ }
921783
+ const aliasResult = resolveGroupAlias({
921784
+ name: resolution.groupName,
921785
+ groupAliases: generatorsConfiguration.groupAliases,
921786
+ availableGroupNames: generatorsConfiguration.groups.map((g8) => g8.groupName)
921787
+ });
921788
+ if (aliasResult.type === "alias-references-missing-group") {
921789
+ context3.failAndThrow(
921790
+ `Group alias '${aliasResult.alias}' references non-existent group '${aliasResult.missingGroupName}'. Available groups: ${aliasResult.availableGroupNames.join(", ")}`,
921791
+ void 0,
921792
+ { code: CliError.Code.NetworkError }
921793
+ );
921794
+ return [];
921795
+ }
921796
+ if (aliasResult.type === "unknown") {
921797
+ const aliasesSuffix = aliasResult.availableAliasNames.length > 0 ? `. Available aliases: ${aliasResult.availableAliasNames.join(", ")}` : "";
921798
+ context3.failAndThrow(
921799
+ `'${aliasResult.name}' is not a valid group or alias. Available groups: ${aliasResult.availableGroupNames.join(", ")}${aliasesSuffix}`,
921800
+ void 0,
921801
+ { code: CliError.Code.NetworkError }
921802
+ );
921803
+ return [];
921804
+ }
921805
+ return aliasResult.groupNames;
921806
+ }
921807
+
921706
921808
  // src/commands/generate/describeSkipReason.ts
921707
921809
  function describeSkipReason(generator, rootAutorelease) {
921708
921810
  if (!generator.automation.generate) {
@@ -921777,7 +921879,7 @@ async function generateWorkspace({
921777
921879
  workspace,
921778
921880
  projectConfig,
921779
921881
  context: context3,
921780
- groupName,
921882
+ groupNames,
921781
921883
  generatorName,
921782
921884
  generatorIndex,
921783
921885
  version: version7,
@@ -921810,7 +921912,7 @@ async function generateWorkspace({
921810
921912
  return;
921811
921913
  }
921812
921914
  const resolvedGroupNames = resolveGroupsOrFail({
921813
- groupName,
921915
+ groupNames,
921814
921916
  generatorsConfiguration: workspace.generatorsConfiguration,
921815
921917
  isAutomation: automation != null,
921816
921918
  context: context3
@@ -921953,60 +922055,6 @@ function resolveRunnableGroup({
921953
922055
  }
921954
922056
  return group;
921955
922057
  }
921956
- function resolveGroupsOrFail({
921957
- groupName,
921958
- generatorsConfiguration,
921959
- isAutomation,
921960
- context: context3
921961
- }) {
921962
- const resolution = resolveGroupNamesForGeneration({ groupName, generatorsConfiguration, isAutomation });
921963
- if (resolution.type === "fan-out") {
921964
- return resolution.groupNames;
921965
- }
921966
- if (resolution.type === "missing-group") {
921967
- const longestGroupName = Math.max(...resolution.availableGroupNames.map((name2) => name2.length));
921968
- const currentArgs = process.argv.slice(2).join(" ");
921969
- const suggestions = resolution.availableGroupNames.map((name2) => {
921970
- const suggestedCommand = `fern ${currentArgs} --${GROUP_CLI_OPTION} ${name2}`;
921971
- return ` \u203A ${source_default.bold(name2.padEnd(longestGroupName))} ${source_default.dim(suggestedCommand)}`;
921972
- }).join("\n");
921973
- context3.failAndThrow(
921974
- `No group specified. Use the --${GROUP_CLI_OPTION} option, or set "${DEFAULT_GROUP_GENERATORS_CONFIG_KEY}" in ${GENERATORS_CONFIGURATION_FILENAME}:
921975
- ${suggestions}`,
921976
- void 0,
921977
- { code: CliError.Code.NetworkError }
921978
- );
921979
- return [];
921980
- }
921981
- if (resolution.fromDefaultGroup) {
921982
- context3.logger.info(
921983
- source_default.dim(`Using default group '${resolution.groupName}' from ${GENERATORS_CONFIGURATION_FILENAME}`)
921984
- );
921985
- }
921986
- const aliasResult = resolveGroupAlias({
921987
- name: resolution.groupName,
921988
- groupAliases: generatorsConfiguration.groupAliases,
921989
- availableGroupNames: generatorsConfiguration.groups.map((g8) => g8.groupName)
921990
- });
921991
- if (aliasResult.type === "alias-references-missing-group") {
921992
- context3.failAndThrow(
921993
- `Group alias '${aliasResult.alias}' references non-existent group '${aliasResult.missingGroupName}'. Available groups: ${aliasResult.availableGroupNames.join(", ")}`,
921994
- void 0,
921995
- { code: CliError.Code.NetworkError }
921996
- );
921997
- return [];
921998
- }
921999
- if (aliasResult.type === "unknown") {
922000
- const aliasesSuffix = aliasResult.availableAliasNames.length > 0 ? `. Available aliases: ${aliasResult.availableAliasNames.join(", ")}` : "";
922001
- context3.failAndThrow(
922002
- `'${aliasResult.name}' is not a valid group or alias. Available groups: ${aliasResult.availableGroupNames.join(", ")}${aliasesSuffix}`,
922003
- void 0,
922004
- { code: CliError.Code.NetworkError }
922005
- );
922006
- return [];
922007
- }
922008
- return aliasResult.groupNames;
922009
- }
922010
922058
  function applyLfsOverride(group, lfsOverridePath, context3) {
922011
922059
  const baseAbsolutePath = AbsoluteFilePath2.of(resolve6(cwd(), lfsOverridePath));
922012
922060
  const languageCount = {};
@@ -922096,7 +922144,7 @@ async function generateAPIWorkspaces({
922096
922144
  project,
922097
922145
  cliContext,
922098
922146
  version: version7,
922099
- groupName,
922147
+ groupNames,
922100
922148
  generatorName,
922101
922149
  generatorIndex,
922102
922150
  shouldLogS3Url,
@@ -922138,7 +922186,7 @@ async function generateAPIWorkspaces({
922138
922186
  }
922139
922187
  await confirmOutputDirectoriesForEligibleGenerators({
922140
922188
  project,
922141
- groupName,
922189
+ groupNames,
922142
922190
  generatorName,
922143
922191
  generatorIndex,
922144
922192
  automation,
@@ -922149,7 +922197,7 @@ async function generateAPIWorkspaces({
922149
922197
  orgId: project.config.organization,
922150
922198
  command: resolvePosthogCommandLabel(automation),
922151
922199
  properties: {
922152
- workspaces: buildPosthogWorkspaces({ project, groupName, generatorName })
922200
+ workspaces: buildPosthogWorkspaces({ project, groupNames, generatorName })
922153
922201
  }
922154
922202
  });
922155
922203
  await Promise.all(
@@ -922165,7 +922213,7 @@ async function generateAPIWorkspaces({
922165
922213
  projectConfig: project.config,
922166
922214
  context: context3,
922167
922215
  version: version7,
922168
- groupName,
922216
+ groupNames,
922169
922217
  generatorName,
922170
922218
  generatorIndex,
922171
922219
  shouldLogS3Url,
@@ -922194,7 +922242,7 @@ async function generateAPIWorkspaces({
922194
922242
  }
922195
922243
  async function confirmOutputDirectoriesForEligibleGenerators({
922196
922244
  project,
922197
- groupName,
922245
+ groupNames,
922198
922246
  generatorName,
922199
922247
  generatorIndex,
922200
922248
  automation,
@@ -922202,7 +922250,7 @@ async function confirmOutputDirectoriesForEligibleGenerators({
922202
922250
  force
922203
922251
  }) {
922204
922252
  for (const workspace of project.apiWorkspaces) {
922205
- const resolvedGroupNames = expandGroupFilter(groupName, workspace.generatorsConfiguration);
922253
+ const resolvedGroupNames = expandGroupFilter(groupNames, workspace.generatorsConfiguration);
922206
922254
  const rootAutorelease = workspace.generatorsConfiguration?.rawConfiguration.autorelease;
922207
922255
  const groupsInScope = workspace.generatorsConfiguration?.groups.filter(
922208
922256
  (group) => resolvedGroupNames == null || resolvedGroupNames.includes(group.groupName)
@@ -922235,14 +922283,14 @@ async function confirmOutputDirectoriesForEligibleGenerators({
922235
922283
  }
922236
922284
  function buildPosthogWorkspaces({
922237
922285
  project,
922238
- groupName,
922286
+ groupNames,
922239
922287
  generatorName
922240
922288
  }) {
922241
922289
  return project.apiWorkspaces.map((workspace) => {
922242
- const resolvedGroupNames = expandGroupFilter(groupName, workspace.generatorsConfiguration);
922290
+ const resolvedGroupNames = expandGroupFilter(groupNames, workspace.generatorsConfiguration);
922243
922291
  return {
922244
922292
  name: workspace.workspaceName,
922245
- group: groupName,
922293
+ group: groupNames != null && groupNames.length === 1 ? groupNames[0] : groupNames,
922246
922294
  generators: workspace.generatorsConfiguration?.groups.filter((group) => resolvedGroupNames == null || resolvedGroupNames.includes(group.groupName)).map(
922247
922295
  (group) => group.generators.filter((generator) => generatorName == null || generator.name === generatorName).map((generator) => ({
922248
922296
  name: generator.name,
@@ -922254,19 +922302,6 @@ function buildPosthogWorkspaces({
922254
922302
  };
922255
922303
  });
922256
922304
  }
922257
- function expandGroupFilter(groupName, generatorsConfiguration) {
922258
- if (groupName == null) {
922259
- return null;
922260
- }
922261
- if (generatorsConfiguration == null) {
922262
- return [groupName];
922263
- }
922264
- const aliasGroups = generatorsConfiguration.groupAliases[groupName];
922265
- if (aliasGroups != null) {
922266
- return aliasGroups;
922267
- }
922268
- return [groupName];
922269
- }
922270
922305
 
922271
922306
  // src/commands/automations/generate/GeneratorRunResult.ts
922272
922307
  function countResults(results) {
@@ -922459,7 +922494,7 @@ async function executeAutomationsGenerate({
922459
922494
  }),
922460
922495
  cliContext,
922461
922496
  version: options2.version,
922462
- groupName: options2.group,
922497
+ groupNames: options2.group != null ? [options2.group] : void 0,
922463
922498
  generatorName,
922464
922499
  generatorIndex,
922465
922500
  shouldLogS3Url: false,
@@ -939534,7 +939569,8 @@ function addGenerateCommand2(cli, cliContext) {
939534
939569
  description: "A stable identifier for the preview. Reusing the same ID overwrites the previous preview, keeping the URL stable."
939535
939570
  }).option("group", {
939536
939571
  type: "string",
939537
- description: "The group to generate"
939572
+ array: true,
939573
+ description: "The group to generate. Pass --group multiple times to generate for several groups at once."
939538
939574
  }).option("generator", {
939539
939575
  type: "string",
939540
939576
  description: "The name of a specific generator to run"
@@ -939715,7 +939751,7 @@ function addGenerateCommand2(cli, cliContext) {
939715
939751
  }),
939716
939752
  cliContext,
939717
939753
  version: argv.version,
939718
- groupName: argv.group,
939754
+ groupNames: argv.group,
939719
939755
  generatorName,
939720
939756
  generatorIndex,
939721
939757
  shouldLogS3Url: argv.printZipUrl,
@@ -939738,7 +939774,7 @@ function addGenerateCommand2(cli, cliContext) {
939738
939774
  });
939739
939775
  }
939740
939776
  if (argv.docs != null) {
939741
- if (argv.group != null) {
939777
+ if (argv.group != null && argv.group.length > 0) {
939742
939778
  cliContext.logger.warn("--group is ignored when generating docs");
939743
939779
  }
939744
939780
  if (argv.generator != null) {
@@ -939775,7 +939811,7 @@ function addGenerateCommand2(cli, cliContext) {
939775
939811
  }),
939776
939812
  cliContext,
939777
939813
  version: argv.version,
939778
- groupName: argv.group,
939814
+ groupNames: argv.group,
939779
939815
  generatorName,
939780
939816
  generatorIndex,
939781
939817
  shouldLogS3Url: argv.printZipUrl,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.87.0-9-g230a150ab75",
2
+ "version": "4.88.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",