Skip to content

Commit

Permalink
Local env for cloudflare functions with makefile (#2978)
Browse files Browse the repository at this point in the history
This PR adds local development support for Cloudflare Pages functions.

It integrates the wrangler dev server to the `make up.full` command.
  • Loading branch information
mlbrgl authored Jan 11, 2024
2 parents c62f4c5 + 2c25b47 commit 6669f7b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ up.full: require create-if-missing.env.full wordpress/.env tmp-downloads/owid_me
set remain-on-exit on \; \
new-window -n lerna 'yarn startLernaWatcher' \; \
set remain-on-exit on \; \
new-window -n functions 'yarn startLocalCloudflareFunctions' \; \
set remain-on-exit on \; \
new-window -n welcome 'devTools/docker/banner.sh; exec $(LOGIN_SHELL)' \; \
bind R respawn-pane -k \; \
bind X kill-pane \; \
Expand Down
1 change: 1 addition & 0 deletions devTools/docker/banner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Try these URLs to see if your environment is working:
http://localhost:3030/admin/test <-- a list of all charts in the db
http://localhost:8080/wp/wp-admin/ <-- the WordPress admin interface
http://localhost:8090/ <-- the vite dev server
http://localhost:8788/ <-- the cloudflare functions dev server
Happy hacking!
EOF
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"revertLastDbMigration": "yarn typeorm migration:revert -d itsJustJavascript/db/dataSource.js",
"runPostUpdateHook": "node --enable-source-maps ./itsJustJavascript/baker/postUpdatedHook.js",
"startAdminServer": "node --enable-source-maps ./itsJustJavascript/adminSiteServer/app.js",
"startLocalCloudflareFunctions": "wrangler pages dev localBake --compatibility-date 2023-10-09",
"startDeployQueueServer": "node --enable-source-maps ./itsJustJavascript/baker/startDeployQueueServer.js",
"startLernaWatcher": "lerna watch --scope '@ourworldindata/*' -- lerna run build --scope=\\$LERNA_PACKAGE_NAME --include-dependents",
"startTmuxServer": "node_modules/tmex/tmex dev \"yarn startTscServer\" \"yarn startLernaWatcher\" \"yarn startAdminServer\" \"yarn startViteServer\"",
Expand Down

0 comments on commit 6669f7b

Please sign in to comment.