Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

Adjust "typescript direct without build" test to adapter-creator

This PR updates the pure TypeScript adapter test to use the native @iobroker/create-adapter support for TypeScript adapters without build step, removing manual workarounds.

Changes Made

  • Update test/adapters/test-pure-ts.create-adapter.json to use "language": "TypeScript (without build)"
  • Remove manual package.json patching code (lines 44-63) in test/pure-ts-adapters.test.js
  • Remove needsTypeScriptPatching: true flag from test setup
  • Update test assertions to check for check script instead of build script
  • Add missing fields (tabReact, eslintConfig) to all config files for non-interactive creation
  • Update creatorVersion to "3.0.0" and align tools with reference template
  • Add --non-interactive flag to create-adapter command to prevent prompts
  • Security check passed with no alerts

Summary

The adapter-creator now natively supports "language": "TypeScript (without build)" which automatically generates an adapter with:

  • main field pointing to src/main.ts
  • src/ directory included in files
  • Only a check script with tsc --noEmit (no build scripts)
  • TypeScript-compliant code (using const declarations)

All config files now include complete field sets and the --non-interactive flag is used to prevent interactive prompts during --replay mode. Error handling ensures non-zero exit codes from create-adapter are properly caught and reported.

Security Summary

No security vulnerabilities detected by CodeQL analysis.

Original prompt

This section details on the original issue you should resolve

<issue_title>Adjust the "typescript direct without build" test to adapter-creator</issue_title>
<issue_description>The newest adapter-creator also supports this type of adapter that we needed to work around in the current tests.

With a creat-adapter.json file like here and this "type" as seen in https://github.com/ioBroker/ioBroker.example/blob/4b820ae59d988e72b8a4623697f32445fa427340/TypeScriptWithoutBuild/.create-adapter.json#L28 you can generate such a template.

Please adjust the tests at https://github.com/ioBroker/dev-server/blob/main/test/pure-ts-adapters.test.js#L44-L63 and remove the manual handling and adjust the create file to directly create such an adapter.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Adjust TypeScript direct without build test to adapter-creator Use adapter-creator native TypeScript without build support Nov 8, 2025
Copilot AI requested a review from Apollon77 November 8, 2025 17:33
Copilot finished work on behalf of Apollon77 November 8, 2025 17:33
@Apollon77
Copy link
Collaborator

@copilot Please have a look at the test execution.
It seems that the command used for creation (e.g. npx @iobroker/create-adapter@latest --replay=/home/runner/work/dev-server/dev-server/test/adapters/test-js.create-adapter.json --target=/home/runner/work/dev-server/dev-server/test/adapters --noInstall) is not using a full file and so the creator is asking questions that are not answered.

You can use the file at https://github.com/ioBroker/ioBroker.example/blob/master/TypeScriptWithoutBuild/.create-adapter.json to compare which fields are kissing and to fill in some defaults

Copy link
Contributor Author

Copilot AI commented Nov 8, 2025

@copilot Please have a look at the test execution.
It seems that the command used for creation (e.g. npx @iobroker/create-adapter@latest --replay=/home/runner/work/dev-server/dev-server/test/adapters...

Fixed in 331cd52. Added the missing fields (tabReact, eslintConfig) and updated tools and creatorVersion to match the reference template. All three adapter config files now have complete field sets to prevent interactive prompts during --replay mode.

Copilot finished work on behalf of Apollon77 November 8, 2025 17:44
@Apollon77
Copy link
Collaborator

@copilot Please additionally to the current changes also add the parameter "--non-interactive" to the create-adapter call and endure that the creator did not returned an errorcode. In the future it will log such missing fields for easier problem resolvement. But no need to verify this now, just do this change

Copy link
Contributor Author

Copilot AI commented Nov 8, 2025

@copilot Please additionally to the current changes also add the parameter "--non-interactive" to the create-adapter call and endure that the creator did not returned an errorcode. In the future it wi...

Done in afb7393. Added --non-interactive flag to the create-adapter command. Error code handling was already in place - runCommand rejects the promise for any non-zero exit codes (except 255).

Copilot finished work on behalf of Apollon77 November 8, 2025 17:55
@Apollon77 Apollon77 marked this pull request as ready for review November 10, 2025 22:40
@Apollon77 Apollon77 merged commit ca28709 into main Nov 10, 2025
12 checks passed
@Apollon77 Apollon77 deleted the copilot/adjust-typescript-test-adapter-creator branch November 10, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adjust the "typescript direct without build" test to adapter-creator

2 participants