npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-patch-wordpress

v4.0.0

Published

Patch your core WordPress.

Downloads

12,629

Readme

grunt-patch-wordpress

Unit Tests

Patch your develop-wordpress directory like a boss (also works on other trac based projects)

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

  npm install grunt-patch-wordpress --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-patch-wordpress');

The "patch_wordpress" task

patch_wordpress{
  tracUrl: 'core.trac.wordpress.org'
}

Apply a patch from the command line

  1. Have a diff or a patch file in your working Directory, then run grunt patch. If multiple files are found, you'll be asked which one to apply.

  2. Enter a ticket number, e.g.

  • grunt patch:15705
  1. Enter a ticket url, e.g.
  • grunt patch:https://core.trac.wordpress.org/ticket/15705
  1. Enter a patch url, e.g.
  • grunt patch:https://core.trac.wordpress.org/attachment/ticket/11817/13711.diff
  1. Enter a github url that points to a changeset such as a Pull Request, e.g.
  • grunt patch:https://github.com/aaronjorbin/develop.wordpress/pull/23

Upload a patch from the command line

After you've made changes to your local WordPress develop repository, you can upload a patch file directly to a Trac ticket. e.g. given the ticket number is 2907,

grunt upload_patch:2907

You can also store your WordPress.org credentials in environment variables. Please exercise caution when using this option, as it may cause your credentials to be leaked!

export WPORG_USERNAME=matt
export WPORG_PASSWORD=MyPasswordIsVerySecure12345
grunt uploadPatch:40000

Using the file_mappings option

If you'd like to map old file paths in your patch to new file paths during the patching process, you can pass a file mappings object as an option. Using this option can be helpful when the file paths in the project have been changed since you've created your patch.

The file mappings object should contain old file paths and the corresponding new file paths. In the Gruntfile.js of your project, this would look like this:

patch: {
	options: {
		file_mappings: {
			'old_path1': 'new_path1',
			'old_path2': 'new_path2',
			'old_path3': 'new_path3',
		}
	}
}

In this example, the patch task will look for 'old_path1', 'old_path2' and 'old_path3' in your patch and replace them during patching with 'new_path1', 'new_path2', and 'new_path3' respectively.

Contributing

Please follow the WordPress coding standards.

  • Add unit tests and documentation for any new or changed functionality.
  • Lint and test your code using npm run lint and npm run test.

Release History

  • 0.1.0 - Initial Release
  • 0.1.1 - Fix bug when only one diff|patch exists in the working directory
  • 0.1.2 - Update wording of instructions
  • 0.2.0 - Add support for patches generated in more ways. Improve UX by outputing results all the time
  • 0.3.0 - Only keep diff when debug flag is passed. Default to selecting newest patch. Make more files patchable. Allow input during patching process incase the shell prompts the user
  • 0.4.0 - add upload_patch, add support for github urls
  • 0.4.1 - Remove Mocha as a peerdendency
  • 0.4.2 - set cmd-diff to diff for svn
  • 1.0.0 - Add filemapping option. Bump minimum node version. Change code style. Update tooling.
  • 2.0.0 - Bump minimum node version. Use @wordpress/scripts. Allow Credentials to be stored. Reduce Dependancy on Grunt.
  • 3.0.0 - Bump minimum node version to Node 12. Update wp-scripts and some general formatting. Use a custom user agent for requests.
  • 3.0.1 - Add support for more github URL formats. Internal: Use Github Actions instead of Travis.
  • 4.0.0 - Bump minimum node version and some dependencies.