Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Node.js 6 and upgrade dependencies #5

Merged
merged 2 commits into from
Nov 20, 2018
Merged

Require Node.js 6 and upgrade dependencies #5

merged 2 commits into from
Nov 20, 2018

Conversation

jacargentina
Copy link
Contributor

@sindresorhus please review and merge?

The new windows-release detects windows server versions! yeah!

test.js Outdated
@@ -8,5 +8,5 @@ test(t => {
t.is(m('darwin', '99.0.0'), 'macOS');
t.is(m('linux', '3.13.0-24-generic'), 'Linux 3.13');
t.is(m('win32', '5.1.2600'), 'Windows XP');
t.is(m('win32'), 'Windows');
t.is(m('win32'), 'Windows 98');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. It should continue to be Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test should be fixed: i first changed the line without even looking at this.

But now that i'm looking i've found this: when i run the tests on linux, the effect is the release is fetched from the current os (in my case Fedora), so the effective call to winRelease in my case is like this

		id = winRelease('4.18.13-200.fc28.x86_64');

That is very wrong!

The fix should be on the test, may be passing a valid windows release number? And testing for the real os name, not just the generic "Windows" value as it was.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not on the current operation system and release is not passed, it should just return the OS name without version number, like before.

@sindresorhus
Copy link
Owner

It should still be possible to run osName('win32') on macOS and get Windows back, like before.

@jacargentina
Copy link
Contributor Author

I was trying to make minimum changes to this package; AFAIK to achieve what you want:

Option 1

Changes to the windows-release dependency https://github.com/sindresorhus/windows-release

That package never returns empty string, and that is the problem for getting just Windows

Option 2

Avoid calling winRelease for the use case where you dont provide the release ie: avoid also calling os.release()

Make your choice and i can go on with what you think is the best.

@sindresorhus
Copy link
Owner

👍 Option 2

@jacargentina
Copy link
Contributor Author

Done! Also rebased to simplify history.

id = release.replace(/^(\d+\.\d+).*/, '$1');
return 'Linux' + (id ? ' ' + id : '');
}

if (platform === 'win32') {
id = winRelease(release);
id = release ? winRelease(release) : '';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should still return Windows 10 if calling osName() or osName('win32') (notice no arguments) on Windows 10.

Copy link
Contributor Author

@jacargentina jacargentina Oct 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So fuzzy... So you want:

When running in the same os than the queried, return full OS + release name

Otherwise, return the OS only

Right?

@jacargentina
Copy link
Contributor Author

@sindresorhus ping.

@sindresorhus sindresorhus changed the title Update deps (use windows-release); fix xo errores, fix tests Require Node.js 6 Nov 20, 2018
@sindresorhus sindresorhus changed the title Require Node.js 6 Require Node.js 6 and upgrade dependencies Nov 20, 2018
@sindresorhus sindresorhus merged commit c716329 into sindresorhus:master Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants