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

fix: don't start plugins for apps without a plugin entrypoint #850

Merged
merged 5 commits into from
Jun 3, 2024

Conversation

KaiVandivier
Copy link
Contributor

@KaiVandivier KaiVandivier commented May 31, 2024

Missed this in the previous PR -- pointed out by Edoardo:

Screenshot 2024-05-31 at 13 42 49

After:

Screenshot 2024-05-31 at 1 55 25 PM

Copy link
Member

@tomzemp tomzemp left a comment

Choose a reason for hiding this comment

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

@KaiVandivier: will you not have the similar problem if you have a plugin without an app entry point?

@KaiVandivier
Copy link
Contributor Author

Good point... I'll fix that too

@KaiVandivier
Copy link
Contributor Author

Ran some tests to make sure it all works:

  start start —app start —plugin
Just app entrypoint Start just app ✅ Start just app ✅ “Nothing is configured to start” & exit ✅
App and plugin entrypoints Start app and plugin ✅ Start just app ✅ Start just plugin ✅
Just plugin entrypoint Start just plugin ✅ “Nothing is configured to start” & exit ✅ Just plugin ✅

@KaiVandivier KaiVandivier requested a review from tomzemp May 31, 2024 15:40
Copy link
Member

@tomzemp tomzemp left a comment

Choose a reason for hiding this comment

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

Looks good to me 🎉. I left two small comments, but they're minor questions.

@@ -145,12 +163,12 @@ const handler = async ({
startPromises.push(shell.start({ port: newPort }))
}

if (shouldStartBoth || shouldStartOnlyPlugin) {
if (shouldStartPlugin) {
const pluginPort = shouldStartBoth ? newPort + 1 : newPort
Copy link
Member

Choose a reason for hiding this comment

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

should this be:
const pluginPort = shouldStartApp ? newPort + 1 : newPort ?
in case you indicated to start the app as well, but then did not have an entry point for it, then you could start the plugin on the newPort without incrementing? Or is the idea that you increment the port number to indicate that you should have been able to start the app (as you requested to do so 😅)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, a fine distinction -- I think you're right that shouldStartApp would be better 🙂

entryPoints.plugin && (shouldStartBoth || shouldStartOnlyPlugin)
if (!shouldStartApp && !shouldStartPlugin) {
throw new Error(
'Nothing is configured to start. Check the start script and the configured entrypoints, then try again.'
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if language like The requested app and/or plugin is not configured to start. would be slightly clearer than Nothing is configured to start? At the moment if you try running yarn start --plugin with only an app entry point, you'll get this message about "Nothing" being configured to start, which is true in the sense that Nothing you requested is configured, but there is still some configured entry point (you just haven't requested to start it).

PS I don't care much about this point as you only get here if you're not really paying attention to the parameters you're passing 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That does sound clearer, I'll use that 🙂

@KaiVandivier
Copy link
Contributor Author

Implemented and retested

@KaiVandivier KaiVandivier enabled auto-merge (squash) June 3, 2024 18:25
@KaiVandivier KaiVandivier merged commit a89d4cf into master Jun 3, 2024
6 checks passed
@KaiVandivier KaiVandivier deleted the fix-plugin-start-without-entrypoint branch June 3, 2024 18:30
dhis2-bot added a commit that referenced this pull request Jun 3, 2024
## [11.3.1](v11.3.0...v11.3.1) (2024-06-03)

### Bug Fixes

* don't start plugins for apps without a plugin entrypoint ([#850](#850)) ([a89d4cf](a89d4cf))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 11.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

dhis2-bot added a commit that referenced this pull request Jun 20, 2024
# [12.0.0-alpha.2](v12.0.0-alpha.1...v12.0.0-alpha.2) (2024-06-20)

### Bug Fixes

* clean up for plugins [LIBS-620] ([#851](#851)) ([13af3b5](13af3b5))
* do not encode username, password ([#852](#852)) ([2fb4272](2fb4272))
* don't start plugins for apps without a plugin entrypoint ([#850](#850)) ([a89d4cf](a89d4cf))

### Features

* parse pluginType from d2 config to add to manifest.webapp ([#849](#849)) ([c1dae23](c1dae23))
* start plugin and app separately [LIBS-391] [LIBS-392] ([#848](#848)) ([82003e7](82003e7))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 12.0.0-alpha.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants