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

plugin dev overwrites subtopics #1805

Closed
mshanemc opened this issue Nov 14, 2022 · 6 comments
Closed

plugin dev overwrites subtopics #1805

mshanemc opened this issue Nov 14, 2022 · 6 comments
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@mshanemc
Copy link
Contributor

Summary

plugin dev is overwriting the first subtopic, rather than appending a new subtopic to the package.json

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

  1. sf dev generate command --name dev:convert:messsages

Expected result

two subtopics (generate and convert)

Actual result

reports a conflict in the package.json

➜  plugin-dev git:(sm/convert-messages) ✗ sf dev generate command --name dev:convert:messsages

     _-----_     ╭──────────────────────────╮
    |       |    │    Adding a command to   │
    |--(o)--|    │  @salesforce/plugin-dev  │
   `---------´   │      Version: 0.3.14     │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

 conflict package.json
? Overwrite package.json? overwrite

Screen Shot 2022-11-14 at 8 44 44 AM

System Information

{
"cliVersion": "@salesforce/cli/1.53.0",
"architecture": "darwin-x64",
"nodeVersion": "node-v18.12.0",
"pluginVersions": [
"@oclif/plugin-autocomplete 1.3.2 (core)",
"@oclif/plugin-commands 2.2.0 (core)",
"@oclif/plugin-help 5.1.16 (core)",
"@oclif/plugin-not-found 2.3.5 (core)",
"@oclif/plugin-plugins 2.1.6 (core)",
"@oclif/plugin-search 0.0.2 (core)",
"@oclif/plugin-update 3.0.3 (core)",
"@oclif/plugin-version 1.1.3 (core)",
"deploy-retrieve 1.6.9 (core)",
"dev 0.3.14 (link) /Users/shane.mclaughlin/eng/plugin-dev",
"env 1.5.8 (core)",
"functions 1.14.2 (core)",
"generate 1.0.30 (core)",
"info 2.2.4 (core)",
"login 1.1.7 (core)",
"settings 1.1.4 (core)",
"sobject 0.0.26 (core)",
"telemetry 2.0.2 (core)",
"trust 2.1.0 (core)"
],
"osVersion": "Darwin 21.6.0",
"shell": "zsh",
"rootPath": "/usr/local/lib/sfdx/sf"
}

@mshanemc mshanemc added investigating We're actively investigating this issue sf bug Issue or pull request that identifies or fixes a bug and removed investigating We're actively investigating this issue labels Nov 14, 2022
@github-actions
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@git2gus
Copy link

git2gus bot commented Nov 14, 2022

This issue has been linked to a new work item: W-12058419

@KevinGossentCap
Copy link

Hi @mshanemc , I've started to look into this issue because I'm doing a few project plugins and at least I found the origin of the problem.
The Object spread merge this.pjson.oclif.topics = { ...this.pjson.oclif.topics, ...newTopics }; is not really doing what we'd expect as it not really recursively merge the topics. Added to the fact that there is no search into the actual topics to see if there really is something to do, it can remove or drop some topics or subtopics.
solution, either lodash _.defaults or coding it yourselves.
If I find the time I'll propose a PL with lodash

@mshanemc
Copy link
Contributor Author

mshanemc commented Jun 5, 2023

Thanks for the help. I did just make a kinda-related change to that code because we bumped into something similar. I don't think it's gonna solve what you found, though, but maybe worth a shot.

salesforcecli/plugin-dev#330

@KevinGossentCap
Copy link

I confirm it's not solving.
I think that only replacing the Object spread merge by the corresponding _.defaults should solve the overral issue here, I just have to try it (you you on your side ;) )
By the way my own test was even removing my own subtopics (eg.: I've got topic topic1:subtopic1:command, then adding topic1:command2 => it removes entirely the subtopic1...)

@mshanemc
Copy link
Contributor Author

mshanemc commented Jun 6, 2023

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug
Projects
None yet
Development

No branches or pull requests

3 participants