plugins: Support scoped/namespace package names in headlamp-plugin#5715
plugins: Support scoped/namespace package names in headlamp-plugin#5715PrakharJain345 wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: PrakharJain345 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Adds support for scoped npm package names (e.g. @org/plugin) in the headlamp-plugin CLI build/start lifecycle and in the frontend plugin delete flow by mapping them to a flat, collision-free local directory name (@org/plugin → org-plugin), replacing the previous logic that dropped the scope and risked collisions.
Changes:
- Update
copyToPluginsFolderinheadlamp-plugin.jsto strip@and replace/with-instead of keeping only the last segment. - Update the
folderNamefallback inusePluginDelete.tsto use the same scope-preserving transformation.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| plugins/headlamp-plugin/bin/headlamp-plugin.js | Maps scoped package names to a flat directory name when copying built plugin assets. |
| frontend/src/components/App/PluginSettings/usePluginDelete.ts | Applies the same flat-name mapping in the delete-path fallback when folderName is absent. |
illume
left a comment
There was a problem hiding this comment.
Thanks for this PR.
The open review comments from Copilot still need attention — can you have a look? Once addressed, please mark them as resolved.
d57ecc7 to
155a96c
Compare
|
Hi @illume, I wanted to let you know that all feedback on this PR has been fully addressed! The branch has been rebased on top of main to remove any merge commits, ensuring a clean and linear history. All automated checks, tests, and formatting checks are also passing cleanly. This is fully ready for your final review whenever you have a moment. Thanks again for your valuable time and feedback on this! |
Summary
Support scoped/namespace npm package names (e.g.,
@my-org/my-plugin) in theheadlamp-pluginCLI build/start lifecycles and the frontend plugin manager by mapping them to flat, safe, collision-free local directory names.Related Issue
Fixes #5714
Changes
plugins/headlamp-plugin/bin/headlamp-plugin.js: UpdatecopyToPluginsFolderto translate scoped package names by stripping the@prefix and replacing slashes with hyphens (e.g.,@my-org/my-pluginmaps tomy-org-my-plugin).frontend/src/components/App/PluginSettings/usePluginDelete.ts: Update the fallback directory-resolving logic to use the same flat, namespace-preserving pattern.Steps to Test
package.jsonto@test-org/my-test-plugin.npm run startinside the plugin directory.~/.config/Headlamp/plugins/test-org-my-test-plugin/and load correctly in Headlamp.Local Validation Results
All code linters, formatters, and compilers pass cleanly:
npm run frontend:tsc(Completed successfully with code0)npm run frontend:lint:fix(All files formatted and linted cleanly with code0)npm run frontend:test(Core tests pass cleanly)