@decocms/blocks-cli 7.5.0 → 7.5.2
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.
- package/package.json +3 -3
- package/scripts/generate-invoke.ts +10 -0
- package/scripts/generate-schema.test.ts +4 -4
- package/scripts/generate-sections.test.ts +6 -6
- package/scripts/migrate/analyzers/loader-inventory.ts +1 -1
- package/scripts/migrate/phase-analyze.ts +3 -3
- package/scripts/migrate/phase-cleanup.ts +29 -23
- package/scripts/migrate/phase-report.ts +7 -7
- package/scripts/migrate/phase-scaffold.ts +4 -4
- package/scripts/migrate/phase-transform.ts +1 -1
- package/scripts/migrate/phase-verify.ts +6 -5
- package/scripts/migrate/post-cleanup/rules.ts +55 -44
- package/scripts/migrate/post-cleanup/runner.test.ts +58 -34
- package/scripts/migrate/templates/cache-config.ts +4 -4
- package/scripts/migrate/templates/commerce-loaders.ts +10 -10
- package/scripts/migrate/templates/cursor-rules.test.ts +6 -0
- package/scripts/migrate/templates/cursor-rules.ts +12 -11
- package/scripts/migrate/templates/hooks.test.ts +7 -7
- package/scripts/migrate/templates/hooks.ts +10 -10
- package/scripts/migrate/templates/lib-utils.test.ts +2 -2
- package/scripts/migrate/templates/lib-utils.ts +4 -4
- package/scripts/migrate/templates/no-legacy-packages.test.ts +147 -0
- package/scripts/migrate/templates/package-json.ts +24 -10
- package/scripts/migrate/templates/routes.ts +8 -10
- package/scripts/migrate/templates/sdk-gen.ts +1 -1
- package/scripts/migrate/templates/section-loaders.ts +7 -7
- package/scripts/migrate/templates/server-entry.ts +37 -37
- package/scripts/migrate/templates/setup.ts +6 -6
- package/scripts/migrate/templates/types-gen.ts +2 -2
- package/scripts/migrate/templates/ui-components.ts +2 -2
- package/scripts/migrate/templates/vite-config.ts +12 -3
- package/scripts/migrate/transforms/fresh-apis.ts +5 -5
- package/scripts/migrate/transforms/imports.ts +49 -43
- package/scripts/migrate/transforms/section-conventions.ts +1 -1
- package/scripts/migrate/types.ts +1 -1
- package/scripts/migrate-post-cleanup.ts +8 -8
- package/scripts/migrate.ts +11 -11
package/scripts/migrate.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Migration Script: Fresh/Deno/Preact → TanStack Start/React/Cloudflare Workers
|
|
5
5
|
*
|
|
6
6
|
* Converts a Deco storefront from the old Fresh/Deno stack to the new TanStack Start stack.
|
|
7
|
-
*
|
|
7
|
+
* Ships as part of @decocms/blocks-cli — run from a site's root directory.
|
|
8
8
|
*
|
|
9
9
|
* Usage (from your Fresh site directory):
|
|
10
|
-
* npx -p @decocms/
|
|
10
|
+
* npx -p @decocms/blocks-cli deco-migrate [options]
|
|
11
11
|
*
|
|
12
12
|
* Options:
|
|
13
13
|
* --source <dir> Source directory (default: current directory)
|
|
@@ -102,10 +102,10 @@ function parseArgs(args: string[]): {
|
|
|
102
102
|
|
|
103
103
|
function showHelp() {
|
|
104
104
|
console.log(`
|
|
105
|
-
@decocms/
|
|
105
|
+
@decocms/blocks-cli — Migration Script: Fresh/Deno → TanStack Start
|
|
106
106
|
|
|
107
107
|
Usage:
|
|
108
|
-
npx -p @decocms/
|
|
108
|
+
npx -p @decocms/blocks-cli deco-migrate [options]
|
|
109
109
|
|
|
110
110
|
Options:
|
|
111
111
|
--source <dir> Source directory (default: .)
|
|
@@ -119,10 +119,10 @@ function showHelp() {
|
|
|
119
119
|
--help, -h Show this help message
|
|
120
120
|
|
|
121
121
|
Examples:
|
|
122
|
-
npx -p @decocms/
|
|
123
|
-
npx -p @decocms/
|
|
124
|
-
npx -p @decocms/
|
|
125
|
-
npx -p @decocms/
|
|
122
|
+
npx -p @decocms/blocks-cli deco-migrate --dry-run --verbose
|
|
123
|
+
npx -p @decocms/blocks-cli deco-migrate --source ./my-site
|
|
124
|
+
npx -p @decocms/blocks-cli deco-migrate --strict --with-build
|
|
125
|
+
npx -p @decocms/blocks-cli deco-migrate
|
|
126
126
|
`);
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -136,7 +136,7 @@ async function main() {
|
|
|
136
136
|
|
|
137
137
|
const sourceDir = path.resolve(opts.source);
|
|
138
138
|
|
|
139
|
-
banner("@decocms/
|
|
139
|
+
banner("@decocms/blocks-cli — Migrate: Fresh/Deno → TanStack Start");
|
|
140
140
|
stat("Source", sourceDir);
|
|
141
141
|
stat("Mode", opts.dryRun ? yellow("DRY RUN") : green("EXECUTE"));
|
|
142
142
|
stat("Verbose", opts.verbose ? "yes" : "no");
|
|
@@ -254,7 +254,7 @@ function bootstrap(ctx: { sourceDir: string }) {
|
|
|
254
254
|
// matching `packageManager` field that pins the version.
|
|
255
255
|
const pm = "bun";
|
|
256
256
|
if (!run(`${pm} install`, "Install dependencies", true)) return;
|
|
257
|
-
run("bunx tsx node_modules/@decocms/
|
|
257
|
+
run("bunx tsx node_modules/@decocms/blocks-cli/scripts/generate-blocks.ts", "Generate CMS blocks");
|
|
258
258
|
// generate-invoke emits src/server/invoke.gen.ts with top-level
|
|
259
259
|
// createServerFn declarations + the forwardResponseCookies bridge that
|
|
260
260
|
// propagates VTEX Set-Cookie headers (orderFormId, segment, sc…) to the
|
|
@@ -265,7 +265,7 @@ function bootstrap(ctx: { sourceDir: string }) {
|
|
|
265
265
|
// running the generator gives every freshly-migrated site the canonical
|
|
266
266
|
// RPC path so VTEX hooks (useCart, useUser, useWishlist) work end-to-end.
|
|
267
267
|
run(
|
|
268
|
-
"bunx tsx node_modules/@decocms/
|
|
268
|
+
"bunx tsx node_modules/@decocms/blocks-cli/scripts/generate-invoke.ts",
|
|
269
269
|
"Generate VTEX invoke server functions",
|
|
270
270
|
);
|
|
271
271
|
run("bunx tsr generate", "Generate TanStack routes");
|