Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 52b4115

Browse files
committed
Move update-check and cf.json default locations to node_modules
1 parent 02f8b9b commit 52b4115

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

packages/http-server/src/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface HTTPPluginDefaults {
3434
}
3535

3636
const defaultCertRoot = path.resolve(".mf", "cert");
37-
const defaultCfPath = path.resolve(".mf", "cf.json");
37+
const defaultCfPath = path.resolve("node_modules", ".mf", "cf.json");
3838
const defaultCfFetch = process.env.NODE_ENV !== "test";
3939
const defaultCfFetchEndpoint = "https://workers.cloudflare.com/cf.json";
4040
const defaultCf: IncomingRequestCfProperties = {

packages/http-server/test/plugin.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ test("HTTPPlugin: logs options", (t) => {
138138
"Live Reload: true",
139139
]);
140140
logs = logPluginOptions(HTTPPlugin, { cfFetch: true });
141-
t.deepEqual(logs, [`Request cf Object Fetch: .mf${path.sep}cf.json`]);
141+
t.deepEqual(logs, [
142+
`Request cf Object Fetch: node_modules${path.sep}.mf${path.sep}cf.json`,
143+
]);
142144
logs = logPluginOptions(HTTPPlugin, { cfFetch: false });
143145
t.deepEqual(logs, []);
144146
});

packages/jest-environment-miniflare/src/storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class StackedMemoryStorage extends MemoryStorage {
1414
// If the storage wasn't created immediately (e.g. caches.open(), Durable
1515
// Object instances), the stack may be popped more times than it's pushed.
1616
// If this happens, default to an empty map, since the storage didn't exist
17-
// at the new stack level.
17+
// at the new stack level.
1818
this.map = this.stack.pop() ?? new Map();
1919
}
2020
}

packages/miniflare/src/cli.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ async function main() {
9999
// Get currently installed package metadata
100100
const pkgFile = path.join(__dirname, "..", "..", "package.json");
101101
const pkg = JSON.parse(await fs.readFile(pkgFile, "utf8"));
102-
const mfDir = path.resolve(".mf");
103-
await fs.mkdir(mfDir, { recursive: true });
104-
const lastCheckFile = path.join(mfDir, "update-check");
102+
const cacheDir = path.resolve("node_modules", ".mf");
103+
await fs.mkdir(cacheDir, { recursive: true });
104+
const lastCheckFile = path.join(cacheDir, "update-check");
105105
await updateCheck({ pkg, lastCheckFile, log: mf.log });
106106
} catch (e: any) {
107107
mf.log.debug("Unable to check for updates: " + e.stack);

0 commit comments

Comments
 (0)