Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "6"
- "12"

install:
- npm install --dev
Expand Down
25 changes: 13 additions & 12 deletions lib/core/ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ function getPorts() {
let clearDevicePrompt;
return new Promise(
(resolve, reject) => {
function portResolver(err, ports) {
if (err) reject(err);
const portNames = ports.map((port) => port.comName);
if (portNames.length > 0) {
if (clearDevicePrompt) clearDevicePrompt();
resolve(portNames);
} else {
clearDevicePrompt = clearDevicePrompt || printLoading("Plug your device in", ".", 3);
serialport.list(portResolver);
}
}
serialport.list(portResolver);
(function rerun() {
serialport.list().then(ports => {
const portNames = ports.map(port => port.comName);
console.log('portNames: ', portNames)
if (portNames.length > 0) {
if(clearDevicePrompt) clearDevicePrompt();
resolve(portNames);
} else {
clearDevicePrompt = clearDevicePrompt || printLoading("Plug your device in", ".", 3);
rerun()
}
}).catch(reject);
})();
});
}

Expand Down
7 changes: 1 addition & 6 deletions lib/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,7 @@ To upload to your device:
* @param {String} directory The name of the desired new directory
*/
function makeDirectory(directory) {
return new Promise((resolve, reject) => {
mkdirp(directory, err => {
if (err) reject(err);
else resolve();
});
});
return mkdirp(directory);
}

/**
Expand Down
Loading