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

Fixes the regex replacing one of the version numbers in the pluginMainFile #10

Merged
merged 1 commit into from
Jul 10, 2019

Conversation

IreneStr
Copy link
Contributor

@IreneStr IreneStr commented Jul 9, 2019

Summary

  • Fixes a bug where the initializer regex in the update version config would never match.
  • The update-version tasks now accepts both strings and regexes in options.regEx.

Technical choices

  • Before, <%= pluginVersionConstant %> was literally matched by the regex, which is incorrect. Now, it's actually replaced by the pluginVersionConstant before the regex matches. In order to do so, the regex needed to be created using new RegExp(). Regexes created with // can't have dynamic content. Because we're now dealing with two types of regex formats in the config (strings and regexes with //), the task needed to be modified as well. This change also secures backward compatibility with other plugins using this repo.
  • Strings passed to new RegExp() need different escaping. That's where the extra slashes are coming from 😉.

Test instructions

News SEO

  • Link this branch to release/11.7 of News SEO.
  • Run composer install and yarn install in both repos.
  • Run grunt set-version --new-version=12.3-RC4 in News.
  • Run grunt update-version in News.
  • Check that all version mentions have been updated to 12.3-RC4, especially https://github.com/Yoast/wpseo-news/blob/trunk/wpseo-news.php#L40.

wordpress-seo

  • Link this branch to release/11.7 of wordpress-seo.
  • Run composer install and yarn install in both repos.
  • Run grunt set-version --new-version=12.3-RC4 in wordpress-seo.
  • Run grunt update-version in wordpress-seo.
  • Check that all version mentions have been updated to 12.3-RC4.

When everything is okay, release a new version of this repo, and bump the versions in wordpress-seo and News SEO.

Fixes https://github.com/Yoast/wpseo-news/issues/516

…nFile.

Before, <%= pluginVersionConstant %> was literally matched by the regex, which is incorrect.
Now, it's actually replaced by the pluginVersionConstant before the regex matches.
In order to do so, the regex needed to be created using `new RegExp()`.
Regexes created with // can't have dynamic content.
Because we're now dealing with two types of regex formats in the config (strings and regexes with //),
the task needed to be modified as well. This change also secure backwards compatibility
with other plugins using this repo.
Copy link
Member

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

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

CR 👍

@igorschoester
Copy link
Member

Acceptance ✅

@igorschoester igorschoester merged commit bbe0e68 into develop Jul 10, 2019
@igorschoester igorschoester deleted the 516-fix-version-update-regex branch July 10, 2019 09:05
@igorschoester igorschoester added this to the 1.4.1 milestone Jul 10, 2019
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.

None yet

2 participants