Skip to content

Conversation

james-elicx
Copy link
Collaborator

@james-elicx james-elicx commented Mar 20, 2025

  • Adds commands to use with the CLI
  • Moves the OpenNext initialisation to be run at the root of the CLI
  • Migrates e2es to use commands

This is part 3 of 3 in a stack made with GitButler:

Copy link

changeset-bot bot commented Mar 20, 2025

🦋 Changeset detected

Latest commit: a147d77

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Mar 20, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@479

commit: a147d77

@james-elicx james-elicx force-pushed the james/commands-2 branch 2 times, most recently from 0f9964c to 40e86f1 Compare March 20, 2025 15:20
@james-elicx james-elicx marked this pull request as ready for review March 20, 2025 15:56
Base automatically changed from james/r2 to main March 21, 2025 11:06
Copy link
Collaborator

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

LGTM, I just have a small question.

@james-elicx james-elicx merged commit 0c93e8b into main Mar 21, 2025
7 checks passed
@james-elicx james-elicx deleted the james/commands-2 branch March 21, 2025 14:23
@chrox
Copy link

chrox commented Mar 26, 2025

@james-elicx The new commands for cli is great but there is no documentation for the breaking change. Following the documentation here it will shot just your feet with:

npm install --save-dev @opennextjs/cloudflare@latest

and

"deploy": "opennextjs-cloudflare && wrangler deploy"

And error log in Cloudflare worker shows:

23:00:16.820 | Success: Build command completed
-- | --
23:00:16.822 | Executing user deploy command: NODE_OPTIONS="--max-old-space-size=8192" npm run deploy
23:00:17.310 |  
23:00:17.310 | > @readest/[email protected] deploy
23:00:17.310 | > NEXT_PUBLIC_APP_PLATFORM=web opennextjs-cloudflare && wrangler deploy
23:00:17.310 |  
23:00:17.899 | file:///opt/buildhome/repo/node_modules/.pnpm/@[email protected][email protected]/node_modules/@opennextjs/cloudflare/dist/cli/args.js:47
23:00:17.900 | throw new Error("Error: invalid command, expected 'build' \| 'preview' \| 'deploy' \| 'populateCache'");
23:00:17.900 | ^
23:00:17.900 |  
23:00:17.900 | Error: Error: invalid command, expected 'build' \| 'preview' \| 'deploy' \| 'populateCache'
23:00:17.900 | at getArgs (file:///opt/buildhome/repo/node_modules/.pnpm/@[email protected][email protected]/node_modules/@opennextjs/cloudflare/dist/cli/args.js:47:19)
23:00:17.900 | at file:///opt/buildhome/repo/node_modules/.pnpm/@[email protected][email protected]/node_modules/@opennextjs/cloudflare/dist/cli/index.js:40:18
23:00:17.900 | at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
23:00:17.900 | at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:483:26)
23:00:17.901 | at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)

@chrox
Copy link

chrox commented Mar 26, 2025

OK. I found the solution in the readme file: https://github.com/opennextjs/opennextjs-cloudflare/pull/479/files#diff-be36604f10bbd9205e3930ca4cdb26388354a780fe7a8407735067cbff7694ec

The deploy script now should be:

"deploy": "opennextjs-cloudflare build && wrangler deploy"

@james-elicx
Copy link
Collaborator Author

Hi @chrox, sorry for the delay between when this release shipped and when the docs PR was merged - it was updated shortly after your comment was left here.

@chrox
Copy link

chrox commented Mar 27, 2025

I appreciate the update! Thanks for getting the docs merged and for following up.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants