Open HarryGwinnell opened 2 years ago
Made a few changes here to remove the type: module and switch to using .mjs files for those files that use ESM
This is fantastic work, thank you for contributing!
I'm not sure why the rest of the checks are failing, I might have missed some changes one of the CI pipelines, will follow up shortly.
Would it be cheeky to add myself to the contributors in the Readme @tabrindle 😉
For compatibility, on my cursory testing, with a couple of tweaks that I'll push later, the dist package will run on Node 10.13 and above (the first 10.,x LTS build), though it doesn't currently run in 8.x. I can do some digging for 8.x support though I'm not so confident on that one
Otherwise I think this is as much as is going to fit into this PR. Anything else you want me to address?
@tabrindle Just checking if you've had a chance to look at this
can confirm create-react-app
crash on that error for now ( @tabrindle )
hey it's nice to see it's been working on. thx a lot @HarryGwinnell
npx create-react-app --info
Error: Command failed: wmic os get Caption
'wmic' is not recognized as an internal or external command,
operable program or batch file.
at b (C:\Users\xxx\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\envinfo\dist\envinfo.js:1:95303)
at Function.e.exports.sync (C:\Users\xxx\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\envinfo\dist\envinfo.js:1:97166)
at e.exports (C:\Users\xxx\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\envinfo\dist\envinfo.js:1:93520)
at e.exports (C:\Users\xxx\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\envinfo\dist\envinfo.js:1:92667)
at C:\Users\xxx\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\envinfo\dist\envinfo.js:1:91417
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 0) {
code: 1,
stdout: '',
stderr: "'wmic' is not recognized as an internal or external command,\r\n" +
'operable program or batch file.\r\n',
failed: true,
signal: null,
cmd: 'wmic os get Caption',
timedOut: false
}
npm notice
There are some need of Powershell commands to replace wmic
on browser.js:159
and ides.js:49
?
ides.js:49: wmic datafile where name="C:\\\\Program Files\\\\Android\\\\Android Studio\\\\bin\\\\studio.exe" get Version
As Powershell command running through CMD, it probably will look like:
powershell -command "(Get-ItemProperty -LiteralPath 'C:\\\\Program Files\\\\Android\\\\Android Studio\\\\bin\\\\studio.exe').VersionInfo | Format-Table -Property FileVersion -HideTableHeaders"
browser.js:159: wmic datafile where "name='${explorerPath}'" get Version
As Powershell command running through CMD, it probably will look like:
powershell -command "(Get-ItemProperty -LiteralPath '${explorerPath}').VersionInfo | Format-Table -Property FileVersion -HideTableHeaders"
There are FileVersion
and ProductVersion
properties, and in my tests for these specific files it had same value.
Maybe -ExecutionPolicy Bypass
is needed for Powershell scripts.
Thanks for the feedback @erickriva. I've made the changes as you suggested, but I've opted for ProductVersion, since FileVersion seems to include a version number of the build tooling which isn't relevant. It's interesting that the IE binary is still present in Win 11 despite being unable to open it.
For the execution policy, cycling through execution policy modes, I can't find a combination where Yarn will run but the command won't, so no concerns there.
Also bumped the version number by a major version
What's the status of this PR?
🦤
Apologies in advance for the long PR, hoping to trigger some discussion here so it's relevant to include the whole thing. I can break this down into smaller subsequent PRs if this change is desired.
To preface, this work came out of investigation of #213, and the fact that os-name (https://github.com/sindresorhus/os-name) has migrated to an ESM package. In order to maintain this dependency, and import the latest version which removes the dependency on wmic (which is removed in latest versions of Windows 10 and 11), that required that envinfo also switch to ESM. This should close #209 and #213
envinfo on Windows 11 build 22509 today:
envinfo on Windows 11 build 22509 after this PR:
What this PR does:
What this PR does not do:
wmic
references in the codebase, in browser.js:159 and ides.js:49. These don't break envinfo at the moment so I've left them for followup. EDIT: Fixed