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

Add newline to prepended name and compatibility_date in wrangler.toml #5816

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nielsreijers
Copy link

This was causing create-cloudflare to generate an incorrect wrangler.toml for templates that didn't include these attributes.

What this PR solves / how to test

When npm create cloudflare creates a project, it either updates name and compatibility_date properties in wrangler.toml, or adds them if they don't exist yet.
In that case they are added by prepending to the toml file, but this is done without a new line, which results in a broken toml file.

For example this:
npm create cloudflare@latest my-app -- --template xtuc/img-color-worker

Results in this wrangler.toml:

compatibility_date = "2024-05-12"name = "my-app"
type = "webpack"

account_id = ""
workers_dev = true
route = ""
zone_id = ""

Apparently in this case the template did have a name = , which was updated, but no compatibility_date = , so it was prepended to the file but without a new line.

The fix is pretty simple, and I've added a line to the corresponding unit test to parse the resulting toml to make sure it's valid.

Your CONTRIBUTING.md says it's ok to open a PR directly for trivial changes. I think this could be considered trivial, but course that depends on your definition. :-)
So if you'd like me to open an issue for this, then please let me know.

Author has addressed the following

  • Tests
    • TODO (before merge)
    • [X ] Included
    • Not necessary because:
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required / Maybe required
    • [ X] Not required because: Very small local bugfix, covered by extending an existing unit test
  • Changeset (Changeset guidelines)
    • TODO (before merge)
    • Included
    • [ X] Not necessary because: Trivial change
  • Public documentation

This was causing create-cloudflare to generate an incorrect wrangler.toml for templates that didn't include these attributes.
@nielsreijers nielsreijers requested a review from a team as a code owner May 14, 2024 04:12
Copy link

changeset-bot bot commented May 14, 2024

⚠️ No Changeset found

Latest commit: 7dcb807

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

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.

None yet

1 participant