Skip to content

Commit

Permalink
chore: build Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
timrogers committed Feb 11, 2023
1 parent 31d3eaa commit 3c905ef
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dist/commonjs/cli/litra-devices.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
export {};
29 changes: 29 additions & 0 deletions dist/commonjs/cli/litra-devices.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const driver_1 = require("../driver");
commander_1.program
.name('litra-devices')
.description('Lists Litra devices connected to your computer')
.option('--json', 'output the list of devices in structured JSON format');
commander_1.program.parse();
const { json } = commander_1.program.opts();
const devices = (0, driver_1.findDevices)();
if (json) {
console.log(JSON.stringify(devices.map((device) => ({
name: (0, driver_1.getNameForDevice)(device),
serial_number: device.serialNumber,
}))));
}
else {
if (devices.length) {
for (const device of devices) {
console.log(`- ${(0, driver_1.getNameForDevice)(device)} (${device.serialNumber})`);
}
}
else {
console.log('No devices found');
}
}
process.exit(0);
2 changes: 2 additions & 0 deletions dist/esm/cli/litra-devices.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
export {};
27 changes: 27 additions & 0 deletions dist/esm/cli/litra-devices.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env node
import { program } from 'commander';
import { findDevices, getNameForDevice } from '../driver';
program
.name('litra-devices')
.description('Lists Litra devices connected to your computer')
.option('--json', 'output the list of devices in structured JSON format');
program.parse();
const { json } = program.opts();
const devices = findDevices();
if (json) {
console.log(JSON.stringify(devices.map((device) => ({
name: getNameForDevice(device),
serial_number: device.serialNumber,
}))));
}
else {
if (devices.length) {
for (const device of devices) {
console.log(`- ${getNameForDevice(device)} (${device.serialNumber})`);
}
}
else {
console.log('No devices found');
}
}
process.exit(0);

0 comments on commit 3c905ef

Please sign in to comment.