Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nx release, file references cause publish failure #28049

Open
1 of 4 tasks
brogueady opened this issue Sep 23, 2024 · 3 comments · May be fixed by #30418
Open
1 of 4 tasks

nx release, file references cause publish failure #28049

brogueady opened this issue Sep 23, 2024 · 3 comments · May be fixed by #30418

Comments

@brogueady
Copy link

brogueady commented Sep 23, 2024

Current Behavior

Setup:
An Nx repo using npm, conventional commits, projectRelationship is independent, built to a dist folder
Has projects A, B and C where A depends on B and B depends on C using file references

  1. Make a patch change to project A and commit
  2. Run nx release --yes --verbose=true
  3. The publish process fails with error Error: Cannot publish package "@at/wp-renovate-mono-lib-b" because it contains a local dependency protocol in its "dependencies", and your package manager is npm.

Expected Behavior

The package.json file for project B has the file ref substituted with the current version but skips publishing because it already exists in the registry.

GitHub Repo

https://github.com/brogueady/nx-test

Steps to Reproduce

  1. npm install
  2. nx local-registry
  3. nx release --yes --verbose

Nx Report

Node           : 18.18.2
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 9.8.1

nx                 : 19.7.4
@nx/js             : 19.7.4
@nx/linter         : 19.7.4
@nx/eslint         : 19.7.4
@nx/workspace      : 19.7.4
@nx/devkit         : 19.7.4
@nx/eslint-plugin  : 19.7.4
@nrwl/tao          : 19.7.4
typescript         : 5.5.3

Failure Logs

NX   Successfully ran target build for 3 projects

Nx read the output from the cache instead of running the command for 2 out of 3 tasks.


 NX   Running release version for project: wp-renovate-mono-lib-c

wp-renovate-mono-lib-c 🔍 Reading data for package "@at/wp-renovate-mono-lib-c" from dist/packages/wp-renovate-mono-lib-c/package.json
wp-renovate-mono-lib-c 📄 Resolved the current version as 2.0.5 from git tag "wp-renovate-mono-lib-c-2.0.5".
wp-renovate-mono-lib-c 🚫 No changes were detected using git history and the conventional commits standard.
wp-renovate-mono-lib-c 🚫 Skipping versioning "@at/wp-renovate-mono-lib-c" as no changes were detected.

 NX   Running release version for project: wp-renovate-mono-lib-b

wp-renovate-mono-lib-b 🔍 Reading data for package "@at/wp-renovate-mono-lib-b" from dist/packages/wp-renovate-mono-lib-b/package.json
wp-renovate-mono-lib-b 📄 Resolved the current version as 3.2.0 from git tag "wp-renovate-mono-lib-b-3.2.0".
wp-renovate-mono-lib-b 🚫 No changes were detected using git history and the conventional commits standard.
wp-renovate-mono-lib-b 🚫 Skipping versioning "@at/wp-renovate-mono-lib-b" as no changes were detected.

 NX   Running release version for project: wp-renovate-mono-lib-a

wp-renovate-mono-lib-a 🔍 Reading data for package "@at/wp-renovate-mono-lib-a" from dist/packages/wp-renovate-mono-lib-a/package.json
wp-renovate-mono-lib-a 📄 Resolved the current version as 5.3.13 from git tag "wp-renovate-mono-lib-a-5.3.13".
wp-renovate-mono-lib-a 📄 Resolved the specifier as "patch" using git history and the conventional commits standard.
wp-renovate-mono-lib-a ✍️  New version 5.3.14 written to dist/packages/wp-renovate-mono-lib-a/package.json

UPDATE dist/packages/wp-renovate-mono-lib-a/package.json

    "name": "@at/wp-renovate-mono-lib-a",
-   "version": "5.3.13",
+   "version": "5.3.14",
    "dependencies": {

  }
+


Skipped lock file update because npm workspaces are not enabled.

 NX   Staging changed files with git

Will not add the following files because they are ignored by git:
dist/packages/wp-renovate-mono-lib-a/package.json

No files to stage. Skipping git add.
 NX  Falling back to ts-node for local typescript execution. This may be a little slower.
  - To fix this, ensure @swc-node/register and @swc/core have been installed
 NX  Falling back to ts-node for local typescript execution. This may be a little slower.
  - To fix this, ensure @swc-node/register and @swc/core have been installed

 NX   Generating an entry in packages/wp-renovate-mono-lib-a/CHANGELOG.md for wp-renovate-mono-lib-a-5.3.14


NOTE: There was no diff detected for the changelog entry. Maybe you intended to pass alternative git references via --from and --to?
 NX  Falling back to ts-node for local typescript execution. This may be a little slower.
  - To fix this, ensure @swc-node/register and @swc/core have been installed
 NX  Falling back to ts-node for local typescript execution. This may be a little slower.
  - To fix this, ensure @swc-node/register and @swc/core have been installed

 NX   No changes detected for changelogs

No changes were detected for any changelog files, so no changelog entries will be generated.


 NX   Committing changes with git

Committing files in git with the following command:
git commit --message chore(release): publish --message - project: wp-renovate-mono-lib-a 5.3.14

No staged files found. Skipping commit.

 NX   Tagging commit with git

Tagging the current commit in git with the following command:
git tag --annotate wp-renovate-mono-lib-a-5.3.14 --message wp-renovate-mono-lib-a-5.3.14
 NX  Falling back to ts-node for local typescript execution. This may be a little slower.
  - To fix this, ensure @swc-node/register and @swc/core have been installed

 NX   Running target nx-release-publish for 3 projects:

- wp-renovate-mono-lib-a
- wp-renovate-mono-lib-b
- wp-renovate-mono-lib-c

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run wp-renovate-mono-lib-c:nx-release-publish

Added the dist-tag latest to v2.0.5 for registry http://localhost:4873/.


> nx run wp-renovate-mono-lib-b:nx-release-publish

Error: Cannot publish package "@at/wp-renovate-mono-lib-b" because it contains a local dependency protocol in its "dependencies", and your package manager is npm.

Please update the local dependency on "@at/wp-renovate-mono-lib-c" to be a valid semantic version (e.g. using `nx release`) before publishing, or switch to pnpm as a package manager, which supports dynamically replacing these protocols during publishing.

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Running target nx-release-publish for 3 projects failed

Tasks not run because their dependencies failed or --nx-bail=true:

- wp-renovate-mono-lib-a:nx-release-publish

Failed tasks:

- wp-renovate-mono-lib-b:nx-release-publish

Package Manager Version

No response

Operating System

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

Additional Information

No response

@brogueady brogueady changed the title Independent projects/conventional commits, file references cause publish failure nx release, file references cause publish failure Sep 23, 2024
@brogueady
Copy link
Author

Looks like this was introduced with this commit 431fe2a

Everything works as expected in v19.7.0

@brogueady
Copy link
Author

Actually ignore last comment. It doesn't work in 19.7.0. It does publish the package, but leaves the file refs in the dependencies rather than replacing them with the actual versions.

@JamesHenry
Copy link
Collaborator

I'm pleased to say that this is resolved in the rewritten implementation of versioning: #30418

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants