Skip to content

Commit

Permalink
feat(esm-apps): fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenwienk committed May 22, 2024
1 parent c04cf75 commit e171d18
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions lib/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -1701,17 +1701,28 @@ $ sudo systemctl restart docker

const templatePath = path.join(__dirname, '..', 'assets', 'templates', 'app', 'drivers');

// TODO FIX FOR MERGE
// Matter devices do not need a device/driver file. As apps cannot add functionality to Matter devices.
if (!driverWireless.matter) {
if (App.usesModules({ appPath: this.path })) {
await copyFileAsync(path.join(templatePath, 'driver.mjs'), path.join(driverPath, 'driver.js'));
await copyFileAsync(path.join(templatePath, 'device.mjs'), path.join(driverPath, 'device.js'));
} else {
const fileExtension = App.usesTypeScript({ appPath: this.path }) ? '.ts' : '.js';
await copyFileAsync(path.join(templatePath, `driver${fileExtension}`), path.join(driverPath, `driver${fileExtension}`));
await copyFileAsync(path.join(templatePath, `device${fileExtension}`), path.join(driverPath, `device${fileExtension}`));
}
await copyFileAsync(
path.join(templatePath, 'driver.mjs'),
path.join(driverPath, 'driver.js'),
);
await copyFileAsync(
path.join(templatePath, 'device.mjs'),
path.join(driverPath, 'device.js'),
);
} else {
const fileExtension = App.usesTypeScript({ appPath: this.path }) ? '.ts' : '.js';
await copyFileAsync(
path.join(templatePath, `driver${fileExtension}`),
path.join(driverPath, `driver${fileExtension}`),
);
await copyFileAsync(
path.join(templatePath, `device${fileExtension}`),
path.join(driverPath, `device${fileExtension}`),
);
}
}

await fse.ensureDir(path.join(driverPath, 'assets'));
Expand Down

0 comments on commit e171d18

Please sign in to comment.