Skip to content

Commit

Permalink
example: Deprecate the webusb package dependency
Browse files Browse the repository at this point in the history
The webusb feature is already included in the usb package. Let's
deprecate the extra webusb package.
  • Loading branch information
windowsair committed Mar 15, 2024
1 parent 6a33cc9 commit b2b1944
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions examples/daplink-flash/webusb.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* SOFTWARE.
*/

const USB = require('webusb').USB;
const WebUSB = require('usb').WebUSB;
const common = require('./common');
const DAPjs = require('../../');

Expand All @@ -33,7 +33,7 @@ const devicesFound = async (devices) => {
return common.selectDevice(devices);
}

const usb = new USB({ devicesFound });
const usb = new WebUSB({devicesFound: devicesFound});

(async () => {
try {
Expand Down
4 changes: 2 additions & 2 deletions examples/daplink-serial/webusb.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* SOFTWARE.
*/

const USB = require('webusb').USB;
const WebUSB = require('usb').WebUSB;
const common = require('./common');
const DAPjs = require('../../');

Expand All @@ -33,7 +33,7 @@ const devicesFound = async (devices) => {
return common.selectDevice(devices);
}

const usb = new USB({ devicesFound });
const usb = new WebUSB({devicesFound: devicesFound});

(async () => {
try {
Expand Down
4 changes: 2 additions & 2 deletions examples/execute/webusb.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* SOFTWARE.
*/

const USB = require('webusb').USB;
const WebUSB = require('usb').WebUSB;
const common = require('./common');
const DAPjs = require('../../');

Expand All @@ -35,7 +35,7 @@ const devicesFound = async (devices) => {
return common.selectDevice(devices);
}

const usb = new USB({ devicesFound });
const usb = new WebUSB({devicesFound: devicesFound});

(async () => {
try {
Expand Down
4 changes: 2 additions & 2 deletions examples/read-registers/webusb.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* SOFTWARE.
*/

const USB = require('webusb').USB;
const WebUSB = require('usb').WebUSB;
const common = require('./common');
const DAPjs = require('../../');

Expand All @@ -33,7 +33,7 @@ const devicesFound = async (devices) => {
return common.selectDevice(devices);
}

const usb = new USB({ devicesFound });
const usb = new WebUSB({devicesFound: devicesFound});

(async () => {
try {
Expand Down
6 changes: 3 additions & 3 deletions examples/typescript/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

import { stdin } from 'process';
import { USB } from 'webusb';
import { WebUSB } from 'usb';
import { Registers } from './registers';

// Handle single character input from the user
Expand Down Expand Up @@ -74,7 +74,7 @@ const devicesFound = async (devices: USBDevice[]): Promise<USBDevice | undefined
return device;
};

const usb = new USB({ devicesFound });
const usb = new WebUSB({devicesFound: devicesFound});
const registers = new Registers(usb);

(async () => {
Expand All @@ -84,7 +84,7 @@ const registers = new Registers(usb);
console.log(`R${index}: ${register}`);
});
} catch(error) {
console.error(error.message || error);
console.error(error);
}
process.exit();
})();
2 changes: 1 addition & 1 deletion examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"dapjs": "next",
"tsify": "^4.0.1",
"typescript": "^3.4.5",
"webusb": "^2.0.2"
"usb": "^2.11.0"
}
}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"tslib": "^2.6.2",
"typedoc": "^0.25.7",
"typescript": "^5.3.3",
"usb": "^2.11.0",
"webusb": "^2.2.0"
"usb": "^2.11.0"
}
}

0 comments on commit b2b1944

Please sign in to comment.