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

Publishing wrong version with yarn and ng-cli #655

Open
grosch opened this issue Jul 20, 2022 · 3 comments
Open

Publishing wrong version with yarn and ng-cli #655

grosch opened this issue Jul 20, 2022 · 3 comments

Comments

@grosch
Copy link

grosch commented Jul 20, 2022

Description

When publishing my library, the version is set on the top-level package.json, not the project's package.json. Am I not supposed to be running this from the root of the package? The top-level package.json has "private": true on it.

Steps to reproduce

  1. yarn build (builds ./projects/my-module and writes to ./dist directory)
  2. yarn ng publish patch

It seems to be publishing the dist folder, but the version change applies to the wrong package.json file.

It's also thus setting the new version after having built the library and writing to dist, so what gets written up into npm doesn't have the correct version.

Expected behavior

I would expect the publish command to update the version, then build, then publish.

Environment

np - 7.6.2
Node.js - 16.16.0
yarn - 1.1.25
Git - 2.37.0.windows.1
OS - Windows 10

@sindresorhus
Copy link
Owner

I unfortunately don't think np has great support for monorepos.

I would also recommend using Yarn 2.

@grosch
Copy link
Author

grosch commented Jul 22, 2022

It's not really a monorepo, it's just an angular library. Following Angular's instructions for libraries it gets created in that projects area. Suggestions on what to do?

I can't use yarn 2. I tried 2 and even 3 a few weeks ago, but it causes tons of other issues when using ng commands from Angular so I finally had to go back to version 1.

@fregante
Copy link
Collaborator

fregante commented Feb 3, 2023

2. yarn ng publish patch

What is this? What is the np command? It's hard to find a solution without knowing exactly what np is told to do and from which directory (cwd)

@fregante fregante changed the title Publishing wrong version Publishing wrong version with yarn and ng-cli Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants