Skip to content

Commit

Permalink
fix(astro): correctly change configuration when node adapter is added (
Browse files Browse the repository at this point in the history
…#6333)

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
  • Loading branch information
ematipico and natemoo-re committed Feb 22, 2023
1 parent 3b1871a commit 63dda6d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/swift-islands-promise.md
@@ -0,0 +1,5 @@
---
'astro': patch
---

Correctly emit mode when passing `node` to the command `astro add`
16 changes: 15 additions & 1 deletion packages/astro/src/core/add/index.ts
Expand Up @@ -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));
Expand Down

0 comments on commit 63dda6d

Please sign in to comment.