Skip to content

Conversation

@conico974
Copy link
Contributor

fix #648

@changeset-bot
Copy link

changeset-bot bot commented Jan 23, 2025

🦋 Changeset detected

Latest commit: 8e31e84

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch
app-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 23, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/aws@709

commit: 8e31e84

@conico974
Copy link
Contributor Author

Oops, i was about to merge and i noticed an issue @khuezy PTAL

if (major1 !== major2) return major1 - major2;
if (minor1 !== minor2) return minor1 - minor2;
return patch1 - patch2;
return (patch1 ?? 0) - (patch2 ?? 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

don't you have the same issue with minor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically we could have this issue for minor2 only.
We only use this to compare with next version, and the next version comes from next/package.json (so should always contain major, minor and patch)

v2 is the one we provide to test, i don't see in which scenario we'd use latest

I should add a comment above the function so that we know about its limitation and how it should be used

Copy link
Contributor

Choose a reason for hiding this comment

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

The function assumes that M, m, p exists.

 const [major1 = 0, minor1 = 0, patch1 = 0] = v1.split(".").map(Number);
 const [major2 = 0, minor2 = 0, patch2 = 0] = v2.split(".").map(Number);

This should default those values.

@vicb
Copy link
Contributor

vicb commented Jan 23, 2025

Not sure if important but:

if (v1 === "latest") return 1;

// ->

if (v1 === "latest") {
return v2 === "latest" ? 0 : 1;
}

Copy link
Contributor

@khuezy khuezy left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

* Compare two semver versions.
* @param v1 - First version. Can be "latest", otherwise it should be a valid semver version in the format of `major.minor.patch`. Usually is the next version from the package.json without canary suffix. If minor or patch are missing, they are considered 0.
* @param v2 - Second version. Should not be "latest", it should be a valid semver version in the format of `major.minor.patch`. If minor or patch are missing, they are considered 0.
* @see
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't see anything :)

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

LGTM!

Thought.

When I see

buildHelper.compareSemver(options.nextVersion, "14.1") >= 0;

I always think that there would be a nicer way:

buildHelper.compareSemver(options.nextVersion, ">=", 14.1);

@conico974
Copy link
Contributor Author

LGTM!

Thought.

When I see

buildHelper.compareSemver(options.nextVersion, "14.1") >= 0;

I always think that there would be a nicer way:

buildHelper.compareSemver(options.nextVersion, ">=", 14.1);

I guess we could refactor it later, i'll merge it for now

@conico974 conico974 merged commit b4ad0f0 into opennextjs:main Jan 23, 2025
3 checks passed
@github-actions github-actions bot mentioned this pull request Jan 23, 2025
@conico974 conico974 deleted the fix/stableIncremental branch March 14, 2025 12:44
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.

When did incremental became stable?

3 participants