Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
morinokami committed Apr 23, 2024
2 parents a30c6d3 + a7e36d5 commit 7581caa
Show file tree
Hide file tree
Showing 250 changed files with 9,634 additions and 3,941 deletions.
12 changes: 12 additions & 0 deletions .changeset/dependabot-update-5682.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"miniflare": patch
---

chore: update dependencies of "miniflare" package

The following dependency versions have been updated:

| Dependency | From | To |
| ------------------------- | ------------- | ------------- |
| workerd | 1.20240405.0 | 1.20240419.0 |
| @cloudflare/workers-types | ^4.20240405.0 | ^4.20240419.0 |
8 changes: 0 additions & 8 deletions .changeset/empty-llamas-fetch.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/flat-clouds-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Mark `ts-json-schema-generator` as a dev dependency
11 changes: 11 additions & 0 deletions .changeset/gorgeous-taxis-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"wrangler": patch
---

fix: fix `wrangler d1 migrations apply` to allow migrations that don't end in a semicolon

Prior to this PR, migrations such as: `SELECT 1` would fail with a nonsensical error about INSERTS: `✘ [ERROR] near "INSERT": syntax error at offset 199 [code: 7500]`

What was happening was that wrangler was injecting a statement at the end of the migration, to update the migrations table saying the query successfully executed.

To avoid this, this PR moves the statement to the start of the migration.
12 changes: 12 additions & 0 deletions .changeset/loud-buckets-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"create-cloudflare": minor
---

feat: Improvements to `hono` template.

The `hono` template has been updated as follows:

- Bumps `create-hono` to `0.7.0`
- Automatically installs dependencies and specifies the detected package manager to avoid interactive prompts
- Adds a `wrangler.toml` file with commented out examples of all available bindings to match other templates.
- Adds a `cf-typegen` package script to automatically regenerate types for `Bindings` from `wrangler.toml`
8 changes: 8 additions & 0 deletions .changeset/new-dolphins-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"wrangler": minor
---

fix: Fix Pages config validation around Durable Objects

Today Pages cannot deploy Durable Objects itself. For this reason it is mandatory that when declaring Durable Objects bindings in the config file, the `script_name` is specified. We are currently not failing validation if
`script_name` is not specified but we should. These changes fix that.
11 changes: 11 additions & 0 deletions .changeset/odd-guests-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"wrangler": patch
---

fix: fix broken Durable Object local proxying (when no `cf` property is present)

A regression was introduced in wrangler 3.46.0 (https://github.com/cloudflare/workers-sdk/pull/5215)
which made it so that missing `Request#cf` properties are serialized as `"undefined"`, this in turn
throws a syntax parse error when such values are parsed via `JSON.parse` breaking the communication
with Durable Object local proxies. Fix such issue by serializing missing `Request#cf` properties as
`"{}"` instead.
5 changes: 0 additions & 5 deletions .changeset/pink-scissors-exercise.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/quick-cheetahs-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-cloudflare": patch
---

fix: make sure that using the current directory doesn't generate an `undefined undefined` log in the output summary.
5 changes: 5 additions & 0 deletions .changeset/rare-papayas-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix: broken link to durable object migrations docs
5 changes: 5 additions & 0 deletions .changeset/serious-socks-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-cloudflare": minor
---

feat: change Durable Objects "Hello, World!" template to use RPC methods
7 changes: 0 additions & 7 deletions .changeset/unlucky-kangaroos-brake.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/warm-bears-marry.md

This file was deleted.

10 changes: 10 additions & 0 deletions .changeset/wise-beds-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"create-cloudflare": patch
"format-errors": patch
"@cloudflare/kv-asset-handler": patch
"miniflare": patch
"workers-playground": patch
"wrangler": patch
---

docs: show new Discord url everywhere for consistency. The old URL still works, but https://discord.cloudflare.com is preferred.
5 changes: 0 additions & 5 deletions .changeset/wise-lemons-remain.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Support
url: https://discord.gg/CloudflareDev
url: https://discord.cloudflare.com
about: "Join us on Discord!"
3 changes: 3 additions & 0 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Install NPM Dependencies
run: pnpm install --frozen-lockfile

- name: Check the changesets
run: node -r esbuild-register tools/deployments/validate-changesets.ts

- name: Check the build
run: pnpm run build
env:
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/deploy-pages-previews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# - non-Cloudflare PRs will not have the secrets needed
# - PRs "from" main would accidentally do a production deployment
if: github.repository_owner == 'cloudflare' && github.head_ref != 'main'
timeout-minutes: 30
timeout-minutes: 60
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Install Dependencies
uses: ./.github/actions/install-dependencies
env:
node-version: 16.18
node-version: 18.18

- name: Build tools and libraries
run: pnpm run build
Expand All @@ -56,9 +56,16 @@ jobs:

- name: Build and Deploy Quick Edit preview
if: contains(github.event.*.labels.*.name, 'preview:quick-edit')
# Quick Edit requires yarn, so needs fairly specific logic
run: cd packages/quick-edit && yarn setup && yarn custom:build && pnpm run deploy
# Quick Edit requires yarn and VS Code build deps, so needs fairly specific logic
run: |
sudo apt-get install -y libkrb5-dev
yarn global add node-gyp
cd packages/quick-edit
yarn setup
yarn custom:build
pnpm run deploy
env:
DEBIAN_FRONTEND: noninteractive
NPM_PUBLISH_TOKEN: NOT_USED # yarn will error if the env var from .npmrc can't be interpolated
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

Expand Down
42 changes: 8 additions & 34 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.node }}
cancel-in-progress: true
timeout-minutes: 20
timeout-minutes: 25
if: github.repository_owner == 'cloudflare' && (github.event_name != 'pull_request' || (github.event_name == 'pull_request' && contains(github.event.*.labels.*.name, 'e2e' )))
name: "E2E Test"
strategy:
Expand Down Expand Up @@ -45,46 +45,20 @@ jobs:
NODE_ENV: "production"
CI_OS: ${{ runner.os }}

- name: Pack Miniflare
run: pnpm pack --pack-destination $HOME
env:
NODE_ENV: "production"
working-directory: packages/miniflare

- name: Modify wrangler package.json miniflare dependency
run: pnpm add $(ls $HOME/miniflare-*.tgz)
working-directory: packages/wrangler

- name: Pack Wrangler
run: pnpm pack --pack-destination $HOME
env:
NODE_ENV: "production"
working-directory: packages/wrangler

- name: Find Wrangler
shell: bash
id: "find-wrangler"
run: echo "dir=$(ls $HOME/wrangler-*.tgz)" >> $GITHUB_OUTPUT;

- name: Run tests (unix)
if: matrix.os == 'macos-13' || matrix.os == 'ubuntu-22.04'
- name: Deploy a local version of Wrangler
run: |
pnpm add ${{ steps.find-wrangler.outputs.dir}} --global
pnpm run --filter wrangler test:e2e
pnpm --filter wrangler deploy ${{ github.workspace}}/temp/wrangler
rm ${{ github.workspace}}/temp/wrangler/templates/tsconfig.json
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
WRANGLER: wrangler
NODE_OPTIONS: "--max_old_space_size=8192"
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
NODE_ENV: "production"

- name: Run tests (windows)
if: matrix.os == 'windows-2022'
- name: Run tests
run: pnpm run --filter wrangler test:e2e
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
WRANGLER: pnpm --silent --package ${{ steps.find-wrangler.outputs.dir}} dlx wrangler
WRANGLER: node ${{ github.workspace}}/temp/wrangler/bin/wrangler.js
WRANGLER_IMPORT: ${{ github.workspace}}/temp/wrangler/wrangler-dist/cli.js
NODE_OPTIONS: "--max_old_space_size=8192"
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pullrequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ jobs:
env:
NODE_OPTIONS: "--max_old_space_size=8192"

- name: Check the changesets
run: node -r esbuild-register tools/deployments/validate-changesets.ts

test:
timeout-minutes: 30
concurrency:
Expand Down
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ packages/miniflare

# In the C3 templates, in particular framework templates, we want to be able to
# use any format that the framework authors prefer/use in their own templates,
# so let's ignore all the c3 template files, exlcuding the c3.ts ones
# so let's ignore all the c3 template files, exlcuding the c3.ts ones, and tests
packages/create-cloudflare/templates/**/*.*
!packages/create-cloudflare/templates/**/c3.ts
!packages/create-cloudflare/templates/**/test/**/*.ts
!packages/create-cloudflare/templates/**/test/**/*.js


# Some of the `@cloudflare/vitest-pool-workers` examples use `satisfies` as it
# makes typing unit tests much easier. Our current version of Prettier doesn't
Expand Down
4 changes: 2 additions & 2 deletions fixtures/additional-modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"check:type": "tsc",
"deploy": "wrangler deploy",
"start": "wrangler dev",
"test": "vitest run",
"test:ci": "vitest run",
"test:watch": "vitest",
"type:tests": "tsc -p ./test/tsconfig.json"
},
"devDependencies": {
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "^4.20240405.0",
"@cloudflare/workers-types": "^4.20240419.0",
"undici": "^5.28.3",
"wrangler": "workspace:*"
}
Expand Down
2 changes: 1 addition & 1 deletion fixtures/ai-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"main": "src/index.js",
"scripts": {
"check:type": "tsc",
"test": "vitest run",
"test:ci": "vitest run",
"test:watch": "vitest",
"type:tests": "tsc -p ./tests/tsconfig.json"
},
Expand Down
9 changes: 3 additions & 6 deletions fixtures/durable-objects-app/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ describe("durable objects", () => {
.replace(/[^\S\n]+\n/g, "\n")
.trimEnd();
}
expect(err).toMatchInlineSnapshot(`
"Command failed: pnpm run dev
X [ERROR] Your Worker depends on the following Durable Objects, which are not exported in your entrypoint file: FooBar.
You should export these objects from your entrypoint, src/index.js."
`);
expect(err).toContain(
"You should export these objects from your entrypoint, src/index.js."
);
});
});
9 changes: 9 additions & 0 deletions fixtures/durable-objects-app/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineProject, mergeConfig } from "vitest/config";
import configShared from "../../vitest.shared";

export default mergeConfig(
configShared,
defineProject({
test: {},
})
);
1 change: 0 additions & 1 deletion fixtures/entrypoints-rpc-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "entrypoints-rpc-tests",
"private": true,
"scripts": {
"test": "vitest run",
"test:ci": "vitest run",
"test:watch": "vitest"
},
Expand Down
4 changes: 2 additions & 2 deletions fixtures/external-durable-objects-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"scripts": {
"check:type": "tsc",
"dev": "npx concurrently -s first -k \"wrangler dev a/index.ts --local --port 8400\" \"wrangler dev b/index.ts --local --port 8401\" \"npx wrangler dev c/index.ts --local --port 8402\" \"cd d && npx wrangler pages dev public --port 8403 --do PAGES_REFERENCED_DO=MyDurableObject@a\"",
"test": "vitest run",
"test:ci": "vitest run",
"test:watch": "vitest",
"type:tests": "tsc -p ./tests/tsconfig.json"
},
"devDependencies": {
"undici": "^5.28.3",
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "^4.20240405.0",
"@cloudflare/workers-types": "^4.20240419.0",
"wrangler": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions fixtures/external-service-bindings-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
"mod-d-dev": "wrangler dev module-worker-d/index.ts --local --port 8504 --env production",
"pages-dev": "cd pages-functions-app && npx wrangler pages dev public --port 8505 --service MODULE_A_SERVICE=module-worker-a MODULE_B_SERVICE=module-worker-b SERVICE_A_SERVICE=service-worker-a STAGING_MODULE_C_SERVICE=module-worker-c@staging STAGING_MODULE_D_SERVICE=module-worker-d@staging",
"dev": "npx concurrently -s first -k 'npm run mod-a-dev' 'npm run mod-b-dev' 'npm run ser-a-dev' 'npm run mod-c-dev' 'npm run mod-d-dev' 'npm run pages-dev'",
"test": "vitest run",
"test:ci": "vitest run",
"test:watch": "vitest",
"type:tests": "tsc --noEmit"
},
"devDependencies": {
"undici": "^5.28.3",
"concurrently": "^8.2.1",
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "^4.20240405.0",
"@cloudflare/workers-types": "^4.20240419.0",
"wrangler": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions fixtures/get-bindings-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"private": true,
"description": "A test for the getBindingsProxy (deprecated) utility",
"scripts": {
"test": "vitest run",
"test:ci": "vitest run",
"test:watch": "vitest",
"type:tests": "tsc --noEmit"
},
"devDependencies": {
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "^4.20240405.0",
"@cloudflare/workers-types": "^4.20240419.0",
"wrangler": "workspace:*",
"undici": "^5.28.3"
}
Expand Down
4 changes: 2 additions & 2 deletions fixtures/get-platform-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"private": true,
"description": "A test for the getPlatformProxy utility",
"scripts": {
"test": "vitest run",
"test:ci": "vitest run",
"test:watch": "vitest",
"type:tests": "tsc --noEmit"
},
"devDependencies": {
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "^4.20240405.0",
"@cloudflare/workers-types": "^4.20240419.0",
"wrangler": "workspace:*",
"undici": "^5.28.3"
}
Expand Down
Loading

0 comments on commit 7581caa

Please sign in to comment.