Skip to content

Commit

Permalink
chore: update dep + devDep (#162)
Browse files Browse the repository at this point in the history
## Description

Some packages where outdated. I updated all dependencies

## How Has This Been Tested?

`npm run format:fix && npm run lint`

## Types of changes

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [x] Refactorization (non-functional change which improve code readibility)
  • Loading branch information
jimmywarting authored Aug 10, 2021
1 parent 8ade6cd commit 1eeaa50
Show file tree
Hide file tree
Showing 10 changed files with 9,241 additions and 17,407 deletions.
4 changes: 3 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"tabWidth": 2,
"semi": true,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
26,553 changes: 9,192 additions & 17,361 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@
"node": ">=10.0.0"
},
"dependencies": {
"command-line-args": "^3.0.1",
"command-line-usage": "^5.0.5"
"command-line-args": "^5.2.0",
"command-line-usage": "^6.1.1"
},
"devDependencies": {
"@commitlint/cli": "^9.1.2",
"@commitlint/config-conventional": "^8.3.4",
"@commitlint/travis-cli": "^9.1.2",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@commitlint/travis-cli": "^13.1.0",
"babel-eslint": "^10.1.0",
"dotenv": "^4.0.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.17.1",
"eslint-plugin-node": "^9.2.0",
"husky": "^3.1.0",
"jest": "^26.1.0",
"prettier": "1.18.2",
"standard-version": "^8.0.0"
"dotenv": "^10.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-node": "^11.1.0",
"husky": "^7.0.1",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"standard-version": "^9.3.1"
},
"scripts": {
"test": "jest",
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const init = newConfig => {
};
};

const notAvailable = () => { throw new Error('ERROR : not available for this OS'); }
const notAvailable = () => {
throw new Error('ERROR : not available for this OS');
};

const scan = () => {
if (!platform().scan) {
Expand Down
3 changes: 1 addition & 2 deletions src/macOS/current-connections/__test__/command.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ const command = require('../command');
describe('mac Os get current connections command', () => {
it('should generate basic command', () => {
expect(command()).toEqual({
cmd:
'/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
cmd: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
args: ['--getinfo']
});
});
Expand Down
3 changes: 1 addition & 2 deletions src/macOS/current-connections/command.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const command = () => ({
cmd:
'/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
cmd: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
args: ['--getinfo']
});

Expand Down
3 changes: 1 addition & 2 deletions src/macOS/scan/__test__/command.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ const command = require('../command');
describe('mac Os scan command', () => {
it('should generate basic command', () => {
expect(command()).toEqual({
cmd:
'/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
cmd: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
args: ['--scan']
});
});
Expand Down
3 changes: 1 addition & 2 deletions src/macOS/scan/command.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const command = () => ({
cmd:
'/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
cmd: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
args: ['--scan']
});

Expand Down
31 changes: 17 additions & 14 deletions src/utils/promiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@ const extractArgs = allArgs => {
};
};

module.exports = func => config => (...allArgs) => {
const { args, callback } = extractArgs(allArgs);
module.exports =
func =>
config =>
(...allArgs) => {
const { args, callback } = extractArgs(allArgs);

if (typeof callback === 'function') {
func(config, ...args)
.then(response => {
callback(null, response);
})
.catch(error => {
callback(error);
});
} else {
return func(config, ...args);
}
};
if (typeof callback === 'function') {
func(config, ...args)
.then(response => {
callback(null, response);
})
.catch(error => {
callback(error);
});
} else {
return func(config, ...args);
}
};
16 changes: 8 additions & 8 deletions src/windows-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ function getHexSsid(plainTextSsid) {
}

function win32WirelessProfileBuilder(selectedAp, key) {
let profile_content =
`<?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>${selectedAp.ssid}</name> <SSIDConfig> <SSID> <hex>${getHexSsid(selectedAp.ssid)}</hex> <name>${selectedAp.ssid}</name> </SSID> </SSIDConfig>`;
let profile_content = `<?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>${
selectedAp.ssid
}</name> <SSIDConfig> <SSID> <hex>${getHexSsid(
selectedAp.ssid
)}</hex> <name>${selectedAp.ssid}</name> </SSID> </SSIDConfig>`;

if (selectedAp.security.includes('WPA2')) {
profile_content +=
`<connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>WPA2PSK</authentication> <encryption>AES</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>passPhrase</keyType> <protected>false</protected> <keyMaterial>${key}</keyMaterial> </sharedKey> </security> </MSM>`;
profile_content += `<connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>WPA2PSK</authentication> <encryption>AES</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>passPhrase</keyType> <protected>false</protected> <keyMaterial>${key}</keyMaterial> </sharedKey> </security> </MSM>`;
} else if (selectedAp.security.includes('WPA')) {
profile_content +=
`<connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>WPAPSK</authentication> <encryption>TKIP</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>passPhrase</keyType> <protected>false</protected> <keyMaterial>${key}</keyMaterial> </sharedKey> </security> </MSM>`;
profile_content += `<connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>WPAPSK</authentication> <encryption>TKIP</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>passPhrase</keyType> <protected>false</protected> <keyMaterial>${key}</keyMaterial> </sharedKey> </security> </MSM>`;
} else {
if (selectedAp.security_flags.includes('WEP')) {
profile_content +=
`<connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>open</authentication> <encryption>WEP</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>networkKey</keyType> <protected>false</protected> <keyMaterial>${key}</keyMaterial> </sharedKey> </security> </MSM>`;
profile_content += `<connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>open</authentication> <encryption>WEP</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>networkKey</keyType> <protected>false</protected> <keyMaterial>${key}</keyMaterial> </sharedKey> </security> </MSM>`;
} else {
profile_content +=
'<connectionType>ESS</connectionType> <connectionMode>manual</connectionMode> <MSM> <security> <authEncryption> <authentication>open</authentication> <encryption>none</encryption> <useOneX>false</useOneX> </authEncryption> </security> </MSM>';
Expand Down

0 comments on commit 1eeaa50

Please sign in to comment.