Skip to content

fix: strip package.json from zip and document HTTP local-dev setup#7

Merged
louwie17 merged 1 commit intotrunkfrom
fix/zip-and-readme-http
Apr 30, 2026
Merged

fix: strip package.json from zip and document HTTP local-dev setup#7
louwie17 merged 1 commit intotrunkfrom
fix/zip-and-readme-http

Conversation

@louwie17
Copy link
Copy Markdown
Contributor

Summary

  • package.json in zip: npm-packlist always bundles package.json when a files field is present — it's an invariant of how the tool works, not a wp-scripts bug. Fix is a post-build zip -d in the plugin-zip script to strip it before the file is used anywhere.
  • README — insecure transport: replaces the bare filter name with the actual mu-plugin one-liner so a fresh contributor knows exactly what to add. Cross-links the step-3 mention to the local development section.

Changes

package.json

- "plugin-zip": "wp-scripts plugin-zip"
+ "plugin-zip": "wp-scripts plugin-zip && zip -d hey-woo.zip hey-woo/package.json"

README.md — local development section:

- # Or hit MCP directly (requires HTTPS in production; local dev uses
- # the woocommerce_mcp_allow_insecure_transport filter via a mu-plugin):
+ # MCP requires HTTPS by default. For local HTTP, add a mu-plugin:
+ echo '<?php add_filter( "woocommerce_mcp_allow_insecure_transport", "__return_true" );' \
+   | npx @wordpress/env run cli -- bash -c "cat > /var/www/html/wp-content/mu-plugins/allow-http-mcp.php"
+
+ # Then test the endpoint:

Verified locally

$ npm run plugin-zip
...
deleting: hey-woo/package.json

$ unzip -l hey-woo.zip | grep -E "package|LICENSE|README|hey-woo.php"
  hey-woo/hey-woo.php
  hey-woo/LICENSE
  hey-woo/README.md

🤖 Generated with Claude Code

…etup

The files field was added to force-include LICENSE in the zip, but
npm-packlist unconditionally bundles package.json whenever files is set
— there is no escape hatch. The zip -d workaround was non-standard:
no other plugin in the woocommerce org uses that pattern.

Standard wp-scripts behaviour (no files field, .distignore for
exclusions) is used by every other plugin that ships with plugin-zip.
LICENSE omission is normal for WP plugins — the license is declared in
the plugin header's License/License URI fields, which is what
WordPress.org reads. .distignore already excludes the build tooling.

README: replace the bare filter name with the actual mu-plugin one-liner
so contributors know exactly what to drop to test the MCP endpoint over
HTTP on a local wp-env install. Cross-link the step-3 mention to the
local development section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@louwie17 louwie17 force-pushed the fix/zip-and-readme-http branch from 2382ccc to 6469e79 Compare April 30, 2026 10:14
@louwie17 louwie17 enabled auto-merge April 30, 2026 10:18
@louwie17 louwie17 merged commit a028e5a into trunk Apr 30, 2026
2 checks passed
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.

1 participant