Skip to content

Update reference regex to not break on beta versions #808

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

Open
davepagurek opened this issue Apr 17, 2025 · 3 comments · May be fixed by #824
Open

Update reference regex to not break on beta versions #808

davepagurek opened this issue Apr 17, 2025 · 3 comments · May be fixed by #824
Assignees
Labels
Bug Something isn't working
Milestone

Comments

@davepagurek
Copy link
Collaborator

Most appropriate sections of the p5.js website?

Reference

What is your operating system?

Mac OS

Web browser and version

Firefox

Actual Behavior

In the reference builder, we add a v to the start of the latest release if it seems to all be numeric:

if (/^\d+\.\d+\.\d+$/.exec(latestRelease)) {
latestRelease = 'v' + latestRelease;
}

This regex breaks for beta releases, e.g. 2.0.0-beta.5. We're about to release 2.0 so we won't have beta releases for a while, but we may want this working for the future when we do beta 3.0 releases.

Expected Behavior

The regex should match strings like 2.0.0-beta.5 too.

Steps to reproduce

Manually edit this

export const p5Version = "v2.0.0-beta.8" as const;
to not start with a v

Would you like to work on the issue?

Feel free to take this on for me!

@davepagurek davepagurek added the Bug Something isn't working label Apr 17, 2025
@webermayank
Copy link
Contributor

webermayank commented Apr 26, 2025

hey @davepagurek , i would like to take this on and update regex to not break.
The regex should accept beta versions too — e.g., 2.0.0-beta.5 right?
if there are any other things that you would like me to keep in mind, please state that, i will address those.

@ksen0 ksen0 added this to the 2.x Anytime milestone Apr 28, 2025
@ksen0 ksen0 moved this to In Progress in p5.js 2.x 🌱🌳 Apr 28, 2025
@ksen0
Copy link
Member

ksen0 commented Apr 28, 2025

@webermayank thanks for volunteering, and yes, both "1.2.3" and "1.2.3-beta.4" should be covered (so that 'v' is correctly prepended). Please make 2 PRs for both main and 2.0. Thank you!

@webermayank
Copy link
Contributor

webermayank commented Apr 28, 2025

Hey @ksen0 , i just have a quick question
In the description of this issue, in Steps to reproduce - @davepagurek mentioned

Manually edit this

export const p5Version = "v2.0.0-beta.8" as const;

to not start with a v

But i just recently saw that in this commit, this thing has already been implemented in p5-version.ts or am i wrong about this whole information ?

Image

so should i leave this part and just focus in regex in p5.js-website/blob/main/src/scripts/parsers/reference.ts ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants