Skip to content

Commit 79d86b8

Browse files
chore: adapt code to upstream deprecation (#16192)
* chore: adapt code to upstream deprecation Signed-off-by: Alexander Niebuhr <45965090+alexanderniebuhr@users.noreply.github.com> * fix remove ununsed import Signed-off-by: Alexander Niebuhr <45965090+alexanderniebuhr@users.noreply.github.com> * Apply suggestion from @alexanderniebuhr * Apply suggestion from @alexanderniebuhr * Apply suggestion from @alexanderniebuhr * Apply suggestion from @alexanderniebuhr --------- Signed-off-by: Alexander Niebuhr <45965090+alexanderniebuhr@users.noreply.github.com>
1 parent 44fd3b8 commit 79d86b8

5 files changed

Lines changed: 13 additions & 19 deletions

File tree

.changeset/sweet-feet-happen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/cloudflare': patch
3+
---
4+
5+
Removes an unused function re-export from the `/info` package path

.changeset/tame-hairs-scream.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Uses today’s date for Cloudflare `compatibility_date` in `astro add cloudflare`
6+
7+
When creating new projects, `astro add cloudflare` now sets `compatibility_date` to the current date. Previously, this date was resolved from locally installed packages, which could be unreliable in some package manager environments. Using today’s date is simpler and more reliable across environments, and is supported by [`workerd`](https://github.com/cloudflare/workers-sdk/pull/13051).

packages/astro/src/cli/add/index.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import fsMod, { existsSync, promises as fs } from 'node:fs';
2-
import { createRequire } from 'node:module';
32
import path from 'node:path';
43
import { fileURLToPath, pathToFileURL } from 'node:url';
54
import * as clack from '@clack/prompts';
@@ -217,18 +216,7 @@ export async function add(names: string[], { flags }: AddOptions) {
217216

218217
if (await askToContinue({ flags, logger })) {
219218
const data = await getPackageJson();
220-
let compatibilityDate: string;
221-
try {
222-
const require = createRequire(root);
223-
const { getLocalWorkerdCompatibilityDate } = await import(
224-
require.resolve('@astrojs/cloudflare/info')
225-
);
226-
({ date: compatibilityDate } = getLocalWorkerdCompatibilityDate({
227-
projectPath: rootPath,
228-
}));
229-
} catch {
230-
compatibilityDate = new Date().toISOString().slice(0, 10);
231-
}
219+
let compatibilityDate = new Date().toISOString().slice(0, 10);
232220

233221
await fs.writeFile(
234222
wranglerConfigURL,

packages/integrations/cloudflare/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"homepage": "https://docs.astro.build/en/guides/integrations-guide/cloudflare/",
2020
"exports": {
2121
".": "./dist/index.js",
22-
"./info": "./dist/info.js",
2322
"./entrypoints/server": "./dist/entrypoints/server.js",
2423
"./entrypoints/preview": "./dist/entrypoints/preview.js",
2524
"./entrypoints/server.js": "./dist/entrypoints/server.js",

packages/integrations/cloudflare/src/info.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)