fix(info): display correct os name on Windows 11 #4968
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #4961
This PR upgrades the
os-name
package from 4.0.0 to latest 5.1.0 (sindresorhus/os-name@v4.0.0...v5.1.0), which included a fix for Windows 11.Note 1: As
os-name
v5 is pure ESM package, importing it withrequire('os-name')
will result in an error. However, when"module": "commonjs"
is set intsconfig
,tsc
will automatically convertawait import(...)
intoawait Promise.resolve().then(() => require(...))
:which will cause the following error when running
ionic info
:To fix this, the recommended approach is to set
"module": "node16"
in TypeScript 4.7 or later. During my attempt to upgrade TypeScript to 4.7, I encountered sereval type errors while runninglerna run build
. I was able to resolve most of them through find and replace, and managed to successfully build 15 out of 16 packages (jonz94@8b74ed4). However, the remaining errors were different, and I felt like I did not have enough knowledge about the codebase to address those errors.In the end, I resorted to using
eval()
as a quick and dirty workaround 🙃Note 2: The
import()
function requires node.js >=13.2.0
, and currently the minimal required node.js version is10.3.0
ionic-cli/packages/@ionic/cli/package.json
Lines 10 to 12 in a2eb4b2
However, once PR #4965 (or #4972) is merged, the minimal required version will be bumped up to 16.0.0, which means this won't be an issue anymore.