Skip to content

Fix: Prevent plugins from being installed to wrong type directory (fixes #235)#249

Open
swashbuck wants to merge 2 commits intomasterfrom
issue/235
Open

Fix: Prevent plugins from being installed to wrong type directory (fixes #235)#249
swashbuck wants to merge 2 commits intomasterfrom
issue/235

Conversation

@swashbuck
Copy link
Copy Markdown
Contributor

Fixes #235

Fix

  • Check installed plugins before determining install targets — fetchProjectInfo() is now called during loadPluginData() so the CLI knows what's already on disk
  • Skip plugins that are already installed at the matched version, preventing duplicate installations
  • Infer plugin type from the existing install path (e.g. src/menu/adapt-contrib-boxMenu → type menu) before falling back to keyword/attribute detection — this prevents already-installed plugins from being misrouted to the default src/components/ directory

Testing

  1. Start with a project where adapt-contrib-boxMenu is installed in src/menu/ and listed in adapt.json with "*"
  2. Run adapt install adapt-contrib-media
  3. Verify adapt-contrib-boxMenu is NOT duplicated into src/components/
  4. Run adapt install (no args) and verify all plugins go to their correct type directories
  5. On a clean project, run adapt install adapt-contrib-boxMenu and verify it installs to src/menu/
  6. Verify a mix of component/extension/menu/theme plugins all route correctly

Comment thread lib/integration/Plugin.js
* e.g. src/menu/adapt-contrib-boxMenu → 'menu'
* @returns {string|null}
*/
getTypeFromProjectPath () {
Copy link
Copy Markdown
Member

@oliverfoster oliverfoster Mar 26, 2026

Choose a reason for hiding this comment

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

Does this not make the rest of the getType code redundant?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The path-based check only applies when the plugin is already installed on disk (this.projectPath is set). For a fresh install on a clean project, getTypeFromProjectPath() returns null and falls through to the existing attribute/keyword detection.

So the rest of getType is still needed for first-time installs where no project path exists yet.

Posted via collaboration with Claude Code

Copy link
Copy Markdown
Member

@oliverfoster oliverfoster Apr 13, 2026

Choose a reason for hiding this comment

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

I'd much rather you figured out why it's getting installed in the component directory and fix that, rather than side stepping it with this solution.

I don't see an explanation of why the issue is happening in this solution.

The bower to npm goal will be to install all of the plugins in a node_modules folder, where this code is counter to that direction.

@oliverfoster oliverfoster moved this from Needs Reviewing to Assigned in adapt_framework: The TODO Board Apr 13, 2026
@swashbuck swashbuck moved this from Assigned to Needs Reviewing in adapt_framework: The TODO Board Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Needs Reviewing

Development

Successfully merging this pull request may close these issues.

adapt install places menu plugin in src/components/ when already installed in src/menu/

2 participants