Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/swift-islands-promise.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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