Skip to content

Commit

Permalink
feat: 🤢 add edge and internet explorer
Browse files Browse the repository at this point in the history
build

feat: add appveyor.yml

fix: add npm install to appveyor

fix: move npm install

fix: prettier path

fix: add ENVINFO_DEBUG to appveyor

fix: prettier glob expansion

- prettier uses shell expension 🤦‍♂️

fix: add some debug logging

fix: build, add dist and src to appveyor build

fix: too many slashes yo

fix: motherfucking python

- pretty sure version was output to stderr. WTAF

fix: update python helper on windows

fix: add run command to python helper

fix: remove extra logging for IE 😱

fix: try harder to unset debug flag

fix: python on *nix

fix: remove child_process from helpers

fix: hanging python

fix: does stderr redirect work on windows?

fix: yes it does
  • Loading branch information
tabrindle committed Apr 29, 2018
1 parent ff2064f commit ce17768
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 20 deletions.
15 changes: 15 additions & 0 deletions __tests__/utils.test.js
Expand Up @@ -12,13 +12,28 @@ const cases = {
string: 'Docker version 18.03.0-ce, build 0520e24',
version: '18.03.0',
},
edge: {
string: `
Name : Microsoft.MicrosoftEdge
Version : 20.10240.17146.0
PackageFullName : Microsoft.MicrosoftEdge_20.10240.17146.0_neutral__8wekyb3d8bbwe
InstallLocation : C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe
PackageFamilyName : Microsoft.MicrosoftEdge_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe`,
version: '20.10240.17146.0',
},
elixir: {
regex: /[Elixir]+\s([\d+.[\d+|.]+)/,
index: 1,
string: `Erlang/OTP 20 [erts-9.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Elixir 1.6.2 (compiled with OTP 20)`,
version: '1.6.2',
},
explorer: {
string: `Version
11.0.10240.17443`,
version: '11.0.10240.17443',
},
go: {
string: 'go version go1.9.3 darwin/amd64',
version: '1.9.3',
Expand Down
17 changes: 17 additions & 0 deletions appveyor.yml
@@ -0,0 +1,17 @@
environment:
nodejs_version: "8"

install:
- ps: Install-Product node $env:nodejs_version
- npm install

test_script:
- node --version
- npm --version
- SET ENVINFO_DEBUG=trace
- node src/cli.js
- node dist/cli.js
- SET ENVINFO_DEBUG=""
- npm test

build: off
2 changes: 1 addition & 1 deletion dist/cli.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/envinfo.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -13,9 +13,9 @@
"node": ">=4"
},
"scripts": {
"build": "npm run webpack",
"check:format": "prettier -l 'src/**/*.js'",
"format": "prettier --write 'src/**/*.js'",
"build": "webpack",
"check:format": "prettier -l src/*.js",
"format": "prettier --write src/*.js",
"lint": "eslint src",
"preversion": "npm run test && webpack && git add .",
"start": "node src/cli.js",
Expand Down
51 changes: 36 additions & 15 deletions src/helpers.js
@@ -1,4 +1,3 @@
const childProcess = require('child_process');
const os = require('os');
const osName = require('os-name');
const path = require('path');
Expand Down Expand Up @@ -331,20 +330,10 @@ module.exports = Object.assign({}, utils, packages, {

getPythonInfo: () => {
utils.log('trace', 'getPythonInfo');
let pythonVersion;
let pythonPath;
try {
pythonPath = utils.runSync('which python');
pythonVersion = childProcess
.execFileSync(pythonPath, ['-c', 'import platform; print(platform.python_version());'])
.toString()
.replace(/(\r\n|\n|\r)/gm, '');
} catch (error) {
pythonVersion = NotFound;
}
return Promise.all([pythonVersion, pythonPath]).then(v =>
utils.determineFound('Python', v[0], v[1])
);
return Promise.all([
utils.run('python -V 2>&1').then(utils.findVersion),
utils.run('which python'),
]).then(v => utils.determineFound('Python', v[0], v[1]));
},

getXcodeInfo: () => {
Expand All @@ -368,6 +357,38 @@ module.exports = Object.assign({}, utils, packages, {
);
},

getEdgeInfo: () => {
utils.log('trace', 'getEdgeInfo');
let edgeVersion;
if (process.platform.startsWith('win') && os.release().split('.')[0] === '10') {
edgeVersion = utils
.run('powershell get-appxpackage Microsoft.MicrosoftEdge')
.then(utils.findVersion);
} else {
edgeVersion = Promise.resolve(NA);
}
return edgeVersion.then(v => utils.determineFound('Edge', v, NA));
},

getInternetExplorerInfo: () => {
utils.log('trace', 'getInternetExplorerInfo');
let explorerVersion;
if (process.platform.startsWith('win')) {
const explorerPath = [
process.env.SYSTEMDRIVE || 'C:',
'Program Files',
'Internet Explorer',
'iexplore.exe',
].join('\\\\');
explorerVersion = utils
.run(`wmic datafile where "name='${explorerPath}'" get Version`)
.then(utils.findVersion);
} else {
explorerVersion = Promise.resolve(NA);
}
return explorerVersion.then(v => utils.determineFound('Internet Explorer', v, NA));
},

getChromeInfo: () => {
utils.log('trace', 'getChromeInfo');
let chromeVersion;
Expand Down
2 changes: 2 additions & 0 deletions src/presets.js
Expand Up @@ -10,9 +10,11 @@ module.exports = {
Browsers: [
'Chrome',
'Chrome Canary',
'Edge',
'Firefox',
'Firefox Developer Edition',
'Firefox Nightly',
'Internet Explorer',
'Safari',
'Safari Technology Preview',
],
Expand Down

0 comments on commit ce17768

Please sign in to comment.