-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(windows): Work on windowslib refactor.
- Loading branch information
Showing
5 changed files
with
168 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,25 @@ | ||
module.exports = { | ||
device: { | ||
sdk: { | ||
/** | ||
* The number of milliseconds to rescan for connected devices. | ||
* @type {Number} | ||
* A list of paths to search for Windows SDKs. | ||
* @type {Array.<String>} | ||
*/ | ||
pollInterval: null | ||
searchPaths: null | ||
}, | ||
|
||
emulators: { | ||
vs: { | ||
/** | ||
* The number of milliseconds to rescan for emulators. | ||
* @type {Number} | ||
* A list of paths to search for Visual Studio installations. | ||
* @type {Array.<String>} | ||
*/ | ||
pollInterval: null | ||
searchPaths: null | ||
}, | ||
|
||
visualstudio: { | ||
vswhere: { | ||
/** | ||
* The number of milliseconds to rescan for Visual Studio installations. | ||
* @type {Number} | ||
* A list of paths to search for the `vswhere.exe` utility. | ||
* @type {Array.<String>} | ||
*/ | ||
pollInterval: null | ||
}, | ||
|
||
windowsPhone: { | ||
/** | ||
* The number of milliseconds to rescan for Windows Phone SDKs. | ||
* @type {Number} | ||
*/ | ||
pollInterval: null | ||
}, | ||
|
||
windowsSDK: { | ||
/** | ||
* The number of milliseconds to rescan for Windows SDKs. | ||
* @type {Number} | ||
*/ | ||
pollInterval: null | ||
searchPaths: null | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import semver from 'semver'; | ||
|
||
function format(ver, min, max, chopDash) { | ||
ver = ('' + (ver || 0)); | ||
if (chopDash) { | ||
ver = ver.replace(/(-.*)?$/, ''); | ||
} | ||
ver = ver.split('.'); | ||
if (min !== undefined) { | ||
while (ver.length < min) { | ||
ver.push('0'); | ||
} | ||
} | ||
if (max !== undefined) { | ||
ver = ver.slice(0, max); | ||
} | ||
return ver.join('.'); | ||
} | ||
|
||
function eq(v1, v2) { | ||
return semver.eq(format(v1, 3, 3), format(v2, 3, 3)); | ||
} | ||
|
||
function gte(v1, v2) { | ||
return semver.gte(format(v1, 3, 3), format(v2, 3, 3)); | ||
} | ||
|
||
function gt(v1, v2) { | ||
return semver.gt(format(v1, 3, 3), format(v2, 3, 3)); | ||
} | ||
|
||
function lte(v1, v2) { | ||
return semver.lte(format(v1, 3, 3), format(v2, 3, 3)); | ||
} | ||
|
||
function lt(v1, v2) { | ||
return semver.lt(format(v1, 3, 3), format(v2, 3, 3)); | ||
} | ||
|
||
function compare(v1, v2) { | ||
return eq(v1, v2) ? 0 : lt(v1, v2) ? -1 : 1; | ||
} | ||
|
||
function rcompare(v1, v2) { | ||
return eq(v1, v2) ? 0 : lt(v1, v2) ? 1 : -1; | ||
} | ||
|
||
function satisfies(ver, str) { | ||
ver = format(ver, 3, 3, true); | ||
str = str.replace(/(<=?\d+(\.\d+)*?)\.x/g, '$1.99999999').replace(/(>=?\d+(\.\d+)*?)\.x/g, '$1.0'); | ||
try { | ||
if (str === '*' || eq(ver, str)) { | ||
return true; | ||
} | ||
} catch (ex) { | ||
// squelch | ||
} | ||
|
||
return str.split(/\s*\|\|\s*/).some(function (range) { | ||
// semver is picky with the '-' in comparisons and it just so happens when it | ||
// parses versions in the range, it will add '-0' and cause '1.0.0' != '1.0.0-0', | ||
// so we test our version with and without the '-9' | ||
return range === '*' || semver.satisfies(ver, range) || (ver.indexOf('-') === -1 && semver.satisfies(ver + '-0', range)); | ||
}); | ||
} | ||
|
||
export default { | ||
format, | ||
eq, | ||
gte, | ||
gt, | ||
lte, | ||
lt, | ||
compare, | ||
rcompare, | ||
satisfies | ||
}; |
Oops, something went wrong.
Can we not keep it as visualstudio? Why rename to a 2 letter word that isn't immediately apparent what it is?