Skip to content

Commit

Permalink
fix: make plugin header detection more flexible
Browse files Browse the repository at this point in the history
The version bumper now correctly identifies WordPress plugin headers by searching
for any comment block containing "Plugin Name:", rather than requiring a specific
header format. This makes the tool more robust and compatible with a wider range
of WordPress plugin header styles.
  • Loading branch information
matteo-greco committed Dec 6, 2024
1 parent 5576144 commit 862e960
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/versionBumper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ type Version = {
* @throws Error if version not found in plugin header
*/
function findVersionPosition(content: string): { match: string; index: number } {
// Find the plugin header block (must start with Plugin Name after comment start)
const headerRegex = /\/\*\*\s*\n\s*\* Plugin Name:[\s\S]*?\*\//;
// Find any comment block containing Plugin Name
const headerRegex = /\/\*\*[\s\S]*?Plugin Name:[\s\S]*?\*\//;
const headerMatch = content.match(headerRegex);

if (!headerMatch) {
Expand Down

0 comments on commit 862e960

Please sign in to comment.