Skip to content

feat(data-transfer): add directory export/import format#25867

Merged
innerdvations merged 5 commits intodevelopfrom
feat/data-transfer-folders
Apr 2, 2026
Merged

feat(data-transfer): add directory export/import format#25867
innerdvations merged 5 commits intodevelopfrom
feat/data-transfer-folders

Conversation

@innerdvations
Copy link
Copy Markdown
Contributor

@innerdvations innerdvations commented Mar 31, 2026

What does it do?

  • Adds directory-based Strapi Data Transfer (DTS) export/import: the CLI accepts an unpacked export directory (same layout as inside a .tar: metadata.json, schemas/, entities/, links/, configuration/, assets/, …) in addition to .tar / .tar.gz / .tar.enc archives.
  • Introduces directory source (and related) providers in @strapi/data-transfer, wired through the public package surface and Strapi CLI import/export flow (including validation that a path looks like an unpacked export).
  • Refactors the Strapi core CLI to load Inquirer via a small getInquirer() helper (cached dynamic import) instead of repeating await import('inquirer') at many call sites.
  • Fixes @strapi/cloud-cli: deploy-project/action.ts no longer references a removed loadInquirer symbol (uses the same dynamic import pattern as elsewhere in that package).
  • Moves e2e DTS fixtures under tests/e2e/data/ from committed .tar blobs to unpacked directories so JSON/JSONL and small metadata files are normal text diffs in Git; binary uploads stay under assets/uploads/ as before.
  • Updates contributor / e2e documentation for the new fixture layout and import workflow.
  • Adjusts tooling so fixture trees are not churned by repo-wide formatting: .prettierignore entries for tests/e2e/data/** and **/tmp-dts-export/** (e.g. examples/complex/tmp-dts-export), plus optional EditorConfig overrides for those paths so editor save behavior doesn’t fight fixture files.

Why is it needed?

  • Unpacked directories make export/import fixtures easier to review, diff, and update in Git than opaque archives, while keeping the same on-disk layout Strapi already uses inside a transfer archive.
  • Single, cached Inquirer load in the core CLI avoids duplicated dynamic imports and keeps ESM/CJS interop predictable across CLI commands.
  • The cloud CLI build broke after removing loadInquirer; this restores a valid implementation without pulling core helpers into cloud-cli.
  • Prettier / format-on-save was still touching metadata.json and similar files under example export trees; ignoring those paths prevents noisy EOF/newline-only diffs when running yarn prettier:write.

How to test it?

Environment: Node/Yarn as in the repo root; build Strapi packages if your workflow requires it (yarn setup / yarn build as you normally use for local dev).

Automated

  • Unit tests: @strapi/data-transfer directory provider tests and Strapi CLI import/export/transfer/admin command tests that were updated on this branch.
  • CLI tests: tests/cli/tests/strapi/data-transfer/ (export, import, roundtrip) — they exercise export → output.tar → import using the test app and e2e-backed seed data.
  • E2e: run the Playwright suite or the subset that resets DB from tests/e2e/data (e.g. with-admin) if you touch import paths or fixtures.

Manual

  • From a Strapi app, run strapi export to a filename (producing a .tar as today), then extract it and run strapi import -f /path/to/unpacked/dir (or point -f at the directory directly, per CLI help) and confirm import completes.
  • Optionally compare behavior importing the same content as .tar vs unpacked directory (DB / admin content parity).
  • Run yarn prettier:write and confirm tests/e2e/data/** and examples/complex/tmp-dts-export/** files are not rewritten (no spurious newline-only changes to metadata.json).

Related issue(s)/PR(s)

CMS-538

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
contributor-docs Ready Ready Preview, Comment Apr 2, 2026 9:12am

Request Review

@innerdvations innerdvations added this to the 5.41.1 milestone Mar 31, 2026
@innerdvations innerdvations added source: cli Source is cli package pr: feature This PR adds a new feature labels Mar 31, 2026
@innerdvations innerdvations marked this pull request as ready for review March 31, 2026 11:54
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@dosubot dosubot Bot added flag: documentation This PR requires a documentation update source: core:data-transfer Source is core/data-transfer package labels Mar 31, 2026
@innerdvations
Copy link
Copy Markdown
Contributor Author

@dosubot Only one label may be present on a PR at a time; if you add one, you must also remove one

@dosubot
Copy link
Copy Markdown

dosubot Bot commented Mar 31, 2026

Hi! I'm Dosu and I'm helping the Strapi team. Thanks for the heads-up! I'll keep that in mind — only one label at a time on a PR, and if I add one, I need to remove the existing one first. Got it! 👍

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@innerdvations innerdvations changed the title feat(data-transfer): add dir format feat(data-transfer): add directory export/import format Mar 31, 2026
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Mar 31, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

nclsndr
nclsndr previously approved these changes Apr 1, 2026
Copy link
Copy Markdown
Contributor

@nclsndr nclsndr left a comment

Choose a reason for hiding this comment

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

Nice job @innerdvations 🙌
Managed to export / import with both archive and plain-files folder.

@innerdvations
Copy link
Copy Markdown
Contributor Author

@pwizla No rush (as in, even if it takes a few weeks after we release this it's fine) but we might want documentation on the extra import/export options being added here

@innerdvations innerdvations removed the flag: documentation This PR requires a documentation update label Apr 1, 2026
@butcherZ butcherZ self-requested a review April 1, 2026 18:22
Comment thread packages/core/data-transfer/src/directory/providers/destination/index.ts Outdated
@butcherZ
Copy link
Copy Markdown
Member

butcherZ commented Apr 1, 2026

@pwizla No rush (as in, even if it takes a few weeks after we release this it's fine) but we might want documentation on the extra import/export options being added here

@pwizla this PR is perfect to test my plugin :D I just ran it myself and your Router identified everything correctly 😄

Made-with: Cursor

# Conflicts:
#	packages/core/strapi/src/cli/utils/commander.ts
…ites

Add a Writable `final` handler to the JSONL directory writer so the last
buffer is flushed on normal `.end()`, not only on `destroy`.

Wrap synchronous filesystem work in `createAssetsWriteStream` in try/catch
and report failures as `ProviderTransferError`, matching the pipeline path
and engine diagnostics.

Add a unit test that asserts sync `mkdirSync` errors surface as
`ProviderTransferError` with a preserved cause.
@innerdvations innerdvations merged commit 21402c2 into develop Apr 2, 2026
140 checks passed
@innerdvations innerdvations deleted the feat/data-transfer-folders branch April 2, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: feature This PR adds a new feature source: core:data-transfer Source is core/data-transfer package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants