Skip to content

Exclude dev files from production builds at the package level#47365

Draft
kraftbj wants to merge 11 commits intotrunkfrom
exclude-dev-vendor-files
Draft

Exclude dev files from production builds at the package level#47365
kraftbj wants to merge 11 commits intotrunkfrom
exclude-dev-vendor-files

Conversation

@kraftbj
Copy link
Copy Markdown
Contributor

@kraftbj kraftbj commented Feb 26, 2026

Fixes #MONOREP-371

Proposed changes

Per code review feedback, moves dev file exclusions from plugin-level .gitattributes (where they targeted vendor/automattic/**) to the package level, where they belong architecturally. The build process builds packages first (applying their .gitattributes), then installs them into plugins via Composer path repos — so package-level exclusions propagate automatically.

  • Add production-exclude rules for source files (.ts, .tsx, .jsx, .scss) and build configs (webpack.config.js, babel.config.js, tsconfig.json, jest.config.js, etc.) to 18 package .gitattributes files
  • Revert all plugin-level .gitattributes vendor exclusion changes from previous commits
  • Update the package skeleton template with commented examples of common exclusion patterns

Packages updated

Group A — Source files + build configs: woocommerce-analytics, jetpack-mu-wpcom, external-media, newsletter, forms, search, backup, paypal-payments, external-connections, subscribers-dashboard, publicize

Group B — Build configs only: blaze, classic-theme-helper, connection, explat, my-jetpack, yoast-promo

Group C — Dev directories only: codesniffer

Not included (deferred)

  • CHANGELOG.md, LICENSE.txt, SECURITY.md — Policy decision needed first
  • Source maps (*.map) — Tracked in MONOREP-394
  • Removing existing plugin-level src/css/*.scss rules — Follow-up after this lands
  • Third-party package exclusions — Not in scope here

Other information

  • Generate changelog entries for this PR (using AI).

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  1. Run jp build --for-mirrors for jetpack and spot-check that excluded files (e.g., .ts, webpack.config.js) don't appear in the build output under vendor/automattic/
  2. Compare before/after file lists for a package like woocommerce-analytics to confirm .ts files are gone from the build
  3. CI will run the standard build + test suite which catches missing files

…duction

Broadens the production-exclude rules in .gitattributes to catch all
TypeScript and SCSS source files under jetpack_vendor/ and vendor/.

The previous SCSS rules only matched src/css/*.scss, missing files in
other paths (15 SCSS files leaking). There were no TypeScript rules at
all for vendor packages (225 .ts/.tsx files leaking).

Fixes MONOREP-371
…uction builds

Add production-exclude rules for TypeScript and SCSS source files under
jetpack_vendor/automattic/ and vendor/automattic/ to every plugin's
.gitattributes. These are build inputs with compiled output already
shipping — they're not needed at runtime.

For wpcomsh, also broadens the existing narrow SCSS rules from
**/src/css/*.scss to **/*.scss to catch files in other paths.

Also updates the plugin skeleton template so new plugins get these
rules from the start.
Copilot AI review requested due to automatic review settings February 26, 2026 22:53
@kraftbj kraftbj added this to the jetpack/15.6 milestone Feb 26, 2026
@kraftbj kraftbj requested a review from a team February 26, 2026 22:53
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 26, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the exclude-dev-vendor-files branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack exclude-dev-vendor-files
bin/jetpack-downloader test jetpack-mu-wpcom-plugin exclude-dev-vendor-files

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Plugin] Automattic For Agencies Client [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Classic Theme Helper Plugin [Plugin] CRM Issues about the Jetpack CRM plugin [Plugin] Inspect [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Paypal Payment Buttons [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] Starter Plugin [Plugin] Super Cache A fast caching plugin for WordPress. [Plugin] VaultPress [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Plugin] Wpcloud Sso [Plugin] Wpcomsh [Tools] Development CLI The tools/cli to assist during JP development. labels Feb 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 26, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Beta plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: March 31, 2026
    • Code freeze: March 31, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Backup plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Vaultpress plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Boost plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Search plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Social plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Starter Plugin plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Protect plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Videopress plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Super Cache plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Mu Wpcom plugin:

  • Next scheduled release: WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Inspect plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Automattic For agencies client plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Classic Theme helper plugin plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Paypal Payment buttons plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcloud Sso plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

/tests/** production-exclude
/build-compat-rulesets.sh production-exclude
/check-docs.sh production-exclude
docs/** production-exclude
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will break the doc link to https://github.com/Automattic/jetpack-codesniffer/tree/trunk/docs/Jetpack.Functions.JsonEncodeFlags.Recommendations.md from JsonEncodeFlagsSniff.

If we want to exclude the docs from vendor/ dirs, using export-ignore would be better here.

/src/js/** production-exclude
babel.config.js production-exclude
webpack.config.js production-exclude
tsconfig.json production-exclude
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the tsconfig.json listing in the monorepo root .gitattributes not taking effect?

Also, we've already got eslint and phpunit configs in there. I wonder whether we should go ahead and add some of these there too. babel.config.js, webpack.config.js, .phpcs.dir.xml, and maybe even /projects/*/*/changelog/** and /projects/*/*/tests/** seem like decent candidates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Contact Form [Feature] Publicize Now Jetpack Social, auto-sharing [Feature] Theme Tools [Feature] WooCommerce Analytics [Package] Backup [Package] Blaze [Package] Classic Theme Helper [Package] Codesniffer [Package] Connection [Package] Explat [Package] External Connections [Package] External Media [Package] Forms [Package] Jetpack mu wpcom WordPress.com Features [Package] My Jetpack [Package] Newsletter [Package] Paypal Payments [Package] Publicize [Package] Search Contains core Search functionality for Jetpack and Search plugins [Package] Subscribers Dashboard [Package] WooCommerce Analytics Enhanced analytics for WooCommerce users [Package] Yoast Promo [Plugin] Automattic For Agencies Client [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Classic Theme Helper Plugin [Plugin] CRM Issues about the Jetpack CRM plugin [Plugin] Inspect [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Paypal Payment Buttons [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] Starter Plugin [Plugin] Super Cache A fast caching plugin for WordPress. [Plugin] VaultPress [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Plugin] Wpcloud Sso [Plugin] Wpcomsh [Status] In Progress [Tools] Development CLI The tools/cli to assist during JP development.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants