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

chore!: remove unused deps, convert to ES2015 class #1633

Merged
merged 8 commits into from
Jul 11, 2023
Merged

Conversation

robertsLando
Copy link
Member

BREAKING CHANGE: when creating an MqttClient instance new is now required

BREAKING CHANGE: when creating an `MqttClient` instance `new` is now required
@codecov
Copy link

codecov bot commented Jul 10, 2023

Codecov Report

Patch coverage: 92.70% and project coverage change: -0.48 ⚠️

Comparison is base (3348814) 86.22% compared to head (b607585) 85.74%.

❗ Current head b607585 differs from pull request most recent head 8dcd727. Consider uploading reports for the commit 8dcd727 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1633      +/-   ##
==========================================
- Coverage   86.22%   85.74%   -0.48%     
==========================================
  Files          13       13              
  Lines        1321     1249      -72     
==========================================
- Hits         1139     1071      -68     
+ Misses        182      178       -4     
Impacted Files Coverage Δ
lib/client.js 90.43% <ø> (-0.41%) ⬇️
lib/topic-alias-send.js 87.09% <85.71%> (+0.25%) ⬆️
lib/unique-message-id-provider.js 90.90% <88.88%> (-2.85%) ⬇️
lib/store.js 95.65% <95.23%> (+1.20%) ⬆️
lib/connect/index.js 89.41% <100.00%> (-0.13%) ⬇️
lib/default-message-id-provider.js 100.00% <100.00%> (+6.66%) ⬆️
lib/topic-alias-recv.js 100.00% <100.00%> (+6.66%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@robertsLando robertsLando changed the title chore!: remove unused deps and make new required chore!: remove unused deps, convert to ES2015 class Jul 10, 2023
@robertsLando
Copy link
Member Author

@BertKleewein FYI first time tests failed for no reason (this didn't happened for long so tests are better but still flaky): https://github.com/mqttjs/MQTT.js/actions/runs/5509746410/jobs/10042923374?pr=1633#step:5:2817

@robertsLando
Copy link
Member Author

robertsLando commented Jul 10, 2023

Many deps are related to bin/*:

  • commists
  • concat-stream
  • help-me
  • minimist
  • split2

So this are 5 deps on a total of 15. I would suggest to create a new dedicated repo @mqttjs/cli and move that code there. What's your opinion on this?

Of course this will be done on a separeted PR

@robertsLando
Copy link
Member Author

cc @vishnureddy17

@vishnureddy17
Copy link
Member

So this are 5 deps on a total of 15. I would suggest to create a new dedicated repo @mqttjs/cli and move that code there. What's your opinion on this?

It is not costless. There's some overhead because we have to pay attention to another repo for maintenance.

I still think it's good on net, reducing the dependencies here would be great!

@@ -68,7 +67,7 @@ function connect (brokerUrl, opts) {
parsed.port = Number(parsed.port)
}

opts = xtend(parsed, opts)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call to get rid of dependencies that are no longer needed due to newer JS features.

@robertsLando
Copy link
Member Author

I have created #1634 to keep track of this. Is this good to merge so?

@vishnureddy17

@BertKleewein
Copy link
Contributor

BertKleewein commented Jul 11, 2023

Instead of moving bin/* to a separate repo, it could just have its own package.json. This would also be useful for samples. aedes is a devDependency, but it's only used for a single sample. This could be done lerna (another devDependency :( ) or maybe npm workspaces are mature enough for this now.

update: aedes was a devDependency. I just noticed that you removed this. :)

@vishnureddy17
Copy link
Member

Still reviewing, almost done.

Comment on lines +257 to 264
// Defaults
for (k in defaultConnectOptions) {
if (typeof this.options[k] === 'undefined') {
this.options[k] = defaultConnectOptions[k]
} else {
this.options[k] = options[k]
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be out of scope for this PR, but it looks like this code can be simplified with spread syntax

@robertsLando
Copy link
Member Author

I have think about npm workspaces too but introducing them requires some work to refactor all things that's why I proposed having a separeted module. Anyway I would continue this discussion on #1634

@robertsLando robertsLando merged commit d71b000 into main Jul 11, 2023
6 checks passed
@robertsLando robertsLando deleted the remove-deps branch July 11, 2023 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants