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

Migrate PluginInstall plugin logics into standalone command #9942

Merged

Conversation

issea1015
Copy link
Contributor

@issea1015 issea1015 commented Sep 12, 2021

Addresses: #9740

This PR will seclude plugin install out of the internals. Let me make similar changes for plugin uninstall once this PR is approved.

All other requirements and feedbacks written by @medikoo in the issue are applied in this PR but didn't much simplify the logic for these reasons:

Please feel free to give me a further guidance :)

@issea1015 issea1015 marked this pull request as ready for review September 19, 2021 10:21
@issea1015 issea1015 marked this pull request as draft September 19, 2021 10:26
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@issea1015 Thank you, in general it looks very good!

I have few organization comments, also we need to configure some tests.

I think we need some unit test which doesn't depend on network: I imagine, that it may work as:

  • Via fixture engine, setup some service fixture in which we will attempt to install plugin (some example:
    await fixturesEngine.setup('function', {
    )
  • Run our module in context of returned service path, with mocked (via proxyquire)child-process-ext/spawn (so no real network communication occurs)
  • Confirm that:
    1. npm command was called with install command
    2. Plugin was added to serverless.yml

We need also integration test, but that one actually is already there:

await fixturesEngine.setup('function', {
and it feels perfect good, so I wouldn't add anything here

commands/plugin/install.js Outdated Show resolved Hide resolved
commands/plugin/install.js Outdated Show resolved Hide resolved
commands/plugin/install.js Outdated Show resolved Hide resolved
@issea1015 issea1015 force-pushed the 9740-seclude-plugin-install-command branch from 83fc2d1 to 8179d00 Compare September 21, 2021 04:06
@codecov
Copy link

codecov bot commented Sep 22, 2021

Codecov Report

Merging #9942 (29b4a7e) into master (9e308bd) will decrease coverage by 0.58%.
The diff coverage is 68.96%.

❗ Current head 29b4a7e differs from pull request most recent head 846859a. Consider uploading reports for the commit 846859a to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9942      +/-   ##
==========================================
- Coverage   86.18%   85.59%   -0.59%     
==========================================
  Files         329      332       +3     
  Lines       13065    13245     +180     
==========================================
+ Hits        11260    11337      +77     
- Misses       1805     1908     +103     
Impacted Files Coverage Δ
lib/plugins/index.js 100.00% <ø> (ø)
lib/plugins/plugin/install.js 26.13% <ø> (-68.19%) ⬇️
commands/plugin-install.js 64.61% <64.61%> (ø)
lib/commands/plugin-management.js 69.23% <69.23%> (ø)
scripts/serverless.js 56.07% <100.00%> (+1.05%) ⬆️
lib/plugins/aws/deployList.js 71.42% <0.00%> (-20.24%) ⬇️
lib/cli/render-help/general.js 98.11% <0.00%> (-1.89%) ⬇️
lib/Serverless.js 68.88% <0.00%> (-0.17%) ⬇️
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e308bd...846859a. Read the comment docs.

@issea1015
Copy link
Contributor Author

@medikoo Thanks for the clear description of all your feedbacks! I think I covered all of them in recent commits. Hope you take a look again :)

@issea1015 issea1015 marked this pull request as ready for review September 22, 2021 10:15
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@issea1015 that looks impressive! It's way way clearer now. I still have some remarks, but in general we're close to have it right.

Let me know what you think of my suggestions

lib/commands/plugin-management.js Outdated Show resolved Hide resolved
commands/plugin/install.js Outdated Show resolved Hide resolved
commands/plugin/install.js Outdated Show resolved Hide resolved
commands/plugin/install.js Outdated Show resolved Hide resolved
commands/plugin/install.js Outdated Show resolved Hide resolved
lib/commands/plugin-management.js Outdated Show resolved Hide resolved
lib/commands/plugin-management.js Outdated Show resolved Hide resolved
commands/plugin/install.js Outdated Show resolved Hide resolved
scripts/serverless.js Outdated Show resolved Hide resolved
test/unit/commands/plugin/install.test.js Outdated Show resolved Hide resolved
@issea1015 issea1015 force-pushed the 9740-seclude-plugin-install-command branch from 6ec25a0 to 54f54f2 Compare September 22, 2021 13:53
@issea1015
Copy link
Contributor Author

@medikoo Thanks for feedbacks with full background reasoning! It was seamless to follow them up. Let me know how it is now :)

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@issea1015 that looks great! I have just few last notes, and we should be good to go

commands/plugin-install.js Outdated Show resolved Hide resolved
scripts/serverless.js Outdated Show resolved Hide resolved
scripts/serverless.js Outdated Show resolved Hide resolved
@issea1015
Copy link
Contributor Author

@medikoo Thanks for the step-by-step guidance all the while. That was impressive!

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

Thank you @issea1015 ! All good, still to completely keep support for internal plugin install handling, some other changes also need to be reverted. I've commented under them specifically

lib/plugins/index.js Outdated Show resolved Hide resolved
test/unit/lib/plugins/plugin/install.test.js Outdated Show resolved Hide resolved
@issea1015
Copy link
Contributor Author

@medikoo Gotcha 🤦 I might have rushed in fact 😛
Done!

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

That looks great @issea1015 Thank you!

I assume you'd follow with plugin uninstall with next PR?

@medikoo medikoo merged commit 713ac1e into serverless:master Sep 27, 2021
@issea1015
Copy link
Contributor Author

I assume you'd follow with plugin uninstall with next PR?

@medikoo leave it to me!

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

2 participants