@payloadcms/codemod 4.0.0-internal.f15737c → 4.0.0-internal.f2a04f7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +5 -2
  2. package/dist/registry.d.ts.map +1 -1
  3. package/dist/registry.js +6 -0
  4. package/dist/registry.js.map +1 -1
  5. package/dist/runbook/payload-v4-upgrade.md +2 -2
  6. package/dist/runbook/v4.mdx +291 -74
  7. package/dist/transforms/migrate-admin-context-properties/basic.input.js +32 -0
  8. package/dist/transforms/migrate-admin-context-properties/basic.input.js.map +1 -0
  9. package/dist/transforms/migrate-admin-context-properties/basic.output.js +30 -0
  10. package/dist/transforms/migrate-admin-context-properties/basic.output.js.map +1 -0
  11. package/dist/transforms/migrate-admin-context-properties/index.d.ts +3 -0
  12. package/dist/transforms/migrate-admin-context-properties/index.d.ts.map +1 -0
  13. package/dist/transforms/migrate-admin-context-properties/index.js +302 -0
  14. package/dist/transforms/migrate-admin-context-properties/index.js.map +1 -0
  15. package/dist/transforms/migrate-admin-context-properties/no-match.input.js +30 -0
  16. package/dist/transforms/migrate-admin-context-properties/no-match.input.js.map +1 -0
  17. package/dist/transforms/migrate-admin-context-properties/no-match.output.js +30 -0
  18. package/dist/transforms/migrate-admin-context-properties/no-match.output.js.map +1 -0
  19. package/dist/transforms/migrate-displayed-field-value-args/basic.input.js +4 -0
  20. package/dist/transforms/migrate-displayed-field-value-args/basic.input.js.map +1 -0
  21. package/dist/transforms/migrate-displayed-field-value-args/basic.output.js +8 -0
  22. package/dist/transforms/migrate-displayed-field-value-args/basic.output.js.map +1 -0
  23. package/dist/transforms/migrate-displayed-field-value-args/index.d.ts +3 -0
  24. package/dist/transforms/migrate-displayed-field-value-args/index.d.ts.map +1 -0
  25. package/dist/transforms/migrate-displayed-field-value-args/index.js +84 -0
  26. package/dist/transforms/migrate-displayed-field-value-args/index.js.map +1 -0
  27. package/dist/transforms/migrate-displayed-field-value-args/namespace.input.js +4 -0
  28. package/dist/transforms/migrate-displayed-field-value-args/namespace.input.js.map +1 -0
  29. package/dist/transforms/migrate-displayed-field-value-args/namespace.output.js +8 -0
  30. package/dist/transforms/migrate-displayed-field-value-args/namespace.output.js.map +1 -0
  31. package/dist/transforms/migrate-displayed-field-value-args/no-match.input.js +4 -0
  32. package/dist/transforms/migrate-displayed-field-value-args/no-match.input.js.map +1 -0
  33. package/dist/transforms/migrate-displayed-field-value-args/no-match.output.js +4 -0
  34. package/dist/transforms/migrate-displayed-field-value-args/no-match.output.js.map +1 -0
  35. package/dist/transforms/rename-diff-value-props/basic.input.js +38 -0
  36. package/dist/transforms/rename-diff-value-props/basic.input.js.map +1 -0
  37. package/dist/transforms/rename-diff-value-props/basic.output.js +38 -0
  38. package/dist/transforms/rename-diff-value-props/basic.output.js.map +1 -0
  39. package/dist/transforms/rename-diff-value-props/index.d.ts +3 -0
  40. package/dist/transforms/rename-diff-value-props/index.d.ts.map +1 -0
  41. package/dist/transforms/rename-diff-value-props/index.js +328 -0
  42. package/dist/transforms/rename-diff-value-props/index.js.map +1 -0
  43. package/dist/transforms/rename-diff-value-props/no-match.input.js +8 -0
  44. package/dist/transforms/rename-diff-value-props/no-match.input.js.map +1 -0
  45. package/dist/upgrade/defaultTag.d.ts +1 -1
  46. package/dist/upgrade/defaultTag.js +2 -2
  47. package/dist/upgrade/defaultTag.js.map +1 -1
  48. package/dist/upgrade/prompt.js +2 -2
  49. package/dist/upgrade/prompt.js.map +1 -1
  50. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/upgrade/prompt.ts"],"sourcesContent":["/**\n * Render the overarching agent prompt for a full Payload v3 -> v4 upgrade,\n * Next.js 16 included. The prompt is a thin orchestrator: it sequences the\n * gates, runs this package's `upgrade` command for the deterministic slice,\n * delegates Next.js to Next's own agent workflow, and points at the migration\n * guide for the judgment work rather than restating any of it. The text is\n * project-agnostic (the agent runs it from the project root). `command` is the\n * token that re-invokes this CLI, so a local checkout points followers at the\n * local build instead of the published package. Pure: the caller prints it.\n */\nexport function renderUpgradePrompt({\n command = 'npx @payloadcms/codemod',\n}: { command?: string } = {}): string {\n return `You are upgrading this project from Payload v3 to v4, Next.js 16 included.\n\nGround rule: resolution over intent. A step is done only when it installs, builds, and boots.\nNever report a task complete because the edit looks right. Confirm it. A silent gap reads as\n\"checked and fine\".\n\n## 0. Preconditions\n- Work on a clean git tree or a fresh branch.\n- Use Node >=24.15 (the exact engines floor is printed by the command in step 2).\n\n## 1. Pre-upgrade migrations (do these on v3, before touching versions)\nSome migrations need the v3 tooling that v4 deletes, so they MUST run before the upgrade:\n- Slate richtext is removed in v4. Migrate Slate -> Lexical while still on v3; the migration path\n is gone once the packages are pinned to v4.\n\nDo not proceed to step 2 until these are complete and committed.\n\n## 2. Payload mechanical slice\nRun this from the project root:\n\n ${command} upgrade run\n\nBy default it resolves Payload from the dist-tag this CLI was installed under (\\`beta\\` when you\nran \\`@payloadcms/codemod@beta\\`, else \\`canary\\`). Add \\`--tag <dist-tag>\\` to pin a specific one.\nThis pins the Payload packages to v4, removes conflicting overrides, writes the toolchain\nfloors, installs, and runs the AST transforms. Read its report:\n- It prints the resolved payload version, the required Next target, and the path to the\n bundled runbook and migration guide. Use those paths below.\n- The unmet \\`@payloadcms/next\\` peer against Next 15 is EXPECTED at this point. Do NOT downgrade\n payload to satisfy it; step 3 resolves it by upgrading Next.\n- Do not hand-edit the versions it pinned.\n\n## 3. Next.js 16 (delegate to Next's workflow)\nPayload v4 requires Next 16. The command above did not touch Next. Run Next's own recommended\nagent workflow, which bumps Next + React and migrates the code as one unit:\n<https://nextjs.org/docs/app/guides/upgrading/version-16#use-an-ai-agent-recommended>\n\nIn short: run \\`npx @next/codemod@canary upgrade latest\\`, then\n\\`npx @next/codemod@canary next-async-request-api .\\`, and follow Next's AGENTS.md workflow for\nthe rest. Keep the result within the Next target range printed in step 2's report. Reinstall\nafterward so the \\`@payloadcms/next\\` peer resolves.\n\n## 4. Regenerate generated files\n\\`payload generate:types && payload generate:importmap\\`. Never hand-edit \\`payload-types.ts\\` or\n\\`importMap.js\\`; regenerate them.\n\n## 5. Fix-forward judgment work (against the now-v4 tree)\nThese depend on the v4 APIs and types existing, so they follow the upgrade. Open the bundled\nmigration guide (\\`v4.mdx\\`, path printed in step 2) and the bundled runbook\n(\\`runbook/payload-v4-upgrade.md\\`) and work the items they list: SCSS -> CSS and \\`--theme-*\\` ->\n\\`--color-*\\` token renames, Lexical union type-narrowing, jobs DB migrations, strict cron parsing,\nand anything flagged in the per-transform notes. Consult the guide for each; do not guess from\nmemory.\n\n## 6. Verify\n- \\`tsc --noEmit\\` (delete \\`tsconfig.tsbuildinfo\\` first; set \\`checkJs: true\\` so \\`importMap.js\\` is covered).\n- Run integration and e2e tests separately.\n- Build.\n- Confirm native modules (e.g. \\`sharp\\`) still load.\n\n## 7. Report\nDistinguish verified, cannot-confirm, and broken. Do not call the upgrade complete while any\ngate fails or any generated file is stale.\n`\n}\n"],"names":["renderUpgradePrompt","command"],"mappings":"AAAA;;;;;;;;;CASC,GACD,OAAO,SAASA,oBAAoB,EAClCC,UAAU,yBAAyB,EACd,GAAG,CAAC,CAAC;IAC1B,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;IAoBN,EAAEA,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2Cd,CAAC;AACD"}
1
+ {"version":3,"sources":["../../src/upgrade/prompt.ts"],"sourcesContent":["/**\n * Render the overarching agent prompt for a full Payload v3 -> v4 upgrade,\n * Next.js 16 included. The prompt is a thin orchestrator: it sequences the\n * gates, runs this package's `upgrade` command for the deterministic slice,\n * delegates Next.js to Next's own agent workflow, and points at the migration\n * guide for the judgment work rather than restating any of it. The text is\n * project-agnostic (the agent runs it from the project root). `command` is the\n * token that re-invokes this CLI, so a local checkout points followers at the\n * local build instead of the published package. Pure: the caller prints it.\n */\nexport function renderUpgradePrompt({\n command = 'npx @payloadcms/codemod',\n}: { command?: string } = {}): string {\n return `You are upgrading this project from Payload v3 to v4, Next.js 16 included.\n\nGround rule: resolution over intent. A step is done only when it installs, builds, and boots.\nNever report a task complete because the edit looks right. Confirm it. A silent gap reads as\n\"checked and fine\".\n\n## 0. Preconditions\n- Work on a clean git tree or a fresh branch.\n- Use Node >=24.15 (the exact engines floor is printed by the command in step 2).\n\n## 1. Pre-upgrade migrations (do these on v3, before touching versions)\nSome migrations need the v3 tooling that v4 deletes, so they MUST run before the upgrade:\n- Slate richtext is removed in v4. Migrate Slate -> Lexical while still on v3; the migration path\n is gone once the packages are pinned to v4.\n\nDo not proceed to step 2 until these are complete and committed.\n\n## 2. Payload mechanical slice\nRun this from the project root:\n\n ${command} upgrade run\n\nBy default it resolves Payload from the dist-tag this CLI was installed under (its own\nprerelease id, else \\`beta\\`). Add \\`--tag <dist-tag>\\` to pin a specific one.\nThis pins the Payload packages to v4, removes conflicting overrides, writes the toolchain\nfloors, installs, and runs the AST transforms. Read its report:\n- It prints the resolved payload version, the required Next target, and the path to the\n bundled runbook and migration guide. Use those paths below.\n- The unmet \\`@payloadcms/next\\` peer against Next 15 is EXPECTED at this point. Do NOT downgrade\n payload to satisfy it; step 3 resolves it by upgrading Next.\n- Do not hand-edit the versions it pinned.\n\n## 3. Next.js 16 (delegate to Next's workflow)\nPayload v4 requires Next 16. The command above did not touch Next. Run Next's own recommended\nagent workflow, which bumps Next + React and migrates the code as one unit:\n<https://nextjs.org/docs/app/guides/upgrading/version-16#use-an-ai-agent-recommended>\n\nIn short: run \\`npx @next/codemod@canary upgrade latest\\`, then\n\\`npx @next/codemod@canary next-async-request-api .\\`, and follow Next's AGENTS.md workflow for\nthe rest. Keep the result within the Next target range printed in step 2's report. Reinstall\nafterward so the \\`@payloadcms/next\\` peer resolves.\n\n## 4. Regenerate generated files\n\\`payload generate:types && payload generate:importmap\\`. Never hand-edit \\`payload-types.ts\\` or\n\\`importMap.js\\`; regenerate them.\n\n## 5. Fix-forward judgment work (against the now-v4 tree)\nThese depend on the v4 APIs and types existing, so they follow the upgrade. Open the bundled\nmigration guide (\\`v4.mdx\\`, path printed in step 2) and the bundled runbook\n(\\`runbook/payload-v4-upgrade.md\\`) and work the items they list: SCSS -> CSS and \\`--theme-*\\` ->\n\\`--color-*\\` token renames, Lexical union type-narrowing, jobs DB migrations, strict cron parsing,\nand anything flagged in the per-transform notes. Consult the guide for each; do not guess from\nmemory.\n\n## 6. Verify\n- \\`tsc --noEmit\\` (delete \\`tsconfig.tsbuildinfo\\` first; set \\`checkJs: true\\` so \\`importMap.js\\` is covered).\n- Run integration and e2e tests separately.\n- Build.\n- Confirm native modules (e.g. \\`sharp\\`) still load.\n\n## 7. Report\nDistinguish verified, cannot-confirm, and broken. Do not call the upgrade complete while any\ngate fails or any generated file is stale.\n`\n}\n"],"names":["renderUpgradePrompt","command"],"mappings":"AAAA;;;;;;;;;CASC,GACD,OAAO,SAASA,oBAAoB,EAClCC,UAAU,yBAAyB,EACd,GAAG,CAAC,CAAC;IAC1B,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;IAoBN,EAAEA,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2Cd,CAAC;AACD"}
package/package.json CHANGED
@@ -1,13 +1,8 @@
1
1
  {
2
2
  "name": "@payloadcms/codemod",
3
- "version": "4.0.0-internal.f15737c",
3
+ "version": "4.0.0-internal.f2a04f7",
4
4
  "description": "Codemods for migrating Payload projects across versions.",
5
5
  "homepage": "https://payloadcms.com",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/payloadcms/payload.git",
9
- "directory": "packages/codemod"
10
- },
11
6
  "license": "MIT",
12
7
  "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
13
8
  "maintainers": [
@@ -17,8 +12,11 @@
17
12
  "url": "https://payloadcms.com"
18
13
  }
19
14
  ],
20
- "sideEffects": false,
21
- "type": "module",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/payloadcms/payload.git",
18
+ "directory": "packages/codemod"
19
+ },
22
20
  "bin": {
23
21
  "payload-codemod": "bin/cli.js"
24
22
  },
@@ -28,6 +26,8 @@
28
26
  "dist",
29
27
  "README.md"
30
28
  ],
29
+ "type": "module",
30
+ "sideEffects": false,
31
31
  "dependencies": {
32
32
  "@clack/prompts": "1.2.0",
33
33
  "semver": "^7.8.5",