Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/containers-shared/tests/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("isDockerfile", () => {
expect(isDockerfile("docker.io/httpd:1", undefined)).toBe(false);
});

it("should error if given a non existant dockerfile", async () => {
it("should error if given a non existent dockerfile", async () => {
expect(() => isDockerfile("./FakeDockerfile", undefined))
.toThrowErrorMatchingInlineSnapshot(`
[Error: The image "./FakeDockerfile" does not appear to be a valid path to a Dockerfile, or a valid image registry path:
Expand Down
36 changes: 23 additions & 13 deletions packages/create-cloudflare/src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ export const runDeploy = async (ctx: C3Context) => {
// Important: the following assumes that all framework deploy commands terminate with `wrangler pages deploy`
...(ctx.template.platform === "pages" && ctx.commitMessage && !insideGitRepo
? [
...(pm === "npm" ? ["--"] : []),
"--commit-message",
JSON.stringify(ctx.commitMessage),
]
...(pm === "npm" ? ["--"] : []),
"--commit-message",
JSON.stringify(ctx.commitMessage),
]
: []),
];

Expand All @@ -129,25 +129,35 @@ export const runDeploy = async (ctx: C3Context) => {
)}`,
});

const DEPLOYED_URL_REGEX = /https:\/\/.+\.(pages|workers)\.dev/;

try {
const contents = readFile(outputFile);

const entries = contents
.split("\n")
.filter(Boolean)
.map((entry) => JSON.parse(entry));
const url: string | undefined =

// Single pass to find the URL
const url =
entries.find((entry) => entry.type === "deploy")?.targets?.[0] ??
entries.find((entry) => entry.type === "pages-deploy")?.url;
const deployedUrlRegex = /https:\/\/.+\.(pages|workers)\.dev/;
const deployedUrlMatch = url?.match(deployedUrlRegex);
if (deployedUrlMatch) {
ctx.deployment.url = deployedUrlMatch[0];
} else {
throw new Error("Failed to find deployment url.");

if (!url) {
throw new Error("No deployment entry found in output file.");
}
} catch {
throw new Error("Failed to find deployment url.");

const deployedUrlMatch = url.match(DEPLOYED_URL_REGEX);

if (!deployedUrlMatch) {
throw new Error(`Invalid deployment URL format: ${url}`);
}

ctx.deployment.url = deployedUrlMatch[0];
} catch (error) {
const message = error instanceof Error ? error.message : "Unknown error";
throw new Error(`Failed to find deployment url: ${message}`);
}

// if a pages url (<sha1>.<project>.pages.dev), remove the sha1
Expand Down
2 changes: 1 addition & 1 deletion packages/edge-preview-authenticated-proxy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ async function handleRawHttp(request: Request, url: URL) {
const token = requestHeaders.get("X-CF-Token");
const remote = requestHeaders.get("X-CF-Remote");

// Fallback to the request method for backward compatiblility
// Fallback to the request method for backward compatibility
const method = requestHeaders.get("X-CF-Http-Method") ?? request.method;

if (!token || !remote) {
Expand Down
2 changes: 1 addition & 1 deletion packages/playground-preview-worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function handleRawHttp(request: Request, url: URL, env: Env) {

const headers = new Headers(request.headers);

// Fallback to the request method for backward compatiblility
// Fallback to the request method for backward compatibility
const method = request.headers.get("X-CF-Http-Method") ?? request.method;

headers.delete("X-CF-Http-Method");
Expand Down
2 changes: 1 addition & 1 deletion packages/quick-edit/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd ../../vendor/vscode
# Build vscode
node --max-old-space-size=30000 ./node_modules/gulp/bin/gulp.js vscode-web-min

# Move the output assets to the assets direcotry for the `quick-edit` Worker
# Move the output assets to the assets directory for the `quick-edit` Worker
mv ../vscode-web ../../packages/quick-edit/web/assets

cd ../../packages/quick-edit
Expand Down
4 changes: 2 additions & 2 deletions packages/wrangler/src/__tests__/r2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,7 @@ describe("r2", () => {
Lifecycle rule 'my-rule' removed from bucket 'my-bucket'."
`);
});
it("should handle removing non-existant rule ID as expected", async () => {
it("should handle removing non-existent rule ID as expected", async () => {
const bucketName = "my-bucket";
const ruleId = "my-rule";
const lifecycleRules = {
Expand Down Expand Up @@ -3659,7 +3659,7 @@ describe("r2", () => {
Lock rule 'my-rule' removed from bucket 'my-bucket'."
`);
});
it("should handle removing non-existant rule ID as expected", async () => {
it("should handle removing non-existent rule ID as expected", async () => {
const bucketName = "my-bucket";
const ruleId = "my-rule";

Expand Down