Skip to content

VersionActions API does not match VersionDataEntry #35913

@mpsanchis

Description

@mpsanchis

Current Behavior

The current VersionDataEntry is the only explicit documentation of what a custom nx-release-publish executor will receive as options, as it is automatically injected by nx release. It declares:

    dependencyCollection: string;
    rawVersionSpec: string;

However, this information will be built by leveraging all VersionActions classes in the repo, which must extend an abstract class that has methods such as:

  abstract readCurrentVersionOfDependency(
    tree: Tree,
    projectGraph: ProjectGraph,
    dependencyProjectName: string
  ): Promise<{
    currentVersion: string | null;
    dependencyCollection: string | null;
  }>;

There is a mismatch, at least in dependencyCollection and rawVersionSpec: schema says they are strings, but at runtime they can be null.

Expected Behavior

VersionActions and VersionData share the same schema, as one is the producer and the other is the consumer of some data.

GitHub Repo

No response

Steps to Reproduce

  1. Build a custom VersionActions class that correctly extends VersionActions, and returns null for dependencyCollection (for instance in readCurrentVersionOfDependency
  2. Define a schema.json which includes a VersionData which matches the TS interface (dependencyCollection is string, and is present)
  3. Run nx release

Nx Report

Node           : 22.14.0
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 10.12.1
daemon         : Available

nx                     : 22.7.1
@nx/js                 : 22.7.1
@nx/eslint             : 22.7.1
@nx/workspace          : 22.7.1
@nx/jest               : 22.7.1
@nx/cypress            : 22.7.1
@nx/devkit             : 22.7.1
@nx/eslint-plugin      : 22.7.1
@nx/module-federation  : 22.7.1
@nx/playwright         : 22.7.1
@nx/plugin             : 22.7.1
@nx/react              : 22.7.1
@nx/rollup             : 22.7.1
@nx/storybook          : 22.7.1
@nx/vite               : 22.7.1
@nx/vitest             : 22.7.1
@nx/web                : 22.7.1
@nx/docker             : 22.7.1
typescript             : 5.9.2

---------------------------------------
Registered Plugins:
// ... local plugins
---------------------------------------
Community plugins:
// ... local plugins
@nx/conformance                       : 5.0.0
---------------------------------------
Local workspace plugins:
// ... local plugins
---------------------------------------
Cache Usage: 4.04 MB / 92.64 GB

Failure Logs

NX   Property 'dependencyCollection' does not match the schema.
{
  "type": "string",
  "description": "Dependency collection name"
}'
Property 'dependencyCollection' does not match the schema.
{
  "type": "string",
  "description": "Dependency collection name"
}'

Package Manager Version

pnpm 10.12.1

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Hint: the Nx repo itself could enforce strict null checks and probably catch these issues when calling tsc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions