Add three-choice option for dev-server installation (global/local/no)
Overview
Expands the dev-server installation question from a simple yes/no choice to three distinct options, allowing users to choose between global installation, local installation, or no dev-server at all.
Changes
Question Enhancement
The "Do you want to use dev-server" question now offers three choices:
-
"yes, as global installation (might need root permissions to install on Linux/macOS)" - Installs
@iobroker/dev-serverglobally and runs the setup command - "yes, as a adapter own local installation (no root permissions needed)" - Adds dev-server as a local devDependency (marked as recommended)
- "no" - Skip dev-server setup
Local Installation Support
When users select the local installation option:
-
@iobroker/dev-serveris automatically added todevDependenciesin package.json - A convenient npm script
"dev-server": "dev-server"is added for easy execution - No global installation is performed, avoiding potential permission issues on Linux/macOS
Global Installation (Existing Behavior)
When users select the global installation option:
- Maintains the existing behavior
- Installs
@iobroker/dev-serverglobally - Automatically runs the setup command with the configured admin port
Backward Compatibility
- Migration function defaults to "global" for existing projects being updated
- The initial/default value is set to "local" (recommended) for new projects
- All existing functionality is preserved
Benefits
- No root permissions needed: Local installation removes the need for sudo/administrator privileges
- Project isolation: Each adapter can have its own dev-server version
- Clearer options: Users understand the implications of each choice upfront
- Better UX: The recommended option is clearly marked
Testing
- Added baseline test for local dev-server installation
- Updated existing test to explicitly test global installation
- All 63 unit tests passing
- All 51 baseline tests passing
Closes #xyz (replace with actual issue number)
Original prompt
This section details on the original issue you should resolve
<issue_title>Allow to choose for dev-server if local or global dep</issue_title> <issue_description>The current "Do you want to use dev-server" question should get three options:
- as local devDep ... and add it to the package.json and add all relevant "Ignore files and such"
- as global Depenednency (with warning that it might require additional acces to be installed (and catch error if an error happens on global install)
- No
maybe also bring this question more to the from to the other tools becazse eslint, prettier and devcontainer are asked at the very beginning ... I also wondered if dev-server would come at all</issue_description>
<agent_instructions>Adjust the current "yes/no" question about dev-server into a three-choise option like
- yes, as global installation (might need root permissions to install on Linux/macOS)
- yes, as a adapter own local installation (no root permissions needed)
- no
The logic for a global installation already exists.
If a local installation is choosen add the @iobroekr/dev-server dependency to the devDependencies. No extra installation is needed klike executed for global. Add a npm js script "dev-server" which points to "dev-server"</agent_instructions>
Comments on the Issue (you are @copilot in this section)
Fixes ioBroker/create-adapter#864
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.