fix(astro): correctly change configuration when node adapter is added (#6333)

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
Emanuele Stoppa 2023-02-22 20:53:56 +00:00 committed by GitHub
parent 3b1871a726
commit 63dda6dedd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Correctly emit mode when passing `node` to the command `astro add`

View file

@ -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));