Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit e2ec7b5

Browse files
authored
merge node-usb-detection and serial-port into one native bindings. (#297)
* merge node-usb-detection and serial-port into one native bindings. * fix eslint. * cannot use arrow function in prototype, see https://rainsoft.io/when-not-to-use-arrow-functions-in-javascript/ * disable usb detector in linux since it is not supported now. * add all native dlls * disable loading error when loading dll. * test travis-ci error for dll loading * use arch in glob search. * add editorconfig back
1 parent eeca889 commit e2ec7b5

File tree

72 files changed

+836
-1288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+836
-1288
lines changed

.editorconfig

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# EditorConfig is awesome: http://EditorConfig.org
2-
3-
# top-most EditorConfig file
4-
root = true
5-
6-
# Tab indentation
7-
[*]
8-
indent_style = space
9-
indent_size = 4
10-
11-
# The indent size used in the `package.json` file cannot be changed
12-
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
13-
[{.travis.yml,npm-shrinkwrap.json,package.json}]
14-
indent_size = 2
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Tab indentation
7+
[*]
8+
indent_style = space
9+
indent_size = 2
10+
11+
# The indent size used in the `package.json` file cannot be changed
12+
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
13+
[{.travis.yml,npm-shrinkwrap.json,package.json}]
14+
indent_size = 2

gulpfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const gulp = require("gulp");
2+
const eslint = require('gulp-eslint');
23
const tslint = require("gulp-tslint");
34
const gutil = require("gulp-util");
45
const ts = require("gulp-typescript");
@@ -18,6 +19,13 @@ gulp.task("tslint", () => {
1819
.pipe(tslint.report());
1920
});
2021

22+
gulp.task("eslint", () => {
23+
return gulp.src(["./vendor/**/*.js","!**/node_modules/**"])
24+
.pipe(eslint())
25+
.pipe(eslint.format())
26+
.pipe(eslint.failAfterError());
27+
});
28+
2129
gulp.task("html-webpack", (done) => {
2230
const config = require("./html/webpack.config.js");
2331
config.context = `${__dirname}/html`;

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,15 @@
178178
"@types/node": "^6.0.40",
179179
"@types/winreg": "^1.2.30",
180180
"del": "^2.2.2",
181+
"eslint": "^3.19.0",
182+
"eslint-config-standard": "^10.2.1",
183+
"eslint-plugin-import": "^2.2.0",
184+
"eslint-plugin-node": "^4.2.2",
185+
"eslint-plugin-promise": "^3.5.0",
186+
"eslint-plugin-require-path-exists": "^1.1.7",
187+
"eslint-plugin-standard": "^3.0.1",
181188
"gulp": "^3.9.1",
189+
"gulp-eslint": "^3.0.1",
182190
"gulp-sourcemaps": "^2.4.1",
183191
"gulp-tslint": "^7.0.1",
184192
"gulp-typescript": "^3.1.5",

src/serialmonitor/serialportctrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class SerialPortCtrl {
2626
});
2727
}
2828

29-
private static serialport = require("../../../vendor/serialport-native");
29+
private static serialport = require("../../../vendor/node-usb-native").SerialPort;
3030

3131
private _currentPort: string;
3232
private _currentBaudRate: number;

src/serialmonitor/usbDetector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class UsbDetector {
3030
if (os.platform() === "linux") {
3131
return;
3232
}
33-
this._usbDector = require("../../../vendor/node-usb-detection");
33+
this._usbDector = require("../../../vendor/node-usb-native").detector;
3434

3535
if (!this._usbDector) {
3636
return;

test/extension.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ suite("Arduino Extension Tests", () => {
6060
// When running test on osx, the vscode instance is hanging there after tests finished and cause mocha timeout.
6161
// As a workaround, closing usb-detection process manually would make test window exit normally.
6262
if (os.platform() !== "linux") {
63-
const usbDector = require("../../vendor/node-usb-detection");
63+
const usbDector = require("../../vendor/node-usb-native").detector;
6464
usbDector.stopMonitoring();
6565
}
6666
});

vendor/node-usb-detection/.eslintrc

Lines changed: 0 additions & 85 deletions
This file was deleted.

vendor/node-usb-detection/CHANGELOG.md

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)