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

"--include-merged-tags" not working in "lerna publish" and "lerna version" #507

Closed
5 tasks done
xueran opened this issue Mar 6, 2023 · 8 comments · Fixed by #515
Closed
5 tasks done

"--include-merged-tags" not working in "lerna publish" and "lerna version" #507

xueran opened this issue Mar 6, 2023 · 8 comments · Fixed by #515

Comments

@xueran
Copy link
Contributor

xueran commented Mar 6, 2023

Describe the bug

when use "lerna changed",it is found 1 package ready to publish, but when use "lerna publish" or "erna version", it is assuming all packages changed

Expectation

In the above questions,found 1 package ready to publish is right, so expect the "lerna publish" and "lerna version" behavior to be consistent with the "lerna changed" behavior

Reproduction

Git log need contain "Merge branch xxx".

The following steps may be required for problem recurrence:

  1. Create a new branch
  2. publish a package,
  3. merge the branch into the master,
  4. create another branch,
  5. and change another package for publishing

Lerna config and logs

lerna.json

<!-- Please paste your `lerna.json` here -->

lerna-debug.log

<!-- If you have a `lerna-debug.log` available, please paste it here -->
<!-- Otherwise, feel free to delete this <details> block -->

Environment Info

System:
OS: macOS 11.3.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 126.13 MB / 16.00 GB
Shell: 5.8 - /bin/zsh

Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.13.0/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm

Browsers:
Chrome: 110.0.5481.177
Firefox: 78.9.0
Safari: 14.1

Used Package Manager

pnpm

Validations

@xueran xueran changed the title "--include-merged-tags" not working in "lerna publish" and "erna version" "--include-merged-tags" not working in "lerna publish" and "lerna version" Mar 6, 2023
@ghiscoding
Copy link
Member

ghiscoding commented Mar 6, 2023

can't help without a repro that I can clone, also this code came from the original Lerna code and the behavior didn't change. I would also suggest to look at Lerna's issues to see if there's anything similar. It's also not very clear if run this command from master branch or a different branch, Lerna doesn't always produce expected result when on a different branch, for example this Stack Overflow question

A possible alternative is to use lerna publish from-package

@xueran
Copy link
Contributor Author

xueran commented Mar 7, 2023

can't help without a repro that I can clone, also this code came from the original Lerna code and the behavior didn't change. I would also suggest to look at Lerna's issues to see if there's anything similar. It's also not very clear if run this command from master branch or a different branch, Lerna doesn't always produce expected result when on a different branch, for example this Stack Overflow question

A possible alternative is to use lerna publish from-package

I also use Lerna, and the result of Lerna is right. Currently, there is no way to provide repo, because this is the company's private library.

@ghiscoding
Copy link
Member

The implementation should be the same as Lerna, there aren't much differences in code from to Lerna vs Lerna-Lite (the only major difference is that Nrwl are starting to add a lot of Nx related code which will not be added to Lerna-Lite).

There are Jest unit tests that exist for lerna version --include-merged-tags in here and these tests are still passing. The code came from Lerna, I don't think that I modified anything related to it, so it should work as intended

@xueran
Copy link
Contributor Author

xueran commented Mar 13, 2023

The implementation should be the same as Lerna, there aren't much differences in code from to Lerna vs Lerna-Lite (the only major difference is that Nrwl are starting to add a lot of Nx related code which will not be added to Lerna-Lite).

There are Jest unit tests that exist for lerna version --include-merged-tags in here and these tests are still passing. The code came from Lerna, I don't think that I modified anything related to it, so it should work as intended

The reason is found. It is the tag pattern problem. The lerna-lite publish and version command will pass the isIndependent parameter when calling collectUpdates, and set tagPattern="*@*" in collectUpdates. The code is as follows:

const tagPattern = isIndependent ? '*@*' : '';

In version conventional-commits, tagPattern is also set:

describeOptions.match = '*@*'; // independent tag pattern

For some reasons, my project cannot set tagPattern as *@*, so whether it can support custom tagPattern.Thank you very much.

@ghiscoding
Copy link
Member

ghiscoding commented Mar 13, 2023

in that case it must be related to issue #220 and PR #267 which changed the behavior, @StarpTech might have more details to share since he created the original PR, in any case feel free to create a Pull Request if you know how to fix it. That change was indeed only merged to Lerna-Lite, even though it was originally created in Lerna but never merged (from what I recall)

The PR #267 that basically changed the behavior is calling this git command, what does that return on your side? If that returns nothing then what are your version tags look like (executing git tag should give us an idea)?

git tag --list '*@*'

I guess that I could maybe add an option as you suggested, however it would probably be better if it works out of the box but still... a custom tag might be an alternative

@xueran
Copy link
Contributor Author

xueran commented Mar 14, 2023

My usage scenario is in the company's automated process, so the tag is automatically added by the automated process, and the module name is used as the tag, such as lerna-project_ 1-0-32-1_ PD_ BL.

@ghiscoding
Copy link
Member

@xueran
By the way, on a totally different subject, I saw that you opened a new issue in Lerna not long ago

The publishConfig of lerna is different from pnpm , it is not support "main" , "module" and "types"

a similar issue was also opened in Lerna-Lite under #404 and we did resolve this issue with PR #415, so this should work as expected in Lerna-Lite. I've set a list of properties to be overridden, you can see the list below (the list is actually a copy of what pnpm have in their own repo)... so anyway, I just thought of letting you know in case you didn't know that this issue was actually fixed in Lerna-Lite (requires >=1.13.0) but wasn't fixed in Lerna itself (at least not yet)

// manifest fields that may make sense to overwrite
const PUBLISH_CONFIG_WHITELIST = new Set([
'bin',
'browser',
'cpu',
'esnext',
'es2015',
'exports',
'imports',
'libc',
'main',
'module',
'os',
'type',
'types',
'typings',
'typesVersions',
'umd:main',
'unpkg',

@StarpTech
Copy link
Contributor

@ghiscoding I don't know the repo so well. Filtering tags based on '*@*' was required not to include tags from others that aren't managed by lerna lite. I don't see how it can conflict with lerna at all. Based on your provided information, it's hard to understand your use case @xueran.

I also use Lerna, and the result of Lerna is right. Currently, there is no way to provide repo, because this is the company's private library.

Please provide a repro with your lerna.json, and expectations. The source is not important.

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