diff --git a/src/lib/generateDefinition.ts b/src/lib/generateDefinition.ts index 88130059a9fbe..f7280dba32cd8 100644 --- a/src/lib/generateDefinition.ts +++ b/src/lib/generateDefinition.ts @@ -54,7 +54,7 @@ type DefinitionWithZigbeeModel = DefinitionWithExtend & {zigbeeModel: string[]}; function generateSource(definition: DefinitionWithZigbeeModel, generatedExtend: GeneratedExtend[]): string { const imports = [...new Set(generatedExtend.map((e) => e.lib ?? 'modernExtend'))]; - const importsStr = imports.map((e) => `const * as ${e == 'modernExtend' ? 'm' : e} = require('zigbee-herdsman-converters/lib/${e}');`).join('\n'); + const importsStr = imports.map((e) => `const ${e == 'modernExtend' ? 'm' : e} = require('zigbee-herdsman-converters/lib/${e}');`).join('\n'); return `${importsStr} const definition = { diff --git a/test/generateDefinition.test.ts b/test/generateDefinition.test.ts index e917ee1c71369..9357a25e3ff26 100644 --- a/test/generateDefinition.test.ts +++ b/test/generateDefinition.test.ts @@ -102,7 +102,7 @@ describe('GenerateDefinition', () => { ], }, externalDefintionSource: ` -const * as m = require('zigbee-herdsman-converters/lib/modernExtend'); +const m = require('zigbee-herdsman-converters/lib/modernExtend'); const definition = { zigbeeModel: ['combo'], @@ -143,7 +143,7 @@ module.exports = definition; ], }, externalDefintionSource: ` -const * as m = require('zigbee-herdsman-converters/lib/modernExtend'); +const m = require('zigbee-herdsman-converters/lib/modernExtend'); const definition = { zigbeeModel: ['combo'], @@ -189,7 +189,7 @@ module.exports = definition; 2: [['msTemperatureMeasurement', [reportingItem('measuredValue', 10, repInterval.HOUR, 100)]]], }, externalDefintionSource: ` -const * as m = require('zigbee-herdsman-converters/lib/modernExtend'); +const m = require('zigbee-herdsman-converters/lib/modernExtend'); const definition = { zigbeeModel: ['combo'], @@ -259,7 +259,7 @@ module.exports = definition; }, configureReporting: {}, externalDefintionSource: ` -const * as m = require('zigbee-herdsman-converters/lib/modernExtend'); +const m = require('zigbee-herdsman-converters/lib/modernExtend'); const definition = { zigbeeModel: ['combo'], @@ -329,7 +329,7 @@ module.exports = definition; }, configureReporting: {}, externalDefintionSource: ` -const * as m = require('zigbee-herdsman-converters/lib/modernExtend'); +const m = require('zigbee-herdsman-converters/lib/modernExtend'); const definition = { zigbeeModel: ['combo'], @@ -405,7 +405,7 @@ module.exports = definition; }, configureReporting: [], externalDefintionSource: ` -const * as philips = require('zigbee-herdsman-converters/lib/philips'); +const philips = require('zigbee-herdsman-converters/lib/philips'); const definition = { zigbeeModel: ['combo'], @@ -484,7 +484,7 @@ module.exports = definition; ], }, externalDefintionSource: ` -const * as m = require('zigbee-herdsman-converters/lib/modernExtend'); +const m = require('zigbee-herdsman-converters/lib/modernExtend'); const definition = { zigbeeModel: ['combo'],