Skip to content

Split figma-transformer to Packagist so consumers stop vendoring the monorepo #1364

Description

@chubes4

Problem

php-transformer was split to Packagist in #802 with .github/workflows/php-transformer-split.yml and a .gitattributes that keeps the dist lean. figma-transformer never got the same treatment. It has a package-root composer.json (psr-4src/) but no .gitattributes and no split mirror, so there is no published package to install.

Consumers therefore vendor the entire monorepo. static-site-importer/composer.json declares an inline type: package entry pointing at https://github.com/Automattic/blocks-engine/archive/refs/tags/figma-transformer-v0.1.3.zip with psr-4 rooted at figma-transformer/src/.

Measured cost in a shipped product

The published static-site-importer v1.8.1 release asset is 8,191,363 bytes (6.77MB of compressed entries, 28.36MB expanded, 3,080 files). Breaking the archive down by compressed size:

vendor/automattic/blocks-engine-figma-transformer   5077.3KB  2091 files   75.0% of vendor payload
vendor/automattic/blocks-engine-php-transformer      760.1KB   261 files
vendor/league/commonmark                             241.4KB   382 files

Inside the figma vendor directory:

fixtures/            3095.5KB  1067 files   <- Figma test fixtures
php-transformer/      764.6KB   448 files   <- complete duplicate copy, including its tests
packages/             456.8KB   392 files   <- the JS engine
figma-transformer/    704.8KB   154 files   <- the only part anyone installs it for
docs/ scripts/ tests/ CONTEXT.md CONTRIBUTING.md ~54KB

~4.37MB of the 6.77MB compressed package — 63% — is Figma fixtures, a duplicate php-transformer tree, and a JavaScript engine. The duplicate php-transformer copy is 448 files against the real package's 261, because it predates the #802 export-ignore and still carries tests/.

What the consumer actually needs from all of it is one class. The only FigmaTransformer\* reference in SSI's runtime PHP is Compression\ZstdCommandDecoder, in includes/class-static-site-importer-figma-import.php.

Scope

  • Add figma-transformer/.gitattributes mirroring the php-transformer one: export-ignore tests/, dev tooling, homeboy.json, composer.lock.
  • Extend the Publish php-transformer to Packagist via automated subtree-split mirror #802 subtree-split mirror to figma-transformer, publishing automattic/blocks-engine-figma-transformer from a split repo so the package root is figma-transformer/ rather than the monorepo root.
  • Let consumers drop the inline repositories entry and require the real package.

Acceptance

  • The installed vendor directory contains figma PHP source plus docs/contracts only — no fixtures/, no packages/, no nested php-transformer/.
  • git archive of the split prefix carries no test or fixture trees.
  • The figma import path still resolves Compression\ZstdCommandDecoder and the fig fixture e2e passes.
  • Downstream, the static-site-importer release asset drops below 3MB.

Note for the consumer migration

static-site-importer.php already probes both layouts when bootstrapping — vendor/automattic/blocks-engine-figma-transformer/figma-transformer/figma-transformer.php and .../blocks-engine-figma-transformer/figma-transformer.php. The split package shape is already anticipated by the loader, so the consumer side should be close to a dependency swap.

Downstream tracker: Automattic/static-site-importer#1397. Sibling packaging cleanup for php-transformer: #1359.


AI assistance disclosure: this issue was investigated and drafted by Claude Sonnet 4.6 running in Claude Code, operated by @chubes4. The AI inspected blocks-engine at trunk (f8e12d04), static-site-importer at main (52d589f), and the published v1.8.1 release asset, and computed the archive breakdowns quoted above by reading the ZIP central directory. Reviewed by a human before posting.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions