fern-api 0.16.22 → 0.16.23

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/bundle.cjs +25 -9
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -733501,6 +733501,9 @@ function getLanguageFromGeneratorName(generatorName) {
733501
733501
  // pnp:/home/circleci/project/packages/cli/config-management/generators-configuration/lib/loadGeneratorsConfiguration.js
733502
733502
  async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context }) {
733503
733503
  const filepath = getPathToGeneratorsConfiguration({ absolutePathToWorkspace });
733504
+ if (!await doesPathExist(filepath)) {
733505
+ return void 0;
733506
+ }
733504
733507
  const contentsStr = await (0, import_promises8.readFile)(filepath);
733505
733508
  const contentsParsed = js_yaml_default.load(contentsStr.toString());
733506
733509
  return validateSchema({
@@ -733512,6 +733515,9 @@ async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context
733512
733515
  }
733513
733516
  async function loadGeneratorsConfiguration({ absolutePathToWorkspace, context }) {
733514
733517
  const rawGeneratorsConfiguration = await loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context });
733518
+ if (rawGeneratorsConfiguration == null) {
733519
+ return void 0;
733520
+ }
733515
733521
  return convertGeneratorsConfiguration({
733516
733522
  absolutePathToGeneratorsConfiguration: getPathToGeneratorsConfiguration({ absolutePathToWorkspace }),
733517
733523
  rawGeneratorsConfiguration
@@ -736945,7 +736951,7 @@ var AccessTokenPosthogManager = class {
736945
736951
  properties: {
736946
736952
  ...event,
736947
736953
  ...event.properties,
736948
- version: "0.16.22",
736954
+ version: "0.16.23",
736949
736955
  usingAccessToken: true
736950
736956
  }
736951
736957
  });
@@ -737007,7 +737013,7 @@ var UserPosthogManager = class {
737007
737013
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
737008
737014
  event: "CLI",
737009
737015
  properties: {
737010
- version: "0.16.22",
737016
+ version: "0.16.23",
737011
737017
  ...event,
737012
737018
  ...event.properties
737013
737019
  }
@@ -754715,12 +754721,16 @@ function validateStructureOfYamlFiles({ files, absolutePathToDefinition }) {
754715
754721
 
754716
754722
  // pnp:/home/circleci/project/packages/cli/workspace-loader/lib/loadAPIWorkspace.js
754717
754723
  async function loadAPIWorkspace({ absolutePathToWorkspace, context, cliVersion, workspaceName }) {
754718
- const generatorsConfiguration = await loadGeneratorsConfiguration({ absolutePathToWorkspace, context });
754724
+ let generatorsConfiguration = void 0;
754725
+ try {
754726
+ generatorsConfiguration = await loadGeneratorsConfiguration({ absolutePathToWorkspace, context });
754727
+ } catch (err) {
754728
+ }
754719
754729
  const absolutePathToOpenAPIFolder = join(absolutePathToWorkspace, RelativeFilePath.of(OPENAPI_DIRECTORY));
754720
754730
  const openApiDirectoryExists = await doesPathExist(absolutePathToOpenAPIFolder);
754721
754731
  const absolutePathToAsyncAPIFolder = join(absolutePathToWorkspace, RelativeFilePath.of(ASYNCAPI_DIRECTORY));
754722
754732
  const asyncApiDirectoryExists = await doesPathExist(absolutePathToAsyncAPIFolder);
754723
- if (generatorsConfiguration.absolutePathToOpenAPI != null) {
754733
+ if ((generatorsConfiguration == null ? void 0 : generatorsConfiguration.absolutePathToOpenAPI) != null) {
754724
754734
  const absolutePathToAsyncAPI = generatorsConfiguration.absolutePathToAsyncAPI != null ? await getValidAbsolutePathToAsyncAPI(context, generatorsConfiguration.absolutePathToAsyncAPI) : void 0;
754725
754735
  const absolutePathToOpenAPI = await getValidAbsolutePathToOpenAPI(context, generatorsConfiguration.absolutePathToOpenAPI);
754726
754736
  return {
@@ -761566,10 +761576,10 @@ var CliContext = class {
761566
761576
  return "fern-api";
761567
761577
  }
761568
761578
  getPackageVersion() {
761569
- if ("0.16.22" == null) {
761579
+ if ("0.16.23" == null) {
761570
761580
  this.logger.error("CLI_VERSION is not defined");
761571
761581
  }
761572
- return "0.16.22";
761582
+ return "0.16.23";
761573
761583
  }
761574
761584
  getCliName() {
761575
761585
  if ("fern" == null) {
@@ -761889,13 +761899,14 @@ async function addGeneratorToWorkspaces({
761889
761899
  await Promise.all(
761890
761900
  apiWorkspaces.map(async (workspace) => {
761891
761901
  await cliContext.runTaskForWorkspace(workspace, async (context) => {
761902
+ var _a2;
761892
761903
  const generatorsConfiguration = await loadRawGeneratorsConfiguration({
761893
761904
  absolutePathToWorkspace: workspace.absoluteFilepath,
761894
761905
  context
761895
- });
761906
+ }) ?? {};
761896
761907
  const newConfiguration = addGenerator({ generatorName, generatorsConfiguration, groupName, context });
761897
761908
  await (0, import_promises28.writeFile)(
761898
- workspace.generatorsConfiguration.absolutePathToConfiguration,
761909
+ ((_a2 = workspace.generatorsConfiguration) == null ? void 0 : _a2.absolutePathToConfiguration) ?? getPathToGeneratorsConfiguration({ absolutePathToWorkspace: workspace.absoluteFilepath }),
761899
761910
  js_yaml_default.dump(newConfiguration)
761900
761911
  );
761901
761912
  context.logger.info(source_default.green(`Added ${generatorName} generator`));
@@ -777024,6 +777035,10 @@ async function generateWorkspace({
777024
777035
  useLocalDocker,
777025
777036
  keepDocker
777026
777037
  }) {
777038
+ if (workspace.generatorsConfiguration == null) {
777039
+ context.logger.warn("This workspaces has no generators.yml");
777040
+ return;
777041
+ }
777027
777042
  if (workspace.generatorsConfiguration.groups.length === 0) {
777028
777043
  context.logger.warn(`This workspaces has no groups specified in ${GENERATORS_CONFIGURATION_FILENAME}`);
777029
777044
  return;
@@ -777089,10 +777104,11 @@ async function generateAPIWorkspaces({
777089
777104
  command: "fern generate",
777090
777105
  properties: {
777091
777106
  workspaces: project.apiWorkspaces.map((workspace) => {
777107
+ var _a2;
777092
777108
  return {
777093
777109
  name: workspace.name,
777094
777110
  group: groupName,
777095
- generators: workspace.generatorsConfiguration.groups.filter((group) => groupName == null ? true : group.groupName === groupName).map((group) => {
777111
+ generators: (_a2 = workspace.generatorsConfiguration) == null ? void 0 : _a2.groups.filter((group) => groupName == null ? true : group.groupName === groupName).map((group) => {
777096
777112
  return group.generators.map((generator) => {
777097
777113
  return {
777098
777114
  name: generator.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.16.22",
3
+ "version": "0.16.23",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",