Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Conversation

sis0k0
Copy link
Contributor

@sis0k0 sis0k0 commented Aug 3, 2017

Https request to the v8-versions.json file from the android-runtime repo is used to determine the used v8 version.

@sis0k0 sis0k0 force-pushed the vlaeva/fetch-v8-versions branch from a3f8314 to 64d9ff0 Compare August 3, 2017 14:48
@sis0k0 sis0k0 force-pushed the vlaeva/fetch-v8-versions branch 3 times, most recently from 48999fe to 5079bd9 Compare August 3, 2017 15:55
@sis0k0 sis0k0 force-pushed the vlaeva/fetch-v8-versions branch from 5079bd9 to 189a4c2 Compare August 3, 2017 16:14
@sis0k0 sis0k0 changed the title [DON'T MERGE] refactor: fetch v8Versions map from external url refactor: fetch v8Versions map from external url Aug 3, 2017
bin/ns-bundle Outdated
const platform = options.platform;
let commands = [
() => runTns("prepare", platform)
// () => runTns("prepare", platform)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do, thanks for noticing that!

bin/ns-bundle Outdated
const childProcess = spawn("tns", ["--version"], { shell: true });

childProcess.stdout.on("data", resolve);
childProcess.stdout.on("data", version => resolve(String(version)));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd prefer version.toString() here to String(version).
The latter looks a bit odd, just a personal taste though, although there are some minor differences between the two.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 toString is recommended in some style guides

"generate-android-snapshot": "./bin/generate-android-snapshot"
},
"dependencies": {
"semver": "^5.4.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

An exact version would be better IMO - ^5.4.1 could cause problems in case semver releases 5.5.0 which has breaking changes (which shouldn't happen but can)

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 believe the semver package will follow the semver versioning. Also if there are some changes that they need to introduce because of new node/npm versions, they'll probably do it with minor releses and not patches.

}
});
}).catch(error => {
throw new Error("Cannot find suitable v8 version!");
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it would be sensible to add information about the actual error that occurred here, like for example:
throw new Error(`Cannot find suitable v8 version! Original error: ${error.message || error}`);

const runtimeVersion = this.getAndroidRuntimeVersion().replace(/-.*/, "");

const runtimeRange = Object.keys(v8VersionsMap).find(range => {
return semver.satisfies(runtimeVersion, range)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can optionally shorten this syntax here:

const runtimeRange = Object.keys(v8VersionsMap).find(range =>semver.satisfies(runtimeVersion, range));

Copy link
Contributor

@Mitko-Kerezov Mitko-Kerezov left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@petekanev petekanev left a comment

Choose a reason for hiding this comment

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

Looks good and clean.

@sis0k0 sis0k0 merged commit f474e30 into master Aug 4, 2017
@sis0k0 sis0k0 deleted the vlaeva/fetch-v8-versions branch August 4, 2017 08:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants