Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: split readConfig and readPages config to simplify and lower responsibilities #7472

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

andyjessop
Copy link
Contributor

@andyjessop andyjessop commented Dec 6, 2024

Fixes #000.

The readConfig function currently does too much:

  • it needs to know about pages config quirks
  • it needs to know how to modify config to get python scripts to work

Added to that, the readConfig function currently takes a requirePagesConfig flag, but actually does more than just checking for its existence - it also does pages-specific normalisation and validation, and changes the behaviour of errors and logs within the function.

This refactor splits up readConfig into readConfig + readPagesConfig.

The goal is to simplify the top level function and make it easier to read and modify in the future.

  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: covered by existing tests
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal changes only

@andyjessop andyjessop added e2e Run e2e tests on a PR no-changeset-required labels Dec 6, 2024
Copy link

changeset-bot bot commented Dec 6, 2024

⚠️ No Changeset found

Latest commit: 4a457de

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

github-actions bot commented Dec 6, 2024

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/12202600733/npm-package-wrangler-7472

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7472/npm-package-wrangler-7472

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12202600733/npm-package-wrangler-7472 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12202600733/npm-package-create-cloudflare-7472 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12202600733/npm-package-cloudflare-kv-asset-handler-7472
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12202600733/npm-package-miniflare-7472
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12202600733/npm-package-cloudflare-pages-shared-7472
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12202600733/npm-package-cloudflare-vitest-pool-workers-7472
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12202600733/npm-package-cloudflare-workers-editor-shared-7472
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12202600733/npm-package-cloudflare-workers-shared-7472
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12202600733/npm-package-cloudflare-workflows-shared-7472

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.93.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20241205.0
workerd 1.20241205.0 1.20241205.0
workerd --version 1.20241205.0 2024-12-05

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@andyjessop andyjessop force-pushed the aj/read-config-refactor branch 2 times, most recently from 6e31db9 to 749c66c Compare December 6, 2024 10:27
@andyjessop andyjessop marked this pull request as ready for review December 6, 2024 10:27
@andyjessop andyjessop requested review from a team as code owners December 6, 2024 10:27
@andyjessop andyjessop force-pushed the aj/read-config-refactor branch from 749c66c to 36a40bf Compare December 6, 2024 10:29
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Love it. Do the tests pass?
Have you tried out a few Workers and Pages projects just to be sure?

@andyjessop
Copy link
Contributor Author

@petebacondarwin

Love it. Do the tests pass? Have you tried out a few Workers and Pages projects just to be sure?

Tests are passing and seems to work well locally as far as I can see!

…mber of responsibilities

cjhore: remove spurious code
@andyjessop andyjessop force-pushed the aj/read-config-refactor branch from 36a40bf to 4a457de Compare December 6, 2024 16:40
@andyjessop andyjessop merged commit 119819f into main Dec 6, 2024
31 checks passed
@andyjessop andyjessop deleted the aj/read-config-refactor branch December 6, 2024 18:14
penalosa pushed a commit that referenced this pull request Jan 10, 2025
…mber of responsibilities (#7472)

cjhore: remove spurious code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e tests on a PR no-changeset-required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants