-
Notifications
You must be signed in to change notification settings - Fork 27
Replace @types/iobroker with @iobroker/types using npm alias #1217
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Apollon77 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot add changelog entry (forgotten again - adjust your instructions to ensure it is ALWAYS done!) and migration info
if (isAdapter && useTypeChecking) { | ||
const iobrokerTypesVersion = await fetchPackageReferenceVersion("@iobroker/types"); | ||
devDependencies.push(`"@types/iobroker": "npm:@iobroker/types@${iobrokerTypesVersion}"`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copiolot please add an alphabetic sorting of the dependencies and dev-dependencies by their name and ensure that the packages with @* are at the beginning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added alphabetic sorting in commit abbcd12. The devDependencies array is now sorted alphabetically with all @-scoped packages placed first, followed by regular packages. The @types/iobroker entry now appears in the correct position instead of at the end.
Co-authored-by: Apollon77 <[email protected]>
Added changelog entry and migration guide in commit abbcd12. The changelog entry is at the top of the WORK IN PROGRESS section and links to the new migration guide at |
# Conflicts: # CHANGELOG.md # test/baselines/TS_Prettier/package.json # test/baselines/adapter_TS_React/package.json
This PR updates the create-adapter templates to use the modern
@iobroker/types
package instead of the deprecated@types/iobroker
package.Changes
The implementation follows the pattern used in
@iobroker/adapter-core
to ensure 100% compatibility with the existing approach:1. Package Dependency
Added
@iobroker/types
as a devDependency using npm alias syntax in generatedpackage.json
:This alias ensures that IDEs and TypeScript treat it like a real
@types
package, providing seamless type discovery without requiring any changes to existing imports or type references.The package is automatically included for:
2. Documentation Comments
Updated all comments in generated
adapter-config.d.ts
files from:// This file extends the AdapterConfig type from "@types/iobroker"
to:
// This file extends the AdapterConfig type from "@iobroker/types"
3. Dependency Sorting
Added alphabetic sorting for devDependencies with all @-scoped packages appearing first, followed by regular packages. This ensures consistent and predictable package.json formatting across all generated adapters.
4. Test Baselines
Regenerated test baseline files to reflect the updated package.json entries (now properly sorted) and comments across all adapter variants (TypeScript, JavaScript, React, VIS, different Node versions, etc.).
5. Documentation
CHANGELOG.md
under the__WORK IN PROGRESS__
sectiondocs/updates/20251014_iobroker_types_package.md
with step-by-step instructions for manually updating existing adaptersBenefits
@iobroker/types
packageTesting
All existing tests continue to pass, validating that the changes work correctly across all adapter configurations.
Fixes #
Original prompt
Fixes #1050
💡 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.