Skip to content

Fix: Prevent stray root bower.json from duplicating plugins on install (fixes #235)#249

Open
swashbuck wants to merge 5 commits into
masterfrom
issue/235
Open

Fix: Prevent stray root bower.json from duplicating plugins on install (fixes #235)#249
swashbuck wants to merge 5 commits into
masterfrom
issue/235

Conversation

@swashbuck
Copy link
Copy Markdown
Contributor

@swashbuck swashbuck commented Mar 26, 2026

Fixes #235

Fix

  • Install each plugin from an isolated working directory so an ambient (legacy) root bower.json cannot inject its own dependencies into the install directory. This is the actual cause of adapt install places menu plugin in src/components/ when already installed in src/menu/ #235: a stale bower.json ("name": "manifest"), left over from the old grunt/bower toolchain and never removed, pinned adapt-contrib-boxMenu@7.1.0. Bower installed that manifest dependency into whichever type folder the requested plugin used (e.g. src/components when installing adapt-contrib-media), creating a duplicate copy of boxMenu.

Update

  • Skip reinstalling plugins already at the resolved version (projectVersion === matchedVersion), and fetch installed-plugin info during install so that comparison is available. Reduces redundant reinstalls on a no-arg adapt install.

Testing

Setup

  1. Start from a fresh framework project (e.g. 5.56.2) with the default plugins installed (run adapt install once), so adapt-contrib-boxMenu is present in src/menu/.
  2. Add a legacy root bower.json at the project root:
{
    "name": "manifest",
    "dependencies": {
        "adapt-contrib-boxMenu": "7.1.0"
    }
}

Reproduce the bug (current published CLI / master)

  1. Run adapt install adapt-contrib-media.
  2. Observe: adapt-contrib-boxMenu@7.1.0 is duplicated into src/components/, alongside the correct copy still in src/menu/.

Verify the fix (this PR, issue/235)

  1. Delete the duplicate src/components/adapt-contrib-boxMenu, leaving the root bower.json in place.
  2. Run adapt install adapt-contrib-media again.
  3. Confirm adapt-contrib-media installs to src/components/ and adapt-contrib-boxMenu is NOT duplicated there.
  4. Run adapt install (no args) and confirm already-current plugins are skipped rather than reinstalled.

Comment thread lib/integration/Plugin.js Outdated
@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
@swashbuck swashbuck changed the title Fix: Prevent plugins from being installed to wrong type directory (fixes #235) Fix: Prevent stray root bower.json from duplicating plugins on install (fixes #235) Jun 4, 2026
@swashbuck
Copy link
Copy Markdown
Contributor Author

@oliverfoster

Dug into the actual cause rather than working around it. It's not type detection: boxMenu's metadata already resolves to menu correctly. The duplicate comes from a stale legacy root bower.json ("name": "manifest") left over from the old grunt/bower toolchain. On any install the CLI hands bower the target's type folder as directory plus the project cwd, and bower installs that manifest's pinned deps into the same folder, so adapt install adapt-contrib-media drops the manifest's adapt-contrib-boxMenu@7.1.0 into src/components. Reproduced by adding that file to a clean project; the duplicate disappears when it's removed.

Changes off the back of that:

  • Dropped the path-based type inference. You were right, it was redundant given metadata already resolves the type.
  • Fix: run bower install from an isolated working dir so an ambient bower.json can't inject its deps. The project .bowerrc is copied across so registry/proxy/etc stay intact. ~20 lines confined to the two bower call sites, and it goes away entirely with the npm move.

Verified the install and update paths against a project carrying the stale manifest: the requested plugin installs correctly, no duplicate, .bowerrc settings preserved.

One open call: the PR also skips reinstalling plugins already at the resolved version (less redundant work on a no-arg adapt install). Happy to split that into its own PR if you'd rather keep this focused purely on #235.

Posted via collaboration with Claude Code

@swashbuck swashbuck requested a review from oliverfoster June 4, 2026 22:25
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