nrwl / nx

Smart Monorepos ยท Fast CI
https://nx.dev
MIT License
23.51k stars 2.34k forks source link

How to use preserveLocalDependencyProtocols in nx 19.8.0? #28058

Open ccreusat opened 4 weeks ago

ccreusat commented 4 weeks ago

Current Behavior

When versioning with pnpm, all local dependency version protocols are replaced by semantic versions.

nx release version --specifier prerelease --preid develop-rc --dry-run
// package.json

-     "@edifice.io/icons": "workspace:*",
+     "@edifice.io/icons": "2.0.0-develop-rc.5",

Expected Behavior

After checking in feat(release): allow local dependency version protocols to be preserved, pnpm publish support, I should be able to use preserveLocalDependencyProtocols when versioning dependencies.

I should be able to use this arg and version like this:

nx release version --specifier prerelease --preid develop-rc --dry-run --preserveLocalDependencyProtocols

GitHub Repo

No response

Steps to Reproduce

  1. Install latest nx version (19.8.0) in monorepo
  2. Try versioning packages with pnpm as packageManager

Nx Report

NX   Report complete - copy this into the issue template

Node           : 20.12.1
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 9.4.0

nx (global)        : 19.8.0
nx                 : 19.8.0
@nx/js             : 19.8.0
@nx/eslint         : 19.8.0
@nx/eslint-plugin  : 19.8.0
@nx/storybook      : 19.8.0
@nrwl/tao          : 19.8.0
@nx/vite           : 19.8.0
typescript         : 5.3.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin

Failure Logs

No response

Package Manager Version

9.4.0

Operating System

Additional Information

Maybe I am misunderstanding the merged PR. I see preserveLocalDependencyProtocols in the declaration files and in packages/nx/src/command-line/release/version.ts interface but not in any options... so can't use it to configure with nx.json files or use it with the cli, something like:

nx release version --specifier prerelease --preid develop-rc --dry-run --preserveLocalDependencyProtocols

or

"version": {
      "preVersionCommand": "pnpm dlx nx run-many -t build",
      "conventionalCommits": true,
      "preserveLocalDependencyProtocols": true
}
ccreusat commented 3 weeks ago

hi @JamesHenry ! any help on this ? ๐Ÿ™๐Ÿผ

JamesHenry commented 3 weeks ago

It is a generator option

"version": {
  "generatorOptions": {
     ...
  }
}

Generator options are generic and each implementation provides its own so right now we can't add them to the schema, I am working on an outside the box solution for this.

We also need to document this option so I'll leave open to track that

JamesHenry commented 3 weeks ago

Here is a real world example: https://github.com/angular-eslint/angular-eslint/blob/159658fcd5174728533877ff36dc091644a44944/nx.json#L46

ccreusat commented 3 weeks ago

@JamesHenry Damn! I'm sure I tried with the generatorOptions based on the schema .. but maybe I did it wrong ๐Ÿ˜… I'll take a loot at this today. Thanks !

ccreusat commented 3 weeks ago

@JamesHenry working like a charm ! Thanks so much for this feature.

JamesHenry commented 3 weeks ago

Great, as mentioned we still need to document it so I'd like to leave this open to track that