From 63dda6dedd4c6ea1d5ce72e9cf3fe5f88339a927 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 22 Feb 2023 20:53:56 +0000 Subject: [PATCH] fix(astro): correctly change configuration when node adapter is added (#6333) Co-authored-by: Nate Moore --- .changeset/swift-islands-promise.md | 5 +++++ packages/astro/src/core/add/index.ts | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .changeset/swift-islands-promise.md diff --git a/.changeset/swift-islands-promise.md b/.changeset/swift-islands-promise.md new file mode 100644 index 0000000000..0f29242878 --- /dev/null +++ b/.changeset/swift-islands-promise.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Correctly emit mode when passing `node` to the command `astro add` diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index 02e49b7545..d90075ce78 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -457,7 +457,21 @@ async function setAdapter(ast: t.File, adapter: IntegrationInfo, exportName: str return false; }) as t.ObjectProperty | undefined; - const adapterCall = t.callExpression(adapterId, []); + let adapterCall; + switch (adapter.id) { + // the node adapter requires a mode + case 'node': { + adapterCall = t.callExpression(adapterId, [ + t.objectExpression([ + t.objectProperty(t.identifier('mode'), t.stringLiteral('standalone')), + ]), + ]); + break; + } + default: { + adapterCall = t.callExpression(adapterId, []); + } + } if (!adapterProp) { configObject.properties.push(t.objectProperty(t.identifier('adapter'), adapterCall));