Add wrangler.toml support in pages deploy#5377
Conversation
🦋 Changeset detectedLatest commit: 2bde607 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8541501264/npm-package-wrangler-5377You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5377/npm-package-wrangler-5377Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8541501264/npm-package-wrangler-5377 dev path/to/script.jsAdditional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8541501264/npm-package-create-cloudflare-5377 --no-auto-updatenpm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8541501264/npm-package-cloudflare-kv-asset-handler-5377npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8541501264/npm-package-miniflare-5377npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8541501264/npm-package-cloudflare-pages-shared-5377npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8541501264/npm-package-cloudflare-vitest-pool-workers-5377Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
|
@CarmenPopoviciu - just realised that we can't error when wrangler.toml has no |
8f8be4c to
05c9235
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5377 +/- ##
=======================================
Coverage 72.28% 72.28%
=======================================
Files 331 331
Lines 17004 17062 +58
Branches 4328 4352 +24
=======================================
+ Hits 12291 12333 +42
- Misses 4713 4729 +16
|
There was a problem hiding this comment.
@dario-piotrowicz we kept this as a warning, but I changed the message based on our conversation. Let me know what you think of it <3
05c9235 to
81b21ec
Compare
| const accountId = await requireAuth(configCache); | ||
|
|
||
| projectName ??= config.project_name; | ||
| let projectName = |
There was a problem hiding this comment.
// TODO @CarmenPopoviciu
if the project specified by wrangler.toml's name does not exist, pages deploy will fail, because we're attempting to get the project here. In combination with the name field being mandatory, and Pages toml validation throwing an err if field is missing, this basically puts us in the position where we can not deploy new Pages projects with a wrangler.toml file, only existing ones.
We should instead warn that the project doesn't exist and offer users the option of us creating the project for them, like we do for projects without a config file
There was a problem hiding this comment.
fixed, YAY 🎉 😍 ! Will add some comprehensive tests tomorrow and link here
There was a problem hiding this comment.
turns out writing tests for interactive pages deploy is not as trivial as I thought, mainly because we're doing some funky prompting that is hard to mock. Will address this as a followup
81b21ec to
73bef08
Compare
wrangler.toml support in pages deploywrangler.toml support in pages deploy
73bef08 to
e1902e3
Compare
2c587bb to
e945b6d
Compare
e945b6d to
2bde607
Compare
|
Hi all, PS: |
|
Hey @hrueger - thanks for your interest in trying this out! We had not released all the pieces of the backend to this last night. Please do give it a full work out and report any problems you have to us as GH issues, so that we can follow up and fix. |
|
Good call on the json schema - we'll look into fixing that up. |
What this PR solves / how to test
This PR adds
wrangler.tomlsupport inpages deploy♫♫♫
♫♫♫
Author has addressed the following
Test Plan 🚀
Apart from unit/integration/fixtures tests, this PR was manually tested based on the following test plan:
pages deploy [<directory>]should still work correctly, for Pages projects without a config filepages deployshould pick up configuration fromwrangler.toml, if file exists andpages_build_output_diris specifiedpages deploy [<directory>]should warn and ignore thewrangler.tomlfile, if it exists butpages_build_output_diris not specifiedpages deploywith validwrangler.tomlshould deploy to new projectspages deploywith validwrangler.tomlshould deploy to existing projectspages deployshould fail if no[<directory>]argument was passed and configuration file does not specifypages_build_output_dirpages deployshould fail if configuration file is not validpages deployshould always deploy to the Pages project specified by the top-levelnameconfiguration field, regardless of the corresponding env-level configurationpages deployshould fail if top-levelnameconfiguration field is not specified, irrespective of the targeted environment, and whether that environment's configuration specififes thenamefieldpages deploy --branch=<name_of_production_branch>should applyproductionspecific configuration when deploying to theproductionenvironment, if[env.production]is specified inwrangler.tomlpages deploy --branch=<name_of_production_branch>should fallback to top-level configuration when deploying to theproductionenvironment, if[env.production]is not specified inwrangler.tomlpages deploy --branch=<name_of_non_prod_branch>should applypreviewspecific configuration when deploying to thepreviewenvironment, if[env.preview]is specified inwrangler.tomlpages deploy --branch=<name_of_non_prod_branch>should fallback to top-level configuration when deploying to thepreviewenvironment, if[env.preview]is not specified inwrangler.tomlpages deployshould apply inheritable environment config specified in wrangler.toml, specific to the environment targeted by the deploymentpages deployshould apply non-inheritable environment config specified in wrangler.toml, specific to the environment targeted by the deploymentpages deployshould overridewrangler.tomlconfig with cmd line argspages deployshould allow existing Pages projects to opt in using a config filewrangler.tomlwrangler.tomlfile and re-deploypages deployshould allow existing Pages projects to opt out of using a config file