-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Wp-Scripts: add new command version-replace
#39786
base: trunk
Are you sure you want to change the base?
Wp-Scripts: add new command version-replace
#39786
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @xaviranik! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
I think this is interesting and really helpful, but maybe we could do better given the opportunity? So an This would be a bigger change though, and maybe parsing of the files is required. And I'm also not sure how to do with the manually added |
@kevin940726 Thanks for your insight on this. In simple form, are we talking about this: A new API is added:
An old API is changed/modified:
So on the Release/Build process, we would ideally run Result:
One more thing that I would like to point out is, in the current implementation, we are not bounding the developers to provide the Feel free to let me know your thoughts about this. |
Hi @xaviranik, sorry for the late reply! What I meant is to parse all the files and find functions that are added in this release. We can then automatically add We can still automatically attach I'm not very familiar with PHP tooling though so not sure about the scope. @gziolo might have a better suggestion or feedback? |
Hello @gziolo, let us know your thoughts on this. We can move forward with this PR. |
Hi @xaviranik and @gziolo. This PR and associated issue were reviewed in today's Documentation Bug Scrub. We are checking in to see what the current status is. Thanks! |
It's tempting to add more commands to More importantly, there is also this recurring question how do we decide what to add to the package and what are the criteria, and how can we measure them? My current opinion is that we should seek how to improve the default experience by moving some commands that are non-essential for development purposes to other packages that can be installed on-demand. However, I'm aware that it's a separate discussion to have. |
What?
This PR adds a new
version-replace
command in@wordpress/scripts
to replace version stringon files for a WordPress plugin.
Why?
fixes #39761
Usage
Add the following to your
package.json
:Execute
npm run version-replace
to replace version constant string in files.Default Configuration
By default, the following files are taken into consideration for version replaced:
Out of the box, the version string constant is your plugin's
package.json
uppercasename
field with_SINCE
.For
name
field inpackage.json
having value ofmy-plugin
, the version string constant isMY_PLUGIN_SINCE
.More examples:
name
field valuegutenberg
: version string constantGUTENBERG_SINCE
name
field valuegutenberg-custom
: version string constantGUTENBERG_CUSTOM_SINCE
Customization
By adding the following to your
package.json
:How has this been tested?
I executed the steps manually to test
version-replace
files with WordPress:version-replace-wp-scripts.mp4