From 4bcb4a3b21f494ccfe4845230c5d8e8ad057f144 Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Thu, 27 Jan 2022 18:57:32 +0000 Subject: [PATCH] feat: (resolves #320) disable persistence by default (adding --enable-persistence flag to turn back on) --- packages/wrangler/src/dev.tsx | 13 ++++++++++--- packages/wrangler/src/index.tsx | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/wrangler/src/dev.tsx b/packages/wrangler/src/dev.tsx index dda43c11d2eb..1dd4a629d383 100644 --- a/packages/wrangler/src/dev.tsx +++ b/packages/wrangler/src/dev.tsx @@ -40,6 +40,7 @@ export type DevProps = { initialMode: "local" | "remote"; jsxFactory: undefined | string; jsxFragment: undefined | string; + enablePersistence: boolean; bindings: CfWorkerInit["bindings"]; public: undefined | string; assetPaths: undefined | AssetPaths; @@ -102,6 +103,7 @@ function Dev(props: DevProps): JSX.Element { site={props.assetPaths} public={props.public} port={port} + enablePersistence={props.enablePersistence} /> ) : ( { return ["--binding", `${key}=${value}`]; }), diff --git a/packages/wrangler/src/index.tsx b/packages/wrangler/src/index.tsx index df756d168d40..2087c4c80839 100644 --- a/packages/wrangler/src/index.tsx +++ b/packages/wrangler/src/index.tsx @@ -541,6 +541,10 @@ export async function main(argv: string[]): Promise { .option("jsx-fragment", { describe: "The function that is called for each JSX fragment", type: "string", + }) + .option("enable-persistence", { + describe: "Enable persistence for this session (only for local mode)", + type: "boolean", }); }, async (args) => { @@ -608,6 +612,7 @@ export async function main(argv: string[]): Promise { initialMode={args.local ? "local" : "remote"} jsxFactory={args["jsx-factory"] || envRootObj?.jsx_factory} jsxFragment={args["jsx-fragment"] || envRootObj?.jsx_fragment} + enablePersistence={args["enable-persistence"] || false} accountId={config.account_id} assetPaths={getAssetPaths( config,