This PR introduces a new feature to the Fern CLI, which checks that the generator versions you are running are compatible with your Fern CLI version. It also adds availability and display-names to discriminated union values, allowing users to mark their union values in their docs.
The PR also includes the following changes:
A new GeneratorGroupSchema is exported from the index.ts file in the packages/cli/configuration/src/generators-yml directory.
The @fern-api/core dependency is added to the package.json file in the packages/cli/fern-definition/validator directory.
A new generatorInvocation type is added to the GeneratorsYmlFileAstNodeTypes interface in the GeneratorsYmlAstVisitor.ts file in the packages/cli/fern-definition/validator/src/ast directory.
The visitGeneratorsYamlAst function in the visitGeneratorsYamlAst.ts file in the packages/cli/fern-definition/validator/src/ast directory is updated to include a new groups property, which asynchronously calls the visitGeneratorGroups function.
A new visitGeneratorGroups function is added to the visitGeneratorGroups.ts file in the packages/cli/fern-definition/validator/src/ast/visitors directory. This function iterates over the groups object and calls the visitGeneratorGroup function for each group.
A new createGeneratorsYmlAstVisitorForRules function is added to the createGeneratorsYmlAstVisitorForRules.ts file in the packages/cli/fern-definition/validator/src/ast directory. This function creates an AST node visitor for the file and generatorInvocation node types.
A new CompatibleIrVersionsRule is added to the getAllRules.ts file in the packages/cli/fern-definition/validator/src/rules directory.
A new test file, compatible-ir-versions.test.ts, is added to the packages/cli/fern-definition/validator/src/rules/compatible-ir-versions/__test__ directory. This file contains a test for the compatible-ir-versions rule.
A new CompatibleIrVersionsRule is added to the compatible-ir-versions.ts file in the packages/cli/fern-definition/validator/src/rules/compatible-ir-versions directory. This rule checks that the generator versions are compatible with the CLI version.
The getViolationsForRule function in the getViolationsForRule.ts file in the packages/cli/fern-definition/validator/src/testing-utils directory is updated to include a new cliVersion property in the Args interface.
The validateFernWorkspace function in the validateFernWorkspace.ts file in the packages/cli/fern-definition/validator/src directory is updated to include a new validateGeneratorsYmlFile function, which validates the generators.yml file using the createGeneratorsYmlAstVisitorForRules and visitGeneratorsYamlAst functions.
The @fern-fern/generators-sdk dependency is added to the package.json file in the packages/core directory.
A new createFdrGeneratorsSdkService function is added to the fdrGeneratorsSdk.ts file in the packages/core/src/services directory. This function creates an instance of the FernRegistryClient class from the @fern-fern/generators-sdk package.
The createFdrGeneratorsSdkService function is exported from the index.ts file in the packages/core/src/services directory.
Fixes FER-3011
This PR introduces a new feature to the Fern CLI, which checks that the generator versions you are running are compatible with your Fern CLI version. It also adds availability and display-names to discriminated union values, allowing users to mark their union values in their docs.
The PR also includes the following changes:
GeneratorGroupSchema
is exported from theindex.ts
file in thepackages/cli/configuration/src/generators-yml
directory.@fern-api/core
dependency is added to thepackage.json
file in thepackages/cli/fern-definition/validator
directory.generatorInvocation
type is added to theGeneratorsYmlFileAstNodeTypes
interface in theGeneratorsYmlAstVisitor.ts
file in thepackages/cli/fern-definition/validator/src/ast
directory.visitGeneratorsYamlAst
function in thevisitGeneratorsYamlAst.ts
file in thepackages/cli/fern-definition/validator/src/ast
directory is updated to include a newgroups
property, which asynchronously calls thevisitGeneratorGroups
function.visitGeneratorGroups
function is added to thevisitGeneratorGroups.ts
file in thepackages/cli/fern-definition/validator/src/ast/visitors
directory. This function iterates over thegroups
object and calls thevisitGeneratorGroup
function for each group.createGeneratorsYmlAstVisitorForRules
function is added to thecreateGeneratorsYmlAstVisitorForRules.ts
file in thepackages/cli/fern-definition/validator/src/ast
directory. This function creates an AST node visitor for thefile
andgeneratorInvocation
node types.CompatibleIrVersionsRule
is added to thegetAllRules.ts
file in thepackages/cli/fern-definition/validator/src/rules
directory.compatible-ir-versions.test.ts
, is added to thepackages/cli/fern-definition/validator/src/rules/compatible-ir-versions/__test__
directory. This file contains a test for thecompatible-ir-versions
rule.CompatibleIrVersionsRule
is added to thecompatible-ir-versions.ts
file in thepackages/cli/fern-definition/validator/src/rules/compatible-ir-versions
directory. This rule checks that the generator versions are compatible with the CLI version.getViolationsForRule
function in thegetViolationsForRule.ts
file in thepackages/cli/fern-definition/validator/src/testing-utils
directory is updated to include a newcliVersion
property in theArgs
interface.validateFernWorkspace
function in thevalidateFernWorkspace.ts
file in thepackages/cli/fern-definition/validator/src
directory is updated to include a newvalidateGeneratorsYmlFile
function, which validates thegenerators.yml
file using thecreateGeneratorsYmlAstVisitorForRules
andvisitGeneratorsYamlAst
functions.@fern-fern/generators-sdk
dependency is added to thepackage.json
file in thepackages/core
directory.createFdrGeneratorsSdkService
function is added to thefdrGeneratorsSdk.ts
file in thepackages/core/src/services
directory. This function creates an instance of theFernRegistryClient
class from the@fern-fern/generators-sdk
package.createFdrGeneratorsSdkService
function is exported from theindex.ts
file in thepackages/core/src/services
directory.