Skip to content

Commit

Permalink
Merge branch 'main' into update-local-ai-fetcher-to-forward-request-a…
Browse files Browse the repository at this point in the history
…nd-method
  • Loading branch information
G4brym authored Nov 21, 2024
2 parents 3729382 + a30c805 commit 33e5ba9
Show file tree
Hide file tree
Showing 90 changed files with 2,395 additions and 379 deletions.
15 changes: 0 additions & 15 deletions .changeset/clever-grapes-sparkle.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/curly-dryers-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": minor
---

feat: Add production_branch and deployment_trigger to pages deploy detailed artifact for wrangler-action pages parity
5 changes: 5 additions & 0 deletions .changeset/curly-rice-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": minor
---

Fix wrangler pages deployment (list|tail) environment filtering.
6 changes: 6 additions & 0 deletions .changeset/cyan-geese-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@cloudflare/workflows-shared": minor
"miniflare": minor
---

Add proper engine persistance in .wrangler and fix multiple workflows in miniflare
5 changes: 0 additions & 5 deletions .changeset/four-mayflies-smash.md

This file was deleted.

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

Fix observability.logs.enabled validation
5 changes: 0 additions & 5 deletions .changeset/mighty-beds-grab.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/mighty-waves-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/chrome-devtools-patches": patch
---

change package name from @cloudflare/wrangler-devtools to @cloudflare/chrome-devtools-patches
6 changes: 0 additions & 6 deletions .changeset/nasty-monkeys-heal.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/shaggy-monkeys-visit.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/shy-seas-wave.md

This file was deleted.

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

Rename `directory` to `projectRoot` and ensure it's relative to the `wrangler.toml`. This fixes a regression which meant that `.wrangler` temporary folders were inadvertently generated relative to `process.cwd()` rather than the location of the `wrangler.toml` file. It also renames `directory` to `projectRoot`, which affects the `unstable_startWorker() interface.
5 changes: 0 additions & 5 deletions .changeset/tricky-bottles-bow.md

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/deploy-pages-previews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: Deploy Pages Previews
#
# PR Label | Pages Project
# ---------------------------------------------------------
# preview:wrangler-devtools | packages/wrangler-devtools
# preview:chrome-devtools-patches | packages/chrome-devtools-patches
# preview:quick-edit | packages/quick-edit
# preview:workers-playground | packages/workers-playground
#
Expand All @@ -25,7 +25,7 @@ jobs:
# Only run this on PRs that are for the "cloudflare" org and not "from" `main`
# - 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' && (contains(github.event.*.labels.*.name, 'preview:wrangler-devtools') || contains(github.event.*.labels.*.name, 'preview:quick-edit') || contains(github.event.*.labels.*.name, 'preview:workers-playground'))
if: github.repository_owner == 'cloudflare' && github.head_ref != 'main' && (contains(github.event.*.labels.*.name, 'preview:chrome-devtools-patches') || contains(github.event.*.labels.*.name, 'preview:quick-edit') || contains(github.event.*.labels.*.name, 'preview:workers-playground'))
timeout-minutes: 60
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -49,9 +49,9 @@ jobs:
CI_OS: ${{ runner.os }}

- name: Deploy Wrangler DevTools preview
if: contains(github.event.*.labels.*.name, 'preview:wrangler-devtools')
if: contains(github.event.*.labels.*.name, 'preview:chrome-devtools-patches')
run: |
output=$(pnpm --filter @cloudflare/wrangler-devtools run deploy)
output=$(pnpm --filter @cloudflare/chrome-devtools-patches run deploy)
echo "Extracting deployed URL from command output"
url=$(echo "$output" | grep -oP 'Take a peek over at \K\S+')
echo "Extracted URL: $url"
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
VITE_DEVTOOLS_PREVIEW_URL: ${{ env.VITE_DEVTOOLS_PREVIEW_URL }}

- name: "Comment on PR with Devtools Link"
if: contains(github.event.*.labels.*.name, 'preview:wrangler-devtools')
if: contains(github.event.*.labels.*.name, 'preview:chrome-devtools-patches')
uses: marocchino/sticky-pull-request-comment@v2
with:
header: ${{ steps.finder.outputs.pr }}
Expand All @@ -99,7 +99,7 @@ jobs:
```
- name: "Comment on PR with Workers Playground Link"
if: contains(github.event.*.labels.*.name, 'preview:wrangler-devtools') && contains(github.event.*.labels.*.name, 'preview:workers-playground')
if: contains(github.event.*.labels.*.name, 'preview:chrome-devtools-patches') && contains(github.event.*.labels.*.name, 'preview:workers-playground')
uses: marocchino/sticky-pull-request-comment@v2
with:
header: ${{ steps.finder.outputs.pr }}
Expand Down
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ packages/quick-edit/vscode
packages/quick-edit/web

packages/wrangler/config-schema.json
packages/wrangler-devtools/built-devtools
packages/wrangler-devtools/.cipd
packages/wrangler-devtools/.gclient
packages/wrangler-devtools/.gclient_entries
packages/wrangler-devtools/.gclient_previous_sync_commits
packages/wrangler-devtools/.gcs_entries
packages/wrangler-devtools/depot
packages/wrangler-devtools/devtools-frontend
packages/chrome-devtools-patches/built-devtools
packages/chrome-devtools-patches/.cipd
packages/chrome-devtools-patches/.gclient
packages/chrome-devtools-patches/.gclient_entries
packages/chrome-devtools-patches/.gclient_previous_sync_commits
packages/chrome-devtools-patches/.gcs_entries
packages/chrome-devtools-patches/depot
packages/chrome-devtools-patches/devtools-frontend
packages/miniflare/dist-types/

fixtures/remix-pages-app/public/build
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ packages/create-cloudflare/templates*/**/*.*
# but still exclude the worker-configuration.d.ts file, since it's generated
!packages/create-cloudflare/templates*/hello-world/**/*.*
packages/create-cloudflare/templates*/hello-world/**/worker-configuration.d.ts
packages/wrangler-devtools/devtools-frontend
packages/chrome-devtools-patches/devtools-frontend

# dist-functions are generated in the fixtures/vitest-pool-workers-examples/pages-functions-unit-integration-self folder
dist-functions
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Changes should be committed to a new local branch, which then gets pushed to you
git push -u origin <new-branch-name>
```
- Once you are happy with your changes, create a Pull Request on GitHub
- The format for Pull Request titles is `[package name] description`, where the package name should indicate which package of the `workers-sdk` monorepo your PR pertains to (e.g. `wrangler`/`pages-shared`/`wrangler-devtools`), and the description should be a succinct summary of the change you're making.
- The format for Pull Request titles is `[package name] description`, where the package name should indicate which package of the `workers-sdk` monorepo your PR pertains to (e.g. `wrangler`/`pages-shared`/`chrome-devtools-patches`), and the description should be a succinct summary of the change you're making.
- GitHub will insert a template for the body of your Pull Request—it's important to carefully fill out all the fields, giving as much detail as possible to reviewers.

## PR Review
Expand All @@ -215,7 +215,7 @@ Every PR will have an associated pre-release build for all releaseable packages

It's also possible to generate preview builds for the applications in the repository. These aren't generated automatically because they're pretty slow CI jobs, but you can trigger preview builds by adding one of the following labels to your PR:

- `preview:wrangler-devtools` for deploying [wrangler-devtools](packages/wrangler-devtools)
- `preview:chrome-devtools-patches` for deploying [chrome-devtools-patches](packages/chrome-devtools-patches)
- `preview:workers-playground` for deploying [workers-playground](packages/workers-playground)
- `preview:quick-edit` for deploying [quick-edit](packages/quick-edit)

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ Visit the official Workers documentation [here](https://developers.cloudflare.co

## Directory

| Package | Description | Links |
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [`wrangler`](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler) | A command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/). | [Docs](https://developers.cloudflare.com/workers/wrangler/) |
| [`create-cloudflare` (C3)](https://github.com/cloudflare/workers-sdk/tree/main/packages/create-cloudflare) | A CLI for creating and deploying new applications to Cloudflare. | [Docs](https://developers.cloudflare.com/pages/get-started/c3/) |
| [`miniflare`](https://github.com/cloudflare/workers-sdk/tree/main/packages/miniflare) | A simulator for developing and testing Cloudflare Workers, powered by [workerd](https://github.com/cloudflare/workerd) | [Docs](https://miniflare.dev) |
| [`wrangler-devtools`](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler-devtools) | Cloudflare's fork of Chrome DevTools for inspecting your local or remote Workers | |
| [`pages-shared`](https://github.com/cloudflare/workers-sdk/tree/main/packages/pages-shared) | Used internally to power Wrangler and Cloudflare Pages. It contains all the code that is shared between these clients. | |
| Package | Description | Links |
| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [`wrangler`](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler) | A command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/). | [Docs](https://developers.cloudflare.com/workers/wrangler/) |
| [`create-cloudflare` (C3)](https://github.com/cloudflare/workers-sdk/tree/main/packages/create-cloudflare) | A CLI for creating and deploying new applications to Cloudflare. | [Docs](https://developers.cloudflare.com/pages/get-started/c3/) |
| [`miniflare`](https://github.com/cloudflare/workers-sdk/tree/main/packages/miniflare) | A simulator for developing and testing Cloudflare Workers, powered by [workerd](https://github.com/cloudflare/workerd) | [Docs](https://miniflare.dev) |
| [`chrome-devtools-patches`](https://github.com/cloudflare/workers-sdk/tree/main/packages/chrome-devtools-patches) | Cloudflare's fork of Chrome DevTools for inspecting your local or remote Workers | |
| [`pages-shared`](https://github.com/cloudflare/workers-sdk/tree/main/packages/pages-shared) | Used internally to power Wrangler and Cloudflare Pages. It contains all the code that is shared between these clients. | |

## Contributing

Expand Down
17 changes: 17 additions & 0 deletions fixtures/workflow-multiple/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "my-workflow-multiple",
"private": true,
"scripts": {
"deploy": "wrangler deploy",
"start": "wrangler dev",
"test:ci": "vitest"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241106.0",
"undici": "catalog:default",
"wrangler": "workspace:*"
},
"volta": {
"extends": "../../package.json"
}
}
90 changes: 90 additions & 0 deletions fixtures/workflow-multiple/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import {
WorkerEntrypoint,
WorkflowEntrypoint,
WorkflowEvent,
WorkflowStep,
} from "cloudflare:workers";

type Params = {
name: string;
};

export class Demo extends WorkflowEntrypoint<{}, Params> {
async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
const { timestamp, payload } = event;

await step.sleep("Wait", "1 second");

const result = await step.do("First step", async function () {
return {
output: "First step result",
};
});

await step.sleep("Wait", "1 second");

const result2 = await step.do("Second step", async function () {
return {
output: "workflow1",
};
});

return [result, result2, timestamp, payload, "workflow1"];
}
}

export class Demo2 extends WorkflowEntrypoint<{}, Params> {
async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
const { timestamp, payload } = event;

await step.sleep("Wait", "1 second");

const result = await step.do("First step", async function () {
return {
output: "First step result",
};
});

await step.sleep("Wait", "1 second");

const result2 = await step.do("Second step", async function () {
return {
output: "workflow2",
};
});

return [result, result2, timestamp, payload, "workflow2"];
}
}

type Env = {
WORKFLOW: Workflow;
WORKFLOW2: Workflow;
};

export default class extends WorkerEntrypoint<Env> {
async fetch(req: Request) {
const url = new URL(req.url);
const id = url.searchParams.get("id");
const workflowName = url.searchParams.get("workflowName");

if (url.pathname === "/favicon.ico") {
return new Response(null, { status: 404 });
}
let workflowToUse =
workflowName == "2" ? this.env.WORKFLOW2 : this.env.WORKFLOW;

let handle: WorkflowInstance;
if (url.pathname === "/create") {
if (id === null) {
handle = await workflowToUse.create();
} else {
handle = await workflowToUse.create({ id });
}
} else {
handle = await workflowToUse.get(id);
}

return Response.json({ status: await handle.status(), id: handle.id });
}
}
Loading

0 comments on commit 33e5ba9

Please sign in to comment.