nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.49k stars 2.34k forks source link

`nx release` command not working properly on windows #28392

Open ErickRodrCodes opened 1 week ago

ErickRodrCodes commented 1 week ago

Current Behavior

Following this tutorial on the documentation of nx release, I noted that the commit for the release totally stop to work:

Image

As a result, a botched release happens without any release, causing the git command to fail:

Image

digging more into the cause, it seems that message is not parsing properly the message into "quotes" here:

https://github.com/nrwl/nx/blob/db10812da789cd48d3a722628a00feda9d0e3810/packages/nx/src/command-line/release/utils/git.ts#L263

One solution is to parse the string properly for --message:

Image

by using JSON.stringify, we can parse properly the string being passed to --message... and pretty much it fixes the issue

Image

Expected Behavior

it would be advisable to review how --message contents are being parsed . Using JSON.parse ensures that the script being passed, has double quotes as --messages needs it.

GitHub Repo

No response

Steps to Reproduce

run in a windows machine nx release --skip-publish --first-release --verbose. It will potentially fail in Nx 20

Nx Report

NX Report complete - copy this into the issue template

Node : 20.17.0 OS : win32-x64 Native Target : x86_64-windows npm : 10.8.2

nx (global) : 20.0.0 nx : 20.0.0 @nx/js : 20.0.0 @nx/jest : 20.0.0 @nx/eslint : 20.0.0 @nx/workspace : 20.0.0 @nx/devkit : 20.0.0 @nx/esbuild : 20.0.0 @nx/eslint-plugin : 20.0.0 @nx/node : 20.0.0 typescript : 5.5.4

Registered Plugins: @nx/eslint/plugin @nx/jest/plugin

Failure Logs

No response

Package Manager Version

npm

Operating System

Additional Information

No response

ErickRodrCodes commented 3 days ago

Hi @jaysoo let me know if we can connect and check this issue. Please feel free to DM me on Nx discord

JamesHenry commented 3 days ago

I'm not saying you are wrong @ErickRodrCodes but the screenshots provided don't appear to be clear evidence of what you are saying.

I don't see any screenshot which shows an issue with the message.

You are showing that the message value is a string, and when we trace it through it is ultimately given as part of an array of strings to spawn from node:child_process.

Using the terminal output as evidence doesn't apply, because when you print a string it doesn't print surrounding quotes, so it's not actually related to how the value is consumed by the code.

Additionally, in your error screenshot, what I see is err = 'Debugger attached not clear evidence of a particular error in the Nx code.

Please can you update your screenshots to demonstrate the actual error you are experiencing? And can you confirm if this historically worked for you and recently stopped working, or if it has never worked for you?